Add ability to fetch all Vec details in one call.
[ldk-java] / src / main / jni / bindings.c
1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
3 #include <lightning.h>
4 #include <string.h>
5 #include <stdatomic.h>
6 #include <assert.h>
7 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
8
9 #include <threads.h>
10 static mtx_t allocation_mtx;
11
12 void __attribute__((constructor)) init_mtx() {
13         DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
14 }
15
16 typedef struct allocation {
17         struct allocation* next;
18         void* ptr;
19         const char* struct_name;
20 } allocation;
21 static allocation* allocation_ll = NULL;
22
23 void* MALLOC(size_t len, const char* struct_name) {
24         void* res = malloc(len);
25         allocation* new_alloc = malloc(sizeof(allocation));
26         new_alloc->ptr = res;
27         new_alloc->struct_name = struct_name;
28         DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
29         new_alloc->next = allocation_ll;
30         allocation_ll = new_alloc;
31         DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
32         return res;
33 }
34
35 void FREE(void* ptr) {
36         allocation* p = NULL;
37         DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
38         allocation* it = allocation_ll;
39         while (it->ptr != ptr) { p = it; it = it->next; }
40         if (p) { p->next = it->next; } else { allocation_ll = it->next; }
41         DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
42         DO_ASSERT(it->ptr == ptr);
43         free(it);
44         free(ptr);
45 }
46
47 void __attribute__((destructor)) check_leaks() {
48         for (allocation* a = allocation_ll; a != NULL; a = a->next) { fprintf(stderr, "%s %p remains\n", a->struct_name, a->ptr); }
49         DO_ASSERT(allocation_ll == NULL);
50 }
51
52 jmethodID ordinal_meth = NULL;
53 jmethodID slicedef_meth = NULL;
54 jclass slicedef_cls = NULL;
55 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
56         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
57         DO_ASSERT(ordinal_meth != NULL);
58         slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
59         DO_ASSERT(slicedef_meth != NULL);
60         slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
61         DO_ASSERT(slicedef_cls != NULL);
62 }
63
64 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
65         return *((bool*)ptr);
66 }
67 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
68         return *((long*)ptr);
69 }
70 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
71         FREE((void*)ptr);
72 }
73 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
74         LDKu8slice *slice = (LDKu8slice*)slice_ptr;
75         jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
76         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
77         return ret_arr;
78 }
79 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
80         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
81         vec->datalen = (*_env)->GetArrayLength(_env, bytes);
82         vec->data = (uint8_t*)malloc(vec->datalen); // May be freed by rust, so don't track allocation
83         (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
84         return (long)vec;
85 }
86 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
87         // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
88         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
89         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
90         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
91         _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
92         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
93         return (long)vec->datalen;
94 }
95 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
96         // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
97         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
98         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
99         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
100         _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
101         LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
102         vec->data = NULL;
103         vec->datalen = 0;
104         return (long)vec;
105 }
106
107 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
108 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
109 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
110 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
111
112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new(JNIEnv * _env, jclass _b) {
113         LDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
114         return (long)key;
115 }
116 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
117         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
118                 case 0: return LDKAccessError_UnknownChain;
119                 case 1: return LDKAccessError_UnknownTx;
120         }
121         abort();
122 }
123 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
124         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
125         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAccessError;");
126         DO_ASSERT(enum_class != NULL);
127         switch (val) {
128                 case LDKAccessError_UnknownChain: {
129                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKAccessError_UnknownChain", "Lorg/ldk/impl/bindings$LDKAccessError;");
130                         DO_ASSERT(field != NULL);
131                         return (*env)->GetStaticObjectField(env, enum_class, field);
132                 }
133                 case LDKAccessError_UnknownTx: {
134                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKAccessError_UnknownTx", "Lorg/ldk/impl/bindings$LDKAccessError;");
135                         DO_ASSERT(field != NULL);
136                         return (*env)->GetStaticObjectField(env, enum_class, field);
137                 }
138                 default: abort();
139         }
140 }
141
142 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
143         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
144                 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
145                 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
146         }
147         abort();
148 }
149 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
150         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
151         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
152         DO_ASSERT(enum_class != NULL);
153         switch (val) {
154                 case LDKChannelMonitorUpdateErr_TemporaryFailure: {
155                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
156                         DO_ASSERT(field != NULL);
157                         return (*env)->GetStaticObjectField(env, enum_class, field);
158                 }
159                 case LDKChannelMonitorUpdateErr_PermanentFailure: {
160                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
161                         DO_ASSERT(field != NULL);
162                         return (*env)->GetStaticObjectField(env, enum_class, field);
163                 }
164                 default: abort();
165         }
166 }
167
168 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
169         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
170                 case 0: return LDKConfirmationTarget_Background;
171                 case 1: return LDKConfirmationTarget_Normal;
172                 case 2: return LDKConfirmationTarget_HighPriority;
173         }
174         abort();
175 }
176 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
177         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
178         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
179         DO_ASSERT(enum_class != NULL);
180         switch (val) {
181                 case LDKConfirmationTarget_Background: {
182                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_Background", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
183                         DO_ASSERT(field != NULL);
184                         return (*env)->GetStaticObjectField(env, enum_class, field);
185                 }
186                 case LDKConfirmationTarget_Normal: {
187                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
188                         DO_ASSERT(field != NULL);
189                         return (*env)->GetStaticObjectField(env, enum_class, field);
190                 }
191                 case LDKConfirmationTarget_HighPriority: {
192                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
193                         DO_ASSERT(field != NULL);
194                         return (*env)->GetStaticObjectField(env, enum_class, field);
195                 }
196                 default: abort();
197         }
198 }
199
200 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
201         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
202                 case 0: return LDKLevel_Off;
203                 case 1: return LDKLevel_Error;
204                 case 2: return LDKLevel_Warn;
205                 case 3: return LDKLevel_Info;
206                 case 4: return LDKLevel_Debug;
207                 case 5: return LDKLevel_Trace;
208         }
209         abort();
210 }
211 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
212         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
213         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKLevel;");
214         DO_ASSERT(enum_class != NULL);
215         switch (val) {
216                 case LDKLevel_Off: {
217                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Off", "Lorg/ldk/impl/bindings$LDKLevel;");
218                         DO_ASSERT(field != NULL);
219                         return (*env)->GetStaticObjectField(env, enum_class, field);
220                 }
221                 case LDKLevel_Error: {
222                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Error", "Lorg/ldk/impl/bindings$LDKLevel;");
223                         DO_ASSERT(field != NULL);
224                         return (*env)->GetStaticObjectField(env, enum_class, field);
225                 }
226                 case LDKLevel_Warn: {
227                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Warn", "Lorg/ldk/impl/bindings$LDKLevel;");
228                         DO_ASSERT(field != NULL);
229                         return (*env)->GetStaticObjectField(env, enum_class, field);
230                 }
231                 case LDKLevel_Info: {
232                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Info", "Lorg/ldk/impl/bindings$LDKLevel;");
233                         DO_ASSERT(field != NULL);
234                         return (*env)->GetStaticObjectField(env, enum_class, field);
235                 }
236                 case LDKLevel_Debug: {
237                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Debug", "Lorg/ldk/impl/bindings$LDKLevel;");
238                         DO_ASSERT(field != NULL);
239                         return (*env)->GetStaticObjectField(env, enum_class, field);
240                 }
241                 case LDKLevel_Trace: {
242                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Trace", "Lorg/ldk/impl/bindings$LDKLevel;");
243                         DO_ASSERT(field != NULL);
244                         return (*env)->GetStaticObjectField(env, enum_class, field);
245                 }
246                 default: abort();
247         }
248 }
249
250 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
251         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
252                 case 0: return LDKNetwork_Bitcoin;
253                 case 1: return LDKNetwork_Testnet;
254                 case 2: return LDKNetwork_Regtest;
255         }
256         abort();
257 }
258 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
259         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
260         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetwork;");
261         DO_ASSERT(enum_class != NULL);
262         switch (val) {
263                 case LDKNetwork_Bitcoin: {
264                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Bitcoin", "Lorg/ldk/impl/bindings$LDKNetwork;");
265                         DO_ASSERT(field != NULL);
266                         return (*env)->GetStaticObjectField(env, enum_class, field);
267                 }
268                 case LDKNetwork_Testnet: {
269                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Testnet", "Lorg/ldk/impl/bindings$LDKNetwork;");
270                         DO_ASSERT(field != NULL);
271                         return (*env)->GetStaticObjectField(env, enum_class, field);
272                 }
273                 case LDKNetwork_Regtest: {
274                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Regtest", "Lorg/ldk/impl/bindings$LDKNetwork;");
275                         DO_ASSERT(field != NULL);
276                         return (*env)->GetStaticObjectField(env, enum_class, field);
277                 }
278                 default: abort();
279         }
280 }
281
282 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
283         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
284                 case 0: return LDKSecp256k1Error_IncorrectSignature;
285                 case 1: return LDKSecp256k1Error_InvalidMessage;
286                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
287                 case 3: return LDKSecp256k1Error_InvalidSignature;
288                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
289                 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
290                 case 6: return LDKSecp256k1Error_InvalidTweak;
291                 case 7: return LDKSecp256k1Error_NotEnoughMemory;
292                 case 8: return LDKSecp256k1Error_CallbackPanicked;
293         }
294         abort();
295 }
296 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
297         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
298         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
299         DO_ASSERT(enum_class != NULL);
300         switch (val) {
301                 case LDKSecp256k1Error_IncorrectSignature: {
302                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
303                         DO_ASSERT(field != NULL);
304                         return (*env)->GetStaticObjectField(env, enum_class, field);
305                 }
306                 case LDKSecp256k1Error_InvalidMessage: {
307                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
308                         DO_ASSERT(field != NULL);
309                         return (*env)->GetStaticObjectField(env, enum_class, field);
310                 }
311                 case LDKSecp256k1Error_InvalidPublicKey: {
312                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
313                         DO_ASSERT(field != NULL);
314                         return (*env)->GetStaticObjectField(env, enum_class, field);
315                 }
316                 case LDKSecp256k1Error_InvalidSignature: {
317                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
318                         DO_ASSERT(field != NULL);
319                         return (*env)->GetStaticObjectField(env, enum_class, field);
320                 }
321                 case LDKSecp256k1Error_InvalidSecretKey: {
322                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
323                         DO_ASSERT(field != NULL);
324                         return (*env)->GetStaticObjectField(env, enum_class, field);
325                 }
326                 case LDKSecp256k1Error_InvalidRecoveryId: {
327                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
328                         DO_ASSERT(field != NULL);
329                         return (*env)->GetStaticObjectField(env, enum_class, field);
330                 }
331                 case LDKSecp256k1Error_InvalidTweak: {
332                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
333                         DO_ASSERT(field != NULL);
334                         return (*env)->GetStaticObjectField(env, enum_class, field);
335                 }
336                 case LDKSecp256k1Error_NotEnoughMemory: {
337                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
338                         DO_ASSERT(field != NULL);
339                         return (*env)->GetStaticObjectField(env, enum_class, field);
340                 }
341                 case LDKSecp256k1Error_CallbackPanicked: {
342                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
343                         DO_ASSERT(field != NULL);
344                         return (*env)->GetStaticObjectField(env, enum_class, field);
345                 }
346                 default: abort();
347         }
348 }
349
350 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
351         LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
352         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
353 }
354 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
355         return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
356 }
357 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
358         if (((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok) {
359                 return (long)((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->contents.result;
360         } else {
361                 return (long)((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->contents.err;
362         }
363 }
364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMonitorUpdateError_1optional_1none (JNIEnv * env, jclass _a) {
365         LDKMonitorUpdateError *ret = MALLOC(sizeof(LDKMonitorUpdateError), "LDKMonitorUpdateError");
366         ret->inner = NULL;
367         return (long)ret;
368 }
369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
370         return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
371 }
372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
373         if (((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok) {
374                 return (long)((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->contents.result;
375         } else {
376                 return (long)((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->contents.err;
377         }
378 }
379 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOutPoint_1optional_1none (JNIEnv * env, jclass _a) {
380         LDKOutPoint *ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint");
381         ret->inner = NULL;
382         return (long)ret;
383 }
384 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
385         LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
386         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
387 }
388 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
389         LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
390         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
391 }
392 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
393         return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
394 }
395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
396         if (((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok) {
397                 return (long)((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->contents.result;
398         } else {
399                 return (long)((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->contents.err;
400         }
401 }
402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
403         return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
404 }
405 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
406         if (((LDKCResult_SignatureNoneZ*)arg)->result_ok) {
407                 return (long)((LDKCResult_SignatureNoneZ*)arg)->contents.result;
408         } else {
409                 return (long)((LDKCResult_SignatureNoneZ*)arg)->contents.err;
410         }
411 }
412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
413         return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
414 }
415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
416         if (((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok) {
417                 return (long)((LDKCResult_CVec_SignatureZNoneZ*)arg)->contents.result;
418         } else {
419                 return (long)((LDKCResult_CVec_SignatureZNoneZ*)arg)->contents.err;
420         }
421 }
422 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
423         return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
424 }
425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
426         if (((LDKCResult_NoneAPIErrorZ*)arg)->result_ok) {
427                 return (long)((LDKCResult_NoneAPIErrorZ*)arg)->contents.result;
428         } else {
429                 return (long)((LDKCResult_NoneAPIErrorZ*)arg)->contents.err;
430         }
431 }
432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1optional_1none (JNIEnv * env, jclass _a) {
433         LDKPaymentSendFailure *ret = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
434         ret->inner = NULL;
435         return (long)ret;
436 }
437 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
438         return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
439 }
440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
441         if (((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok) {
442                 return (long)((LDKCResult_NonePaymentSendFailureZ*)arg)->contents.result;
443         } else {
444                 return (long)((LDKCResult_NonePaymentSendFailureZ*)arg)->contents.err;
445         }
446 }
447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelAnnouncement_1optional_1none (JNIEnv * env, jclass _a) {
448         LDKChannelAnnouncement *ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
449         ret->inner = NULL;
450         return (long)ret;
451 }
452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelUpdate_1optional_1none (JNIEnv * env, jclass _a) {
453         LDKChannelUpdate *ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
454         ret->inner = NULL;
455         return (long)ret;
456 }
457 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPeerHandleError_1optional_1none (JNIEnv * env, jclass _a) {
458         LDKPeerHandleError *ret = MALLOC(sizeof(LDKPeerHandleError), "LDKPeerHandleError");
459         ret->inner = NULL;
460         return (long)ret;
461 }
462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
463         return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
464 }
465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
466         if (((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok) {
467                 return (long)((LDKCResult_NonePeerHandleErrorZ*)arg)->contents.result;
468         } else {
469                 return (long)((LDKCResult_NonePeerHandleErrorZ*)arg)->contents.err;
470         }
471 }
472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHTLCOutputInCommitment_1optional_1none (JNIEnv * env, jclass _a) {
473         LDKHTLCOutputInCommitment *ret = MALLOC(sizeof(LDKHTLCOutputInCommitment), "LDKHTLCOutputInCommitment");
474         ret->inner = NULL;
475         return (long)ret;
476 }
477 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
478         LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
479         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
480 }
481 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAcceptChannel_1optional_1none (JNIEnv * env, jclass _a) {
482         LDKAcceptChannel *ret = MALLOC(sizeof(LDKAcceptChannel), "LDKAcceptChannel");
483         ret->inner = NULL;
484         return (long)ret;
485 }
486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKOpenChannel_1optional_1none (JNIEnv * env, jclass _a) {
487         LDKOpenChannel *ret = MALLOC(sizeof(LDKOpenChannel), "LDKOpenChannel");
488         ret->inner = NULL;
489         return (long)ret;
490 }
491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKFundingCreated_1optional_1none (JNIEnv * env, jclass _a) {
492         LDKFundingCreated *ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated");
493         ret->inner = NULL;
494         return (long)ret;
495 }
496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKFundingSigned_1optional_1none (JNIEnv * env, jclass _a) {
497         LDKFundingSigned *ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned");
498         ret->inner = NULL;
499         return (long)ret;
500 }
501 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKFundingLocked_1optional_1none (JNIEnv * env, jclass _a) {
502         LDKFundingLocked *ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked");
503         ret->inner = NULL;
504         return (long)ret;
505 }
506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAnnouncementSignatures_1optional_1none (JNIEnv * env, jclass _a) {
507         LDKAnnouncementSignatures *ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures");
508         ret->inner = NULL;
509         return (long)ret;
510 }
511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCommitmentUpdate_1optional_1none (JNIEnv * env, jclass _a) {
512         LDKCommitmentUpdate *ret = MALLOC(sizeof(LDKCommitmentUpdate), "LDKCommitmentUpdate");
513         ret->inner = NULL;
514         return (long)ret;
515 }
516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRevokeAndACK_1optional_1none (JNIEnv * env, jclass _a) {
517         LDKRevokeAndACK *ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK");
518         ret->inner = NULL;
519         return (long)ret;
520 }
521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKClosingSigned_1optional_1none (JNIEnv * env, jclass _a) {
522         LDKClosingSigned *ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned");
523         ret->inner = NULL;
524         return (long)ret;
525 }
526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKShutdown_1optional_1none (JNIEnv * env, jclass _a) {
527         LDKShutdown *ret = MALLOC(sizeof(LDKShutdown), "LDKShutdown");
528         ret->inner = NULL;
529         return (long)ret;
530 }
531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelReestablish_1optional_1none (JNIEnv * env, jclass _a) {
532         LDKChannelReestablish *ret = MALLOC(sizeof(LDKChannelReestablish), "LDKChannelReestablish");
533         ret->inner = NULL;
534         return (long)ret;
535 }
536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNodeAnnouncement_1optional_1none (JNIEnv * env, jclass _a) {
537         LDKNodeAnnouncement *ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
538         ret->inner = NULL;
539         return (long)ret;
540 }
541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKErrorMessage_1optional_1none (JNIEnv * env, jclass _a) {
542         LDKErrorMessage *ret = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage");
543         ret->inner = NULL;
544         return (long)ret;
545 }
546 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
547         LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
548         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
549 }
550 typedef struct LDKMessageSendEventsProvider_JCalls {
551         atomic_size_t refcnt;
552         JavaVM *vm;
553         jobject o;
554         jmethodID get_and_clear_pending_msg_events_meth;
555 } LDKMessageSendEventsProvider_JCalls;
556 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
557         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
558         JNIEnv *env;
559         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
560         LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_and_clear_pending_msg_events_meth);
561         LDKCVec_MessageSendEventZ res = *ret;
562         FREE(ret);
563         return res;
564 }
565 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
566         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
567         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
568                 JNIEnv *env;
569                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
570                 (*env)->DeleteGlobalRef(env, j_calls->o);
571                 FREE(j_calls);
572         }
573 }
574 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
575         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
576         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
577         return (void*) this_arg;
578 }
579 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
580         jclass c = (*env)->GetObjectClass(env, o);
581         DO_ASSERT(c != NULL);
582         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
583         atomic_init(&calls->refcnt, 1);
584         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
585         calls->o = (*env)->NewGlobalRef(env, o);
586         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
587         DO_ASSERT(calls->get_and_clear_pending_msg_events_meth != NULL);
588
589         LDKMessageSendEventsProvider ret = {
590                 .this_arg = (void*) calls,
591                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
592                 .free = LDKMessageSendEventsProvider_JCalls_free,
593         };
594         return ret;
595 }
596 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
597         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
598         *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
599         return (long)res_ptr;
600 }
601 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
602         return ((LDKMessageSendEventsProvider_JCalls*)val)->o;
603 }
604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1call_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong arg) {
605         LDKMessageSendEventsProvider* arg_conv = (LDKMessageSendEventsProvider*)arg;
606         LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
607         *ret = (arg_conv->get_and_clear_pending_msg_events)(arg_conv->this_arg);
608         return (long)ret;
609 }
610
611 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
612         LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
613         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
614 }
615 typedef struct LDKEventsProvider_JCalls {
616         atomic_size_t refcnt;
617         JavaVM *vm;
618         jobject o;
619         jmethodID get_and_clear_pending_events_meth;
620 } LDKEventsProvider_JCalls;
621 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
622         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
623         JNIEnv *env;
624         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
625         LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_and_clear_pending_events_meth);
626         LDKCVec_EventZ res = *ret;
627         FREE(ret);
628         return res;
629 }
630 static void LDKEventsProvider_JCalls_free(void* this_arg) {
631         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
632         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
633                 JNIEnv *env;
634                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
635                 (*env)->DeleteGlobalRef(env, j_calls->o);
636                 FREE(j_calls);
637         }
638 }
639 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
640         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
641         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
642         return (void*) this_arg;
643 }
644 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
645         jclass c = (*env)->GetObjectClass(env, o);
646         DO_ASSERT(c != NULL);
647         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
648         atomic_init(&calls->refcnt, 1);
649         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
650         calls->o = (*env)->NewGlobalRef(env, o);
651         calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
652         DO_ASSERT(calls->get_and_clear_pending_events_meth != NULL);
653
654         LDKEventsProvider ret = {
655                 .this_arg = (void*) calls,
656                 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
657                 .free = LDKEventsProvider_JCalls_free,
658         };
659         return ret;
660 }
661 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
662         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
663         *res_ptr = LDKEventsProvider_init(env, _a, o);
664         return (long)res_ptr;
665 }
666 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
667         return ((LDKEventsProvider_JCalls*)val)->o;
668 }
669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1call_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong arg) {
670         LDKEventsProvider* arg_conv = (LDKEventsProvider*)arg;
671         LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
672         *ret = (arg_conv->get_and_clear_pending_events)(arg_conv->this_arg);
673         return (long)ret;
674 }
675
676 typedef struct LDKLogger_JCalls {
677         atomic_size_t refcnt;
678         JavaVM *vm;
679         jobject o;
680         jmethodID log_meth;
681 } LDKLogger_JCalls;
682 void log_jcall(const void* this_arg, const char *record) {
683         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
684         JNIEnv *env;
685         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
686         jstring record_conv = (*env)->NewStringUTF(env, record);
687         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->log_meth, record_conv);
688 }
689 static void LDKLogger_JCalls_free(void* this_arg) {
690         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
691         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
692                 JNIEnv *env;
693                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
694                 (*env)->DeleteGlobalRef(env, j_calls->o);
695                 FREE(j_calls);
696         }
697 }
698 static void* LDKLogger_JCalls_clone(const void* this_arg) {
699         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
700         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
701         return (void*) this_arg;
702 }
703 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
704         jclass c = (*env)->GetObjectClass(env, o);
705         DO_ASSERT(c != NULL);
706         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
707         atomic_init(&calls->refcnt, 1);
708         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
709         calls->o = (*env)->NewGlobalRef(env, o);
710         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
711         DO_ASSERT(calls->log_meth != NULL);
712
713         LDKLogger ret = {
714                 .this_arg = (void*) calls,
715                 .log = log_jcall,
716                 .free = LDKLogger_JCalls_free,
717         };
718         return ret;
719 }
720 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
721         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
722         *res_ptr = LDKLogger_init(env, _a, o);
723         return (long)res_ptr;
724 }
725 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
726         return ((LDKLogger_JCalls*)val)->o;
727 }
728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelHandshakeConfig_1optional_1none (JNIEnv * env, jclass _a) {
729         LDKChannelHandshakeConfig *ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
730         ret->inner = NULL;
731         return (long)ret;
732 }
733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelHandshakeLimits_1optional_1none (JNIEnv * env, jclass _a) {
734         LDKChannelHandshakeLimits *ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
735         ret->inner = NULL;
736         return (long)ret;
737 }
738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelConfig_1optional_1none (JNIEnv * env, jclass _a) {
739         LDKChannelConfig *ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
740         ret->inner = NULL;
741         return (long)ret;
742 }
743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUserConfig_1optional_1none (JNIEnv * env, jclass _a) {
744         LDKUserConfig *ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
745         ret->inner = NULL;
746         return (long)ret;
747 }
748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
749         return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
750 }
751 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
752         if (((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok) {
753                 return (long)((LDKCResult_TxOutAccessErrorZ*)arg)->contents.result;
754         } else {
755                 return (long)((LDKCResult_TxOutAccessErrorZ*)arg)->contents.err;
756         }
757 }
758 typedef struct LDKAccess_JCalls {
759         atomic_size_t refcnt;
760         JavaVM *vm;
761         jobject o;
762         jmethodID get_utxo_meth;
763 } LDKAccess_JCalls;
764 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
765         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
766         JNIEnv *env;
767         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
768         jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
769         (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
770         LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
771         LDKCResult_TxOutAccessErrorZ res = *ret;
772         FREE(ret);
773         return res;
774 }
775 static void LDKAccess_JCalls_free(void* this_arg) {
776         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
777         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
778                 JNIEnv *env;
779                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
780                 (*env)->DeleteGlobalRef(env, j_calls->o);
781                 FREE(j_calls);
782         }
783 }
784 static void* LDKAccess_JCalls_clone(const void* this_arg) {
785         LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
786         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
787         return (void*) this_arg;
788 }
789 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
790         jclass c = (*env)->GetObjectClass(env, o);
791         DO_ASSERT(c != NULL);
792         LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
793         atomic_init(&calls->refcnt, 1);
794         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
795         calls->o = (*env)->NewGlobalRef(env, o);
796         calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
797         DO_ASSERT(calls->get_utxo_meth != NULL);
798
799         LDKAccess ret = {
800                 .this_arg = (void*) calls,
801                 .get_utxo = get_utxo_jcall,
802                 .free = LDKAccess_JCalls_free,
803         };
804         return ret;
805 }
806 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
807         LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
808         *res_ptr = LDKAccess_init(env, _a, o);
809         return (long)res_ptr;
810 }
811 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
812         return ((LDKAccess_JCalls*)val)->o;
813 }
814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1call_1get_1utxo(JNIEnv * _env, jclass _b, jlong arg, jbyteArray genesis_hash, jlong short_channel_id) {
815         LDKAccess* arg_conv = (LDKAccess*)arg;
816         unsigned char genesis_hash_arr[32];
817         (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
818         unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
819         LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
820         *ret = (arg_conv->get_utxo)(arg_conv->this_arg, genesis_hash_ref, short_channel_id);
821         return (long)ret;
822 }
823
824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelPublicKeys_1optional_1none (JNIEnv * env, jclass _a) {
825         LDKChannelPublicKeys *ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
826         ret->inner = NULL;
827         return (long)ret;
828 }
829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPreCalculatedTxCreationKeys_1optional_1none (JNIEnv * env, jclass _a) {
830         LDKPreCalculatedTxCreationKeys *ret = MALLOC(sizeof(LDKPreCalculatedTxCreationKeys), "LDKPreCalculatedTxCreationKeys");
831         ret->inner = NULL;
832         return (long)ret;
833 }
834 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
835         LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
836         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKHTLCOutputInCommitment));
837 }
838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHolderCommitmentTransaction_1optional_1none (JNIEnv * env, jclass _a) {
839         LDKHolderCommitmentTransaction *ret = MALLOC(sizeof(LDKHolderCommitmentTransaction), "LDKHolderCommitmentTransaction");
840         ret->inner = NULL;
841         return (long)ret;
842 }
843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUnsignedChannelAnnouncement_1optional_1none (JNIEnv * env, jclass _a) {
844         LDKUnsignedChannelAnnouncement *ret = MALLOC(sizeof(LDKUnsignedChannelAnnouncement), "LDKUnsignedChannelAnnouncement");
845         ret->inner = NULL;
846         return (long)ret;
847 }
848 typedef struct LDKChannelKeys_JCalls {
849         atomic_size_t refcnt;
850         JavaVM *vm;
851         jobject o;
852         jmethodID get_per_commitment_point_meth;
853         jmethodID release_commitment_secret_meth;
854         jmethodID key_derivation_params_meth;
855         jmethodID sign_counterparty_commitment_meth;
856         jmethodID sign_holder_commitment_meth;
857         jmethodID sign_holder_commitment_htlc_transactions_meth;
858         jmethodID sign_justice_transaction_meth;
859         jmethodID sign_counterparty_htlc_transaction_meth;
860         jmethodID sign_closing_transaction_meth;
861         jmethodID sign_channel_announcement_meth;
862         jmethodID on_accept_meth;
863 } LDKChannelKeys_JCalls;
864 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
865         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
866         JNIEnv *env;
867         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
868         LDKPublicKey* ret = (LDKPublicKey*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_per_commitment_point_meth, idx);
869         LDKPublicKey res = *ret;
870         FREE(ret);
871         return res;
872 }
873 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
874         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
875         JNIEnv *env;
876         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
877         LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*env)->CallLongMethod(env, j_calls->o, j_calls->release_commitment_secret_meth, idx);
878         LDKThirtyTwoBytes res = *ret;
879         FREE(ret);
880         return res;
881 }
882 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
883         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
884         JNIEnv *env;
885         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
886         LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, j_calls->o, j_calls->key_derivation_params_meth);
887         LDKC2Tuple_u64u64Z res = *ret;
888         FREE(ret);
889         return res;
890 }
891 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs) {
892         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
893         JNIEnv *env;
894         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
895         long commitment_tx_ref = (long)&commitment_tx;
896         long htlcs_ref = (long)&htlcs;
897         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys, htlcs_ref);
898         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
899         FREE(ret);
900         return res;
901 }
902 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
903         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
904         JNIEnv *env;
905         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
906         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
907         LDKCResult_SignatureNoneZ res = *ret;
908         FREE(ret);
909         return res;
910 }
911 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
912         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
913         JNIEnv *env;
914         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
915         LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
916         LDKCResult_CVec_SignatureZNoneZ res = *ret;
917         FREE(ret);
918         return res;
919 }
920 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc) {
921         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
922         JNIEnv *env;
923         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
924         long justice_tx_ref = (long)&justice_tx;
925         jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
926         (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
927         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc);
928         LDKCResult_SignatureNoneZ res = *ret;
929         FREE(ret);
930         return res;
931 }
932 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc) {
933         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
934         JNIEnv *env;
935         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
936         long htlc_tx_ref = (long)&htlc_tx;
937         long per_commitment_point_ref = (long)&per_commitment_point;
938         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_ref, htlc);
939         LDKCResult_SignatureNoneZ res = *ret;
940         FREE(ret);
941         return res;
942 }
943 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
944         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
945         JNIEnv *env;
946         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
947         long closing_tx_ref = (long)&closing_tx;
948         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_closing_transaction_meth, closing_tx_ref);
949         LDKCResult_SignatureNoneZ res = *ret;
950         FREE(ret);
951         return res;
952 }
953 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
954         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
955         JNIEnv *env;
956         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
957         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->sign_channel_announcement_meth, msg);
958         LDKCResult_SignatureNoneZ res = *ret;
959         FREE(ret);
960         return res;
961 }
962 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
963         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
964         JNIEnv *env;
965         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
966         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
967 }
968 static void LDKChannelKeys_JCalls_free(void* this_arg) {
969         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
970         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
971                 JNIEnv *env;
972                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
973                 (*env)->DeleteGlobalRef(env, j_calls->o);
974                 FREE(j_calls);
975         }
976 }
977 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
978         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
979         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
980         return (void*) this_arg;
981 }
982 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
983         jclass c = (*env)->GetObjectClass(env, o);
984         DO_ASSERT(c != NULL);
985         LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
986         atomic_init(&calls->refcnt, 1);
987         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
988         calls->o = (*env)->NewGlobalRef(env, o);
989         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)J");
990         DO_ASSERT(calls->get_per_commitment_point_meth != NULL);
991         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)J");
992         DO_ASSERT(calls->release_commitment_secret_meth != NULL);
993         calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
994         DO_ASSERT(calls->key_derivation_params_meth != NULL);
995         calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
996         DO_ASSERT(calls->sign_counterparty_commitment_meth != NULL);
997         calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
998         DO_ASSERT(calls->sign_holder_commitment_meth != NULL);
999         calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1000         DO_ASSERT(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1001         calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1002         DO_ASSERT(calls->sign_justice_transaction_meth != NULL);
1003         calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJJJ)J");
1004         DO_ASSERT(calls->sign_counterparty_htlc_transaction_meth != NULL);
1005         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1006         DO_ASSERT(calls->sign_closing_transaction_meth != NULL);
1007         calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1008         DO_ASSERT(calls->sign_channel_announcement_meth != NULL);
1009         calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1010         DO_ASSERT(calls->on_accept_meth != NULL);
1011
1012         LDKChannelKeys ret = {
1013                 .this_arg = (void*) calls,
1014                 .get_per_commitment_point = get_per_commitment_point_jcall,
1015                 .release_commitment_secret = release_commitment_secret_jcall,
1016                 .key_derivation_params = key_derivation_params_jcall,
1017                 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1018                 .sign_holder_commitment = sign_holder_commitment_jcall,
1019                 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1020                 .sign_justice_transaction = sign_justice_transaction_jcall,
1021                 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1022                 .sign_closing_transaction = sign_closing_transaction_jcall,
1023                 .sign_channel_announcement = sign_channel_announcement_jcall,
1024                 .on_accept = on_accept_jcall,
1025                 .clone = LDKChannelKeys_JCalls_clone,
1026                 .free = LDKChannelKeys_JCalls_free,
1027         };
1028         return ret;
1029 }
1030 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1031         LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1032         *res_ptr = LDKChannelKeys_init(env, _a, o);
1033         return (long)res_ptr;
1034 }
1035 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1036         return ((LDKChannelKeys_JCalls*)val)->o;
1037 }
1038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1039         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1040         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
1041         *ret = (arg_conv->get_per_commitment_point)(arg_conv->this_arg, idx);
1042         return (long)ret;
1043 }
1044
1045 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong arg, jlong idx) {
1046         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1047         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
1048         *ret = (arg_conv->release_commitment_secret)(arg_conv->this_arg, idx);
1049         return (long)ret;
1050 }
1051
1052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong arg) {
1053         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1054         LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1055         *ret = (arg_conv->key_derivation_params)(arg_conv->this_arg);
1056         return (long)ret;
1057 }
1058
1059 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlong htlcs) {
1060         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1061         LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1062         FREE((void*)commitment_tx);
1063         LDKPreCalculatedTxCreationKeys* keys_conv = (LDKPreCalculatedTxCreationKeys*)keys;
1064         LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1065         FREE((void*)htlcs);
1066         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1067         *ret = (arg_conv->sign_counterparty_commitment)(arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, keys_conv, htlcs_conv);
1068         return (long)ret;
1069 }
1070
1071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1072         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1073         LDKHolderCommitmentTransaction* holder_commitment_tx_conv = (LDKHolderCommitmentTransaction*)holder_commitment_tx;
1074         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1075         *ret = (arg_conv->sign_holder_commitment)(arg_conv->this_arg, holder_commitment_tx_conv);
1076         return (long)ret;
1077 }
1078
1079 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong arg, jlong holder_commitment_tx) {
1080         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1081         LDKHolderCommitmentTransaction* holder_commitment_tx_conv = (LDKHolderCommitmentTransaction*)holder_commitment_tx;
1082         LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1083         *ret = (arg_conv->sign_holder_commitment_htlc_transactions)(arg_conv->this_arg, holder_commitment_tx_conv);
1084         return (long)ret;
1085 }
1086
1087 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
1088         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1089         LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1090         FREE((void*)justice_tx);
1091         unsigned char per_commitment_key_arr[32];
1092         (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1093         unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1094         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
1095         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1096         *ret = (arg_conv->sign_justice_transaction)(arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, htlc_conv);
1097         return (long)ret;
1098 }
1099
1100 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong htlc_tx, jlong input, jlong amount, jlong per_commitment_point, jlong htlc) {
1101         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1102         LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1103         FREE((void*)htlc_tx);
1104         LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
1105         FREE((void*)per_commitment_point);
1106         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
1107         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1108         *ret = (arg_conv->sign_counterparty_htlc_transaction)(arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_conv, htlc_conv);
1109         return (long)ret;
1110 }
1111
1112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong closing_tx) {
1113         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1114         LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1115         FREE((void*)closing_tx);
1116         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1117         *ret = (arg_conv->sign_closing_transaction)(arg_conv->this_arg, closing_tx_conv);
1118         return (long)ret;
1119 }
1120
1121 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
1122         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1123         LDKUnsignedChannelAnnouncement* msg_conv = (LDKUnsignedChannelAnnouncement*)msg;
1124         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1125         *ret = (arg_conv->sign_channel_announcement)(arg_conv->this_arg, msg_conv);
1126         return (long)ret;
1127 }
1128
1129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1call_1on_1accept(JNIEnv * _env, jclass _b, jlong arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) {
1130         LDKChannelKeys* arg_conv = (LDKChannelKeys*)arg;
1131         LDKChannelPublicKeys* channel_points_conv = (LDKChannelPublicKeys*)channel_points;
1132         return (arg_conv->on_accept)(arg_conv->this_arg, channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
1133 }
1134
1135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelMonitor_1optional_1none (JNIEnv * env, jclass _a) {
1136         LDKChannelMonitor *ret = MALLOC(sizeof(LDKChannelMonitor), "LDKChannelMonitor");
1137         ret->inner = NULL;
1138         return (long)ret;
1139 }
1140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelMonitorUpdate_1optional_1none (JNIEnv * env, jclass _a) {
1141         LDKChannelMonitorUpdate *ret = MALLOC(sizeof(LDKChannelMonitorUpdate), "LDKChannelMonitorUpdate");
1142         ret->inner = NULL;
1143         return (long)ret;
1144 }
1145 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1optional_1none (JNIEnv * env, jclass _a) {
1146         LDKMonitorEvent *ret = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
1147         ret->inner = NULL;
1148         return (long)ret;
1149 }
1150 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1151         LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
1152         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMonitorEvent));
1153 }
1154 typedef struct LDKWatch_JCalls {
1155         atomic_size_t refcnt;
1156         JavaVM *vm;
1157         jobject o;
1158         jmethodID watch_channel_meth;
1159         jmethodID update_channel_meth;
1160         jmethodID release_pending_monitor_events_meth;
1161 } LDKWatch_JCalls;
1162 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
1163         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1164         JNIEnv *env;
1165         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1166         long funding_txo_ref = (long)&funding_txo;
1167         long monitor_ref = (long)&monitor;
1168         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
1169         LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
1170         FREE(ret);
1171         return res;
1172 }
1173 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
1174         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1175         JNIEnv *env;
1176         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1177         long funding_txo_ref = (long)&funding_txo;
1178         long update_ref = (long)&update;
1179         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->update_channel_meth, funding_txo_ref, update_ref);
1180         LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
1181         FREE(ret);
1182         return res;
1183 }
1184 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
1185         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1186         JNIEnv *env;
1187         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1188         LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->release_pending_monitor_events_meth);
1189         LDKCVec_MonitorEventZ res = *ret;
1190         FREE(ret);
1191         return res;
1192 }
1193 static void LDKWatch_JCalls_free(void* this_arg) {
1194         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1195         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1196                 JNIEnv *env;
1197                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1198                 (*env)->DeleteGlobalRef(env, j_calls->o);
1199                 FREE(j_calls);
1200         }
1201 }
1202 static void* LDKWatch_JCalls_clone(const void* this_arg) {
1203         LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
1204         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1205         return (void*) this_arg;
1206 }
1207 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
1208         jclass c = (*env)->GetObjectClass(env, o);
1209         DO_ASSERT(c != NULL);
1210         LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
1211         atomic_init(&calls->refcnt, 1);
1212         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1213         calls->o = (*env)->NewGlobalRef(env, o);
1214         calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
1215         DO_ASSERT(calls->watch_channel_meth != NULL);
1216         calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
1217         DO_ASSERT(calls->update_channel_meth != NULL);
1218         calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
1219         DO_ASSERT(calls->release_pending_monitor_events_meth != NULL);
1220
1221         LDKWatch ret = {
1222                 .this_arg = (void*) calls,
1223                 .watch_channel = watch_channel_jcall,
1224                 .update_channel = update_channel_jcall,
1225                 .release_pending_monitor_events = release_pending_monitor_events_jcall,
1226                 .free = LDKWatch_JCalls_free,
1227         };
1228         return ret;
1229 }
1230 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
1231         LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
1232         *res_ptr = LDKWatch_init(env, _a, o);
1233         return (long)res_ptr;
1234 }
1235 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1236         return ((LDKWatch_JCalls*)val)->o;
1237 }
1238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1watch_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong monitor) {
1239         LDKWatch* arg_conv = (LDKWatch*)arg;
1240         LDKOutPoint funding_txo_conv = *(LDKOutPoint*)funding_txo;
1241         FREE((void*)funding_txo);
1242         funding_txo_conv.is_owned = true;
1243         LDKChannelMonitor monitor_conv = *(LDKChannelMonitor*)monitor;
1244         FREE((void*)monitor);
1245         monitor_conv.is_owned = true;
1246         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1247         *ret = (arg_conv->watch_channel)(arg_conv->this_arg, funding_txo_conv, monitor_conv);
1248         return (long)ret;
1249 }
1250
1251 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1update_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong funding_txo, jlong update) {
1252         LDKWatch* arg_conv = (LDKWatch*)arg;
1253         LDKOutPoint funding_txo_conv = *(LDKOutPoint*)funding_txo;
1254         FREE((void*)funding_txo);
1255         funding_txo_conv.is_owned = true;
1256         LDKChannelMonitorUpdate update_conv = *(LDKChannelMonitorUpdate*)update;
1257         FREE((void*)update);
1258         update_conv.is_owned = true;
1259         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1260         *ret = (arg_conv->update_channel)(arg_conv->this_arg, funding_txo_conv, update_conv);
1261         return (long)ret;
1262 }
1263
1264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKWatch_1call_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong arg) {
1265         LDKWatch* arg_conv = (LDKWatch*)arg;
1266         LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1267         *ret = (arg_conv->release_pending_monitor_events)(arg_conv->this_arg);
1268         return (long)ret;
1269 }
1270
1271 typedef struct LDKFilter_JCalls {
1272         atomic_size_t refcnt;
1273         JavaVM *vm;
1274         jobject o;
1275         jmethodID register_tx_meth;
1276         jmethodID register_output_meth;
1277 } LDKFilter_JCalls;
1278 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
1279         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
1280         JNIEnv *env;
1281         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1282         jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
1283         (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
1284         long script_pubkey_ref = (long)&script_pubkey;
1285         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->register_tx_meth, txid_arr, script_pubkey_ref);
1286 }
1287 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
1288         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
1289         JNIEnv *env;
1290         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1291         long script_pubkey_ref = (long)&script_pubkey;
1292         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->register_output_meth, outpoint, script_pubkey_ref);
1293 }
1294 static void LDKFilter_JCalls_free(void* this_arg) {
1295         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
1296         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1297                 JNIEnv *env;
1298                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1299                 (*env)->DeleteGlobalRef(env, j_calls->o);
1300                 FREE(j_calls);
1301         }
1302 }
1303 static void* LDKFilter_JCalls_clone(const void* this_arg) {
1304         LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
1305         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1306         return (void*) this_arg;
1307 }
1308 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
1309         jclass c = (*env)->GetObjectClass(env, o);
1310         DO_ASSERT(c != NULL);
1311         LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
1312         atomic_init(&calls->refcnt, 1);
1313         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1314         calls->o = (*env)->NewGlobalRef(env, o);
1315         calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([BJ)V");
1316         DO_ASSERT(calls->register_tx_meth != NULL);
1317         calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(JJ)V");
1318         DO_ASSERT(calls->register_output_meth != NULL);
1319
1320         LDKFilter ret = {
1321                 .this_arg = (void*) calls,
1322                 .register_tx = register_tx_jcall,
1323                 .register_output = register_output_jcall,
1324                 .free = LDKFilter_JCalls_free,
1325         };
1326         return ret;
1327 }
1328 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
1329         LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
1330         *res_ptr = LDKFilter_init(env, _a, o);
1331         return (long)res_ptr;
1332 }
1333 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1334         return ((LDKFilter_JCalls*)val)->o;
1335 }
1336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1tx(JNIEnv * _env, jclass _b, jlong arg, jbyteArray txid, jlong script_pubkey) {
1337         LDKFilter* arg_conv = (LDKFilter*)arg;
1338         unsigned char txid_arr[32];
1339         (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
1340         unsigned char (*txid_ref)[32] = &txid_arr;
1341         LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
1342         return (arg_conv->register_tx)(arg_conv->this_arg, txid_ref, script_pubkey_conv);
1343 }
1344
1345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKFilter_1call_1register_1output(JNIEnv * _env, jclass _b, jlong arg, jlong outpoint, jlong script_pubkey) {
1346         LDKFilter* arg_conv = (LDKFilter*)arg;
1347         LDKOutPoint* outpoint_conv = (LDKOutPoint*)outpoint;
1348         LDKu8slice script_pubkey_conv = *(LDKu8slice*)script_pubkey;
1349         return (arg_conv->register_output)(arg_conv->this_arg, outpoint_conv, script_pubkey_conv);
1350 }
1351
1352 typedef struct LDKBroadcasterInterface_JCalls {
1353         atomic_size_t refcnt;
1354         JavaVM *vm;
1355         jobject o;
1356         jmethodID broadcast_transaction_meth;
1357 } LDKBroadcasterInterface_JCalls;
1358 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
1359         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1360         JNIEnv *env;
1361         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1362         long tx_ref = (long)&tx;
1363         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->broadcast_transaction_meth, tx_ref);
1364 }
1365 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
1366         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1367         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1368                 JNIEnv *env;
1369                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1370                 (*env)->DeleteGlobalRef(env, j_calls->o);
1371                 FREE(j_calls);
1372         }
1373 }
1374 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
1375         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
1376         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1377         return (void*) this_arg;
1378 }
1379 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
1380         jclass c = (*env)->GetObjectClass(env, o);
1381         DO_ASSERT(c != NULL);
1382         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
1383         atomic_init(&calls->refcnt, 1);
1384         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1385         calls->o = (*env)->NewGlobalRef(env, o);
1386         calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
1387         DO_ASSERT(calls->broadcast_transaction_meth != NULL);
1388
1389         LDKBroadcasterInterface ret = {
1390                 .this_arg = (void*) calls,
1391                 .broadcast_transaction = broadcast_transaction_jcall,
1392                 .free = LDKBroadcasterInterface_JCalls_free,
1393         };
1394         return ret;
1395 }
1396 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
1397         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
1398         *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
1399         return (long)res_ptr;
1400 }
1401 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1402         return ((LDKBroadcasterInterface_JCalls*)val)->o;
1403 }
1404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1call_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong arg, jlong tx) {
1405         LDKBroadcasterInterface* arg_conv = (LDKBroadcasterInterface*)arg;
1406         LDKTransaction tx_conv = *(LDKTransaction*)tx;
1407         FREE((void*)tx);
1408         return (arg_conv->broadcast_transaction)(arg_conv->this_arg, tx_conv);
1409 }
1410
1411 typedef struct LDKFeeEstimator_JCalls {
1412         atomic_size_t refcnt;
1413         JavaVM *vm;
1414         jobject o;
1415         jmethodID get_est_sat_per_1000_weight_meth;
1416 } LDKFeeEstimator_JCalls;
1417 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
1418         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
1419         JNIEnv *env;
1420         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1421         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
1422         return (*env)->CallIntMethod(env, j_calls->o, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
1423 }
1424 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
1425         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
1426         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1427                 JNIEnv *env;
1428                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1429                 (*env)->DeleteGlobalRef(env, j_calls->o);
1430                 FREE(j_calls);
1431         }
1432 }
1433 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
1434         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
1435         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1436         return (void*) this_arg;
1437 }
1438 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
1439         jclass c = (*env)->GetObjectClass(env, o);
1440         DO_ASSERT(c != NULL);
1441         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
1442         atomic_init(&calls->refcnt, 1);
1443         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1444         calls->o = (*env)->NewGlobalRef(env, o);
1445         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/impl/bindings$LDKConfirmationTarget;)I");
1446         DO_ASSERT(calls->get_est_sat_per_1000_weight_meth != NULL);
1447
1448         LDKFeeEstimator ret = {
1449                 .this_arg = (void*) calls,
1450                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
1451                 .free = LDKFeeEstimator_JCalls_free,
1452         };
1453         return ret;
1454 }
1455 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
1456         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
1457         *res_ptr = LDKFeeEstimator_init(env, _a, o);
1458         return (long)res_ptr;
1459 }
1460 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1461         return ((LDKFeeEstimator_JCalls*)val)->o;
1462 }
1463 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1call_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong arg, jclass confirmation_target) {
1464         LDKFeeEstimator* arg_conv = (LDKFeeEstimator*)arg;
1465         LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
1466         return (arg_conv->get_est_sat_per_1000_weight)(arg_conv->this_arg, confirmation_target_conv);
1467 }
1468
1469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChainMonitor_1optional_1none (JNIEnv * env, jclass _a) {
1470         LDKChainMonitor *ret = MALLOC(sizeof(LDKChainMonitor), "LDKChainMonitor");
1471         ret->inner = NULL;
1472         return (long)ret;
1473 }
1474 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1475         LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
1476         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
1477 }
1478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKHTLCUpdate_1optional_1none (JNIEnv * env, jclass _a) {
1479         LDKHTLCUpdate *ret = MALLOC(sizeof(LDKHTLCUpdate), "LDKHTLCUpdate");
1480         ret->inner = NULL;
1481         return (long)ret;
1482 }
1483 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1484         LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
1485         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
1486 }
1487 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1488         LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
1489         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
1490 }
1491 typedef struct LDKKeysInterface_JCalls {
1492         atomic_size_t refcnt;
1493         JavaVM *vm;
1494         jobject o;
1495         jmethodID get_node_secret_meth;
1496         jmethodID get_destination_script_meth;
1497         jmethodID get_shutdown_pubkey_meth;
1498         jmethodID get_channel_keys_meth;
1499         jmethodID get_secure_random_bytes_meth;
1500 } LDKKeysInterface_JCalls;
1501 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
1502         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1503         JNIEnv *env;
1504         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1505         LDKSecretKey* ret = (LDKSecretKey*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_node_secret_meth);
1506         LDKSecretKey res = *ret;
1507         FREE(ret);
1508         return res;
1509 }
1510 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
1511         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1512         JNIEnv *env;
1513         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1514         LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_destination_script_meth);
1515         LDKCVec_u8Z res = *ret;
1516         FREE(ret);
1517         return res;
1518 }
1519 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
1520         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1521         JNIEnv *env;
1522         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1523         LDKPublicKey* ret = (LDKPublicKey*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_shutdown_pubkey_meth);
1524         LDKPublicKey res = *ret;
1525         FREE(ret);
1526         return res;
1527 }
1528 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
1529         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1530         JNIEnv *env;
1531         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1532         LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
1533         LDKChannelKeys res = *ret;
1534         FREE(ret);
1535         return res;
1536 }
1537 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
1538         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1539         JNIEnv *env;
1540         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1541         LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_secure_random_bytes_meth);
1542         LDKThirtyTwoBytes res = *ret;
1543         FREE(ret);
1544         return res;
1545 }
1546 static void LDKKeysInterface_JCalls_free(void* this_arg) {
1547         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1548         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1549                 JNIEnv *env;
1550                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1551                 (*env)->DeleteGlobalRef(env, j_calls->o);
1552                 FREE(j_calls);
1553         }
1554 }
1555 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
1556         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
1557         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1558         return (void*) this_arg;
1559 }
1560 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
1561         jclass c = (*env)->GetObjectClass(env, o);
1562         DO_ASSERT(c != NULL);
1563         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
1564         atomic_init(&calls->refcnt, 1);
1565         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1566         calls->o = (*env)->NewGlobalRef(env, o);
1567         calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J");
1568         DO_ASSERT(calls->get_node_secret_meth != NULL);
1569         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
1570         DO_ASSERT(calls->get_destination_script_meth != NULL);
1571         calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()J");
1572         DO_ASSERT(calls->get_shutdown_pubkey_meth != NULL);
1573         calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
1574         DO_ASSERT(calls->get_channel_keys_meth != NULL);
1575         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()J");
1576         DO_ASSERT(calls->get_secure_random_bytes_meth != NULL);
1577
1578         LDKKeysInterface ret = {
1579                 .this_arg = (void*) calls,
1580                 .get_node_secret = get_node_secret_jcall,
1581                 .get_destination_script = get_destination_script_jcall,
1582                 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
1583                 .get_channel_keys = get_channel_keys_jcall,
1584                 .get_secure_random_bytes = get_secure_random_bytes_jcall,
1585                 .free = LDKKeysInterface_JCalls_free,
1586         };
1587         return ret;
1588 }
1589 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
1590         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
1591         *res_ptr = LDKKeysInterface_init(env, _a, o);
1592         return (long)res_ptr;
1593 }
1594 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1595         return ((LDKKeysInterface_JCalls*)val)->o;
1596 }
1597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong arg) {
1598         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
1599         LDKSecretKey* ret = MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
1600         *ret = (arg_conv->get_node_secret)(arg_conv->this_arg);
1601         return (long)ret;
1602 }
1603
1604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong arg) {
1605         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
1606         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
1607         *ret = (arg_conv->get_destination_script)(arg_conv->this_arg);
1608         return (long)ret;
1609 }
1610
1611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong arg) {
1612         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
1613         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
1614         *ret = (arg_conv->get_shutdown_pubkey)(arg_conv->this_arg);
1615         return (long)ret;
1616 }
1617
1618 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong arg, jboolean inbound, jlong channel_value_satoshis) {
1619         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
1620         LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1621         *ret = (arg_conv->get_channel_keys)(arg_conv->this_arg, inbound, channel_value_satoshis);
1622         return (long)ret;
1623 }
1624
1625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1call_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong arg) {
1626         LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
1627         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
1628         *ret = (arg_conv->get_secure_random_bytes)(arg_conv->this_arg);
1629         return (long)ret;
1630 }
1631
1632 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKInMemoryChannelKeys_1optional_1none (JNIEnv * env, jclass _a) {
1633         LDKInMemoryChannelKeys *ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
1634         ret->inner = NULL;
1635         return (long)ret;
1636 }
1637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKKeysManager_1optional_1none (JNIEnv * env, jclass _a) {
1638         LDKKeysManager *ret = MALLOC(sizeof(LDKKeysManager), "LDKKeysManager");
1639         ret->inner = NULL;
1640         return (long)ret;
1641 }
1642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelManager_1optional_1none (JNIEnv * env, jclass _a) {
1643         LDKChannelManager *ret = MALLOC(sizeof(LDKChannelManager), "LDKChannelManager");
1644         ret->inner = NULL;
1645         return (long)ret;
1646 }
1647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelDetails_1optional_1none (JNIEnv * env, jclass _a) {
1648         LDKChannelDetails *ret = MALLOC(sizeof(LDKChannelDetails), "LDKChannelDetails");
1649         ret->inner = NULL;
1650         return (long)ret;
1651 }
1652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKInitFeatures_1optional_1none (JNIEnv * env, jclass _a) {
1653         LDKInitFeatures *ret = MALLOC(sizeof(LDKInitFeatures), "LDKInitFeatures");
1654         ret->inner = NULL;
1655         return (long)ret;
1656 }
1657 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1658         LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
1659         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKChannelDetails));
1660 }
1661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoute_1optional_1none (JNIEnv * env, jclass _a) {
1662         LDKRoute *ret = MALLOC(sizeof(LDKRoute), "LDKRoute");
1663         ret->inner = NULL;
1664         return (long)ret;
1665 }
1666 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1667         LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
1668         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
1669 }
1670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUpdateAddHTLC_1optional_1none (JNIEnv * env, jclass _a) {
1671         LDKUpdateAddHTLC *ret = MALLOC(sizeof(LDKUpdateAddHTLC), "LDKUpdateAddHTLC");
1672         ret->inner = NULL;
1673         return (long)ret;
1674 }
1675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUpdateFulfillHTLC_1optional_1none (JNIEnv * env, jclass _a) {
1676         LDKUpdateFulfillHTLC *ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC");
1677         ret->inner = NULL;
1678         return (long)ret;
1679 }
1680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUpdateFailHTLC_1optional_1none (JNIEnv * env, jclass _a) {
1681         LDKUpdateFailHTLC *ret = MALLOC(sizeof(LDKUpdateFailHTLC), "LDKUpdateFailHTLC");
1682         ret->inner = NULL;
1683         return (long)ret;
1684 }
1685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUpdateFailMalformedHTLC_1optional_1none (JNIEnv * env, jclass _a) {
1686         LDKUpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKUpdateFailMalformedHTLC), "LDKUpdateFailMalformedHTLC");
1687         ret->inner = NULL;
1688         return (long)ret;
1689 }
1690 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCommitmentSigned_1optional_1none (JNIEnv * env, jclass _a) {
1691         LDKCommitmentSigned *ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
1692         ret->inner = NULL;
1693         return (long)ret;
1694 }
1695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUpdateFee_1optional_1none (JNIEnv * env, jclass _a) {
1696         LDKUpdateFee *ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
1697         ret->inner = NULL;
1698         return (long)ret;
1699 }
1700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKInit_1optional_1none (JNIEnv * env, jclass _a) {
1701         LDKInit *ret = MALLOC(sizeof(LDKInit), "LDKInit");
1702         ret->inner = NULL;
1703         return (long)ret;
1704 }
1705 typedef struct LDKChannelMessageHandler_JCalls {
1706         atomic_size_t refcnt;
1707         JavaVM *vm;
1708         jobject o;
1709         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
1710         jmethodID handle_open_channel_meth;
1711         jmethodID handle_accept_channel_meth;
1712         jmethodID handle_funding_created_meth;
1713         jmethodID handle_funding_signed_meth;
1714         jmethodID handle_funding_locked_meth;
1715         jmethodID handle_shutdown_meth;
1716         jmethodID handle_closing_signed_meth;
1717         jmethodID handle_update_add_htlc_meth;
1718         jmethodID handle_update_fulfill_htlc_meth;
1719         jmethodID handle_update_fail_htlc_meth;
1720         jmethodID handle_update_fail_malformed_htlc_meth;
1721         jmethodID handle_commitment_signed_meth;
1722         jmethodID handle_revoke_and_ack_meth;
1723         jmethodID handle_update_fee_meth;
1724         jmethodID handle_announcement_signatures_meth;
1725         jmethodID peer_disconnected_meth;
1726         jmethodID peer_connected_meth;
1727         jmethodID handle_channel_reestablish_meth;
1728         jmethodID handle_error_meth;
1729 } LDKChannelMessageHandler_JCalls;
1730 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
1731         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1732         JNIEnv *env;
1733         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1734         long their_node_id_ref = (long)&their_node_id;
1735         long their_features_ref = (long)&their_features;
1736         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_open_channel_meth, their_node_id_ref, their_features_ref, msg);
1737 }
1738 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
1739         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1740         JNIEnv *env;
1741         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1742         long their_node_id_ref = (long)&their_node_id;
1743         long their_features_ref = (long)&their_features;
1744         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_accept_channel_meth, their_node_id_ref, their_features_ref, msg);
1745 }
1746 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
1747         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1748         JNIEnv *env;
1749         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1750         long their_node_id_ref = (long)&their_node_id;
1751         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_created_meth, their_node_id_ref, msg);
1752 }
1753 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
1754         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1755         JNIEnv *env;
1756         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1757         long their_node_id_ref = (long)&their_node_id;
1758         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_signed_meth, their_node_id_ref, msg);
1759 }
1760 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
1761         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1762         JNIEnv *env;
1763         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1764         long their_node_id_ref = (long)&their_node_id;
1765         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_funding_locked_meth, their_node_id_ref, msg);
1766 }
1767 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
1768         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1769         JNIEnv *env;
1770         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1771         long their_node_id_ref = (long)&their_node_id;
1772         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_shutdown_meth, their_node_id_ref, msg);
1773 }
1774 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
1775         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1776         JNIEnv *env;
1777         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1778         long their_node_id_ref = (long)&their_node_id;
1779         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_closing_signed_meth, their_node_id_ref, msg);
1780 }
1781 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
1782         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1783         JNIEnv *env;
1784         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1785         long their_node_id_ref = (long)&their_node_id;
1786         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_add_htlc_meth, their_node_id_ref, msg);
1787 }
1788 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
1789         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1790         JNIEnv *env;
1791         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1792         long their_node_id_ref = (long)&their_node_id;
1793         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fulfill_htlc_meth, their_node_id_ref, msg);
1794 }
1795 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
1796         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1797         JNIEnv *env;
1798         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1799         long their_node_id_ref = (long)&their_node_id;
1800         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fail_htlc_meth, their_node_id_ref, msg);
1801 }
1802 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
1803         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1804         JNIEnv *env;
1805         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1806         long their_node_id_ref = (long)&their_node_id;
1807         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_ref, msg);
1808 }
1809 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
1810         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1811         JNIEnv *env;
1812         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1813         long their_node_id_ref = (long)&their_node_id;
1814         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_commitment_signed_meth, their_node_id_ref, msg);
1815 }
1816 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
1817         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1818         JNIEnv *env;
1819         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1820         long their_node_id_ref = (long)&their_node_id;
1821         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_revoke_and_ack_meth, their_node_id_ref, msg);
1822 }
1823 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
1824         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1825         JNIEnv *env;
1826         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1827         long their_node_id_ref = (long)&their_node_id;
1828         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_update_fee_meth, their_node_id_ref, msg);
1829 }
1830 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
1831         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1832         JNIEnv *env;
1833         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1834         long their_node_id_ref = (long)&their_node_id;
1835         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_announcement_signatures_meth, their_node_id_ref, msg);
1836 }
1837 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
1838         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1839         JNIEnv *env;
1840         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1841         long their_node_id_ref = (long)&their_node_id;
1842         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->peer_disconnected_meth, their_node_id_ref, no_connection_possible);
1843 }
1844 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
1845         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1846         JNIEnv *env;
1847         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1848         long their_node_id_ref = (long)&their_node_id;
1849         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->peer_connected_meth, their_node_id_ref, msg);
1850 }
1851 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
1852         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1853         JNIEnv *env;
1854         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1855         long their_node_id_ref = (long)&their_node_id;
1856         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_channel_reestablish_meth, their_node_id_ref, msg);
1857 }
1858 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
1859         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1860         JNIEnv *env;
1861         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1862         long their_node_id_ref = (long)&their_node_id;
1863         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_error_meth, their_node_id_ref, msg);
1864 }
1865 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
1866         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1867         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1868                 JNIEnv *env;
1869                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1870                 (*env)->DeleteGlobalRef(env, j_calls->o);
1871                 FREE(j_calls);
1872         }
1873 }
1874 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
1875         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1876         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1877         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
1878         return (void*) this_arg;
1879 }
1880 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
1881         jclass c = (*env)->GetObjectClass(env, o);
1882         DO_ASSERT(c != NULL);
1883         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
1884         atomic_init(&calls->refcnt, 1);
1885         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1886         calls->o = (*env)->NewGlobalRef(env, o);
1887         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "(JJJ)V");
1888         DO_ASSERT(calls->handle_open_channel_meth != NULL);
1889         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "(JJJ)V");
1890         DO_ASSERT(calls->handle_accept_channel_meth != NULL);
1891         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "(JJ)V");
1892         DO_ASSERT(calls->handle_funding_created_meth != NULL);
1893         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "(JJ)V");
1894         DO_ASSERT(calls->handle_funding_signed_meth != NULL);
1895         calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "(JJ)V");
1896         DO_ASSERT(calls->handle_funding_locked_meth != NULL);
1897         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "(JJ)V");
1898         DO_ASSERT(calls->handle_shutdown_meth != NULL);
1899         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "(JJ)V");
1900         DO_ASSERT(calls->handle_closing_signed_meth != NULL);
1901         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "(JJ)V");
1902         DO_ASSERT(calls->handle_update_add_htlc_meth != NULL);
1903         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "(JJ)V");
1904         DO_ASSERT(calls->handle_update_fulfill_htlc_meth != NULL);
1905         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "(JJ)V");
1906         DO_ASSERT(calls->handle_update_fail_htlc_meth != NULL);
1907         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "(JJ)V");
1908         DO_ASSERT(calls->handle_update_fail_malformed_htlc_meth != NULL);
1909         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "(JJ)V");
1910         DO_ASSERT(calls->handle_commitment_signed_meth != NULL);
1911         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "(JJ)V");
1912         DO_ASSERT(calls->handle_revoke_and_ack_meth != NULL);
1913         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "(JJ)V");
1914         DO_ASSERT(calls->handle_update_fee_meth != NULL);
1915         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "(JJ)V");
1916         DO_ASSERT(calls->handle_announcement_signatures_meth != NULL);
1917         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "(JZ)V");
1918         DO_ASSERT(calls->peer_disconnected_meth != NULL);
1919         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "(JJ)V");
1920         DO_ASSERT(calls->peer_connected_meth != NULL);
1921         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "(JJ)V");
1922         DO_ASSERT(calls->handle_channel_reestablish_meth != NULL);
1923         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "(JJ)V");
1924         DO_ASSERT(calls->handle_error_meth != NULL);
1925
1926         LDKChannelMessageHandler ret = {
1927                 .this_arg = (void*) calls,
1928                 .handle_open_channel = handle_open_channel_jcall,
1929                 .handle_accept_channel = handle_accept_channel_jcall,
1930                 .handle_funding_created = handle_funding_created_jcall,
1931                 .handle_funding_signed = handle_funding_signed_jcall,
1932                 .handle_funding_locked = handle_funding_locked_jcall,
1933                 .handle_shutdown = handle_shutdown_jcall,
1934                 .handle_closing_signed = handle_closing_signed_jcall,
1935                 .handle_update_add_htlc = handle_update_add_htlc_jcall,
1936                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
1937                 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
1938                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
1939                 .handle_commitment_signed = handle_commitment_signed_jcall,
1940                 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
1941                 .handle_update_fee = handle_update_fee_jcall,
1942                 .handle_announcement_signatures = handle_announcement_signatures_jcall,
1943                 .peer_disconnected = peer_disconnected_jcall,
1944                 .peer_connected = peer_connected_jcall,
1945                 .handle_channel_reestablish = handle_channel_reestablish_jcall,
1946                 .handle_error = handle_error_jcall,
1947                 .free = LDKChannelMessageHandler_JCalls_free,
1948                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
1949         };
1950         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
1951         return ret;
1952 }
1953 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
1954         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
1955         *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
1956         return (long)res_ptr;
1957 }
1958 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1959         return ((LDKChannelMessageHandler_JCalls*)val)->o;
1960 }
1961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong their_features, jlong msg) {
1962         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
1963         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
1964         FREE((void*)their_node_id);
1965         LDKInitFeatures their_features_conv = *(LDKInitFeatures*)their_features;
1966         FREE((void*)their_features);
1967         their_features_conv.is_owned = true;
1968         LDKOpenChannel* msg_conv = (LDKOpenChannel*)msg;
1969         return (arg_conv->handle_open_channel)(arg_conv->this_arg, their_node_id_conv, their_features_conv, msg_conv);
1970 }
1971
1972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong their_features, jlong msg) {
1973         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
1974         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
1975         FREE((void*)their_node_id);
1976         LDKInitFeatures their_features_conv = *(LDKInitFeatures*)their_features;
1977         FREE((void*)their_features);
1978         their_features_conv.is_owned = true;
1979         LDKAcceptChannel* msg_conv = (LDKAcceptChannel*)msg;
1980         return (arg_conv->handle_accept_channel)(arg_conv->this_arg, their_node_id_conv, their_features_conv, msg_conv);
1981 }
1982
1983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
1984         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
1985         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
1986         FREE((void*)their_node_id);
1987         LDKFundingCreated* msg_conv = (LDKFundingCreated*)msg;
1988         return (arg_conv->handle_funding_created)(arg_conv->this_arg, their_node_id_conv, msg_conv);
1989 }
1990
1991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
1992         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
1993         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
1994         FREE((void*)their_node_id);
1995         LDKFundingSigned* msg_conv = (LDKFundingSigned*)msg;
1996         return (arg_conv->handle_funding_signed)(arg_conv->this_arg, their_node_id_conv, msg_conv);
1997 }
1998
1999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2000         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2001         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2002         FREE((void*)their_node_id);
2003         LDKFundingLocked* msg_conv = (LDKFundingLocked*)msg;
2004         return (arg_conv->handle_funding_locked)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2005 }
2006
2007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2008         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2009         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2010         FREE((void*)their_node_id);
2011         LDKShutdown* msg_conv = (LDKShutdown*)msg;
2012         return (arg_conv->handle_shutdown)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2013 }
2014
2015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2016         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2017         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2018         FREE((void*)their_node_id);
2019         LDKClosingSigned* msg_conv = (LDKClosingSigned*)msg;
2020         return (arg_conv->handle_closing_signed)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2021 }
2022
2023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2024         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2025         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2026         FREE((void*)their_node_id);
2027         LDKUpdateAddHTLC* msg_conv = (LDKUpdateAddHTLC*)msg;
2028         return (arg_conv->handle_update_add_htlc)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2029 }
2030
2031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2032         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2033         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2034         FREE((void*)their_node_id);
2035         LDKUpdateFulfillHTLC* msg_conv = (LDKUpdateFulfillHTLC*)msg;
2036         return (arg_conv->handle_update_fulfill_htlc)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2037 }
2038
2039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2040         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2041         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2042         FREE((void*)their_node_id);
2043         LDKUpdateFailHTLC* msg_conv = (LDKUpdateFailHTLC*)msg;
2044         return (arg_conv->handle_update_fail_htlc)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2045 }
2046
2047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2048         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2049         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2050         FREE((void*)their_node_id);
2051         LDKUpdateFailMalformedHTLC* msg_conv = (LDKUpdateFailMalformedHTLC*)msg;
2052         return (arg_conv->handle_update_fail_malformed_htlc)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2053 }
2054
2055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2056         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2057         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2058         FREE((void*)their_node_id);
2059         LDKCommitmentSigned* msg_conv = (LDKCommitmentSigned*)msg;
2060         return (arg_conv->handle_commitment_signed)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2061 }
2062
2063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2064         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2065         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2066         FREE((void*)their_node_id);
2067         LDKRevokeAndACK* msg_conv = (LDKRevokeAndACK*)msg;
2068         return (arg_conv->handle_revoke_and_ack)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2069 }
2070
2071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2072         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2073         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2074         FREE((void*)their_node_id);
2075         LDKUpdateFee* msg_conv = (LDKUpdateFee*)msg;
2076         return (arg_conv->handle_update_fee)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2077 }
2078
2079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2080         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2081         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2082         FREE((void*)their_node_id);
2083         LDKAnnouncementSignatures* msg_conv = (LDKAnnouncementSignatures*)msg;
2084         return (arg_conv->handle_announcement_signatures)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2085 }
2086
2087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jboolean no_connection_possible) {
2088         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2089         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2090         FREE((void*)their_node_id);
2091         return (arg_conv->peer_disconnected)(arg_conv->this_arg, their_node_id_conv, no_connection_possible);
2092 }
2093
2094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1peer_1connected(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2095         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2096         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2097         FREE((void*)their_node_id);
2098         LDKInit* msg_conv = (LDKInit*)msg;
2099         return (arg_conv->peer_connected)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2100 }
2101
2102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2103         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2104         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2105         FREE((void*)their_node_id);
2106         LDKChannelReestablish* msg_conv = (LDKChannelReestablish*)msg;
2107         return (arg_conv->handle_channel_reestablish)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2108 }
2109
2110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1call_1handle_1error(JNIEnv * _env, jclass _b, jlong arg, jlong their_node_id, jlong msg) {
2111         LDKChannelMessageHandler* arg_conv = (LDKChannelMessageHandler*)arg;
2112         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2113         FREE((void*)their_node_id);
2114         LDKErrorMessage* msg_conv = (LDKErrorMessage*)msg;
2115         return (arg_conv->handle_error)(arg_conv->this_arg, their_node_id_conv, msg_conv);
2116 }
2117
2118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerReadArgs_1optional_1none (JNIEnv * env, jclass _a) {
2119         LDKChannelManagerReadArgs *ret = MALLOC(sizeof(LDKChannelManagerReadArgs), "LDKChannelManagerReadArgs");
2120         ret->inner = NULL;
2121         return (long)ret;
2122 }
2123 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2124         LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
2125         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKChannelMonitor));
2126 }
2127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKDecodeError_1optional_1none (JNIEnv * env, jclass _a) {
2128         LDKDecodeError *ret = MALLOC(sizeof(LDKDecodeError), "LDKDecodeError");
2129         ret->inner = NULL;
2130         return (long)ret;
2131 }
2132 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPing_1optional_1none (JNIEnv * env, jclass _a) {
2133         LDKPing *ret = MALLOC(sizeof(LDKPing), "LDKPing");
2134         ret->inner = NULL;
2135         return (long)ret;
2136 }
2137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPong_1optional_1none (JNIEnv * env, jclass _a) {
2138         LDKPong *ret = MALLOC(sizeof(LDKPong), "LDKPong");
2139         ret->inner = NULL;
2140         return (long)ret;
2141 }
2142 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKDataLossProtect_1optional_1none (JNIEnv * env, jclass _a) {
2143         LDKDataLossProtect *ret = MALLOC(sizeof(LDKDataLossProtect), "LDKDataLossProtect");
2144         ret->inner = NULL;
2145         return (long)ret;
2146 }
2147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUnsignedNodeAnnouncement_1optional_1none (JNIEnv * env, jclass _a) {
2148         LDKUnsignedNodeAnnouncement *ret = MALLOC(sizeof(LDKUnsignedNodeAnnouncement), "LDKUnsignedNodeAnnouncement");
2149         ret->inner = NULL;
2150         return (long)ret;
2151 }
2152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNodeFeatures_1optional_1none (JNIEnv * env, jclass _a) {
2153         LDKNodeFeatures *ret = MALLOC(sizeof(LDKNodeFeatures), "LDKNodeFeatures");
2154         ret->inner = NULL;
2155         return (long)ret;
2156 }
2157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelFeatures_1optional_1none (JNIEnv * env, jclass _a) {
2158         LDKChannelFeatures *ret = MALLOC(sizeof(LDKChannelFeatures), "LDKChannelFeatures");
2159         ret->inner = NULL;
2160         return (long)ret;
2161 }
2162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKUnsignedChannelUpdate_1optional_1none (JNIEnv * env, jclass _a) {
2163         LDKUnsignedChannelUpdate *ret = MALLOC(sizeof(LDKUnsignedChannelUpdate), "LDKUnsignedChannelUpdate");
2164         ret->inner = NULL;
2165         return (long)ret;
2166 }
2167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKQueryChannelRange_1optional_1none (JNIEnv * env, jclass _a) {
2168         LDKQueryChannelRange *ret = MALLOC(sizeof(LDKQueryChannelRange), "LDKQueryChannelRange");
2169         ret->inner = NULL;
2170         return (long)ret;
2171 }
2172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKReplyChannelRange_1optional_1none (JNIEnv * env, jclass _a) {
2173         LDKReplyChannelRange *ret = MALLOC(sizeof(LDKReplyChannelRange), "LDKReplyChannelRange");
2174         ret->inner = NULL;
2175         return (long)ret;
2176 }
2177 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2178         LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
2179         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
2180 }
2181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKQueryShortChannelIds_1optional_1none (JNIEnv * env, jclass _a) {
2182         LDKQueryShortChannelIds *ret = MALLOC(sizeof(LDKQueryShortChannelIds), "LDKQueryShortChannelIds");
2183         ret->inner = NULL;
2184         return (long)ret;
2185 }
2186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKReplyShortChannelIdsEnd_1optional_1none (JNIEnv * env, jclass _a) {
2187         LDKReplyShortChannelIdsEnd *ret = MALLOC(sizeof(LDKReplyShortChannelIdsEnd), "LDKReplyShortChannelIdsEnd");
2188         ret->inner = NULL;
2189         return (long)ret;
2190 }
2191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKGossipTimestampFilter_1optional_1none (JNIEnv * env, jclass _a) {
2192         LDKGossipTimestampFilter *ret = MALLOC(sizeof(LDKGossipTimestampFilter), "LDKGossipTimestampFilter");
2193         ret->inner = NULL;
2194         return (long)ret;
2195 }
2196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKLightningError_1optional_1none (JNIEnv * env, jclass _a) {
2197         LDKLightningError *ret = MALLOC(sizeof(LDKLightningError), "LDKLightningError");
2198         ret->inner = NULL;
2199         return (long)ret;
2200 }
2201 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2202         LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
2203         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateAddHTLC));
2204 }
2205 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2206         LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
2207         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateFulfillHTLC));
2208 }
2209 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2210         LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
2211         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateFailHTLC));
2212 }
2213 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2214         LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
2215         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKUpdateFailMalformedHTLC));
2216 }
2217 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2218         return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
2219 }
2220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
2221         if (((LDKCResult_boolLightningErrorZ*)arg)->result_ok) {
2222                 return (long)((LDKCResult_boolLightningErrorZ*)arg)->contents.result;
2223         } else {
2224                 return (long)((LDKCResult_boolLightningErrorZ*)arg)->contents.err;
2225         }
2226 }
2227 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2228         LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
2229         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
2230 }
2231 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2232         LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
2233         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNodeAnnouncement));
2234 }
2235 typedef struct LDKRoutingMessageHandler_JCalls {
2236         atomic_size_t refcnt;
2237         JavaVM *vm;
2238         jobject o;
2239         jmethodID handle_node_announcement_meth;
2240         jmethodID handle_channel_announcement_meth;
2241         jmethodID handle_channel_update_meth;
2242         jmethodID handle_htlc_fail_channel_update_meth;
2243         jmethodID get_next_channel_announcements_meth;
2244         jmethodID get_next_node_announcements_meth;
2245         jmethodID should_request_full_sync_meth;
2246 } LDKRoutingMessageHandler_JCalls;
2247 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
2248         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2249         JNIEnv *env;
2250         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2251         LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_node_announcement_meth, msg);
2252         LDKCResult_boolLightningErrorZ res = *ret;
2253         FREE(ret);
2254         return res;
2255 }
2256 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
2257         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2258         JNIEnv *env;
2259         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2260         LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_channel_announcement_meth, msg);
2261         LDKCResult_boolLightningErrorZ res = *ret;
2262         FREE(ret);
2263         return res;
2264 }
2265 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
2266         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2267         JNIEnv *env;
2268         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2269         LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->handle_channel_update_meth, msg);
2270         LDKCResult_boolLightningErrorZ res = *ret;
2271         FREE(ret);
2272         return res;
2273 }
2274 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
2275         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2276         JNIEnv *env;
2277         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2278         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->handle_htlc_fail_channel_update_meth, update);
2279 }
2280 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
2281         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2282         JNIEnv *env;
2283         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2284         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
2285         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
2286         FREE(ret);
2287         return res;
2288 }
2289 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
2290         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2291         JNIEnv *env;
2292         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2293         long starting_point_ref = (long)&starting_point;
2294         LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, j_calls->o, j_calls->get_next_node_announcements_meth, starting_point_ref, batch_amount);
2295         LDKCVec_NodeAnnouncementZ res = *ret;
2296         FREE(ret);
2297         return res;
2298 }
2299 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
2300         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2301         JNIEnv *env;
2302         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2303         long node_id_ref = (long)&node_id;
2304         return (*env)->CallBooleanMethod(env, j_calls->o, j_calls->should_request_full_sync_meth, node_id_ref);
2305 }
2306 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
2307         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2308         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2309                 JNIEnv *env;
2310                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2311                 (*env)->DeleteGlobalRef(env, j_calls->o);
2312                 FREE(j_calls);
2313         }
2314 }
2315 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
2316         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
2317         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2318         return (void*) this_arg;
2319 }
2320 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
2321         jclass c = (*env)->GetObjectClass(env, o);
2322         DO_ASSERT(c != NULL);
2323         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
2324         atomic_init(&calls->refcnt, 1);
2325         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2326         calls->o = (*env)->NewGlobalRef(env, o);
2327         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
2328         DO_ASSERT(calls->handle_node_announcement_meth != NULL);
2329         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
2330         DO_ASSERT(calls->handle_channel_announcement_meth != NULL);
2331         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
2332         DO_ASSERT(calls->handle_channel_update_meth != NULL);
2333         calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
2334         DO_ASSERT(calls->handle_htlc_fail_channel_update_meth != NULL);
2335         calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
2336         DO_ASSERT(calls->get_next_channel_announcements_meth != NULL);
2337         calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "(JB)J");
2338         DO_ASSERT(calls->get_next_node_announcements_meth != NULL);
2339         calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "(J)Z");
2340         DO_ASSERT(calls->should_request_full_sync_meth != NULL);
2341
2342         LDKRoutingMessageHandler ret = {
2343                 .this_arg = (void*) calls,
2344                 .handle_node_announcement = handle_node_announcement_jcall,
2345                 .handle_channel_announcement = handle_channel_announcement_jcall,
2346                 .handle_channel_update = handle_channel_update_jcall,
2347                 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
2348                 .get_next_channel_announcements = get_next_channel_announcements_jcall,
2349                 .get_next_node_announcements = get_next_node_announcements_jcall,
2350                 .should_request_full_sync = should_request_full_sync_jcall,
2351                 .free = LDKRoutingMessageHandler_JCalls_free,
2352         };
2353         return ret;
2354 }
2355 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
2356         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
2357         *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
2358         return (long)res_ptr;
2359 }
2360 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2361         return ((LDKRoutingMessageHandler_JCalls*)val)->o;
2362 }
2363 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
2364         LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
2365         LDKNodeAnnouncement* msg_conv = (LDKNodeAnnouncement*)msg;
2366         LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2367         *ret = (arg_conv->handle_node_announcement)(arg_conv->this_arg, msg_conv);
2368         return (long)ret;
2369 }
2370
2371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
2372         LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
2373         LDKChannelAnnouncement* msg_conv = (LDKChannelAnnouncement*)msg;
2374         LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2375         *ret = (arg_conv->handle_channel_announcement)(arg_conv->this_arg, msg_conv);
2376         return (long)ret;
2377 }
2378
2379 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong msg) {
2380         LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
2381         LDKChannelUpdate* msg_conv = (LDKChannelUpdate*)msg;
2382         LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2383         *ret = (arg_conv->handle_channel_update)(arg_conv->this_arg, msg_conv);
2384         return (long)ret;
2385 }
2386
2387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong arg, jlong update) {
2388         LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
2389         LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
2390         return (arg_conv->handle_htlc_fail_channel_update)(arg_conv->this_arg, update_conv);
2391 }
2392
2393 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong arg, jlong starting_point, jbyte batch_amount) {
2394         LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
2395         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
2396         *ret = (arg_conv->get_next_channel_announcements)(arg_conv->this_arg, starting_point, batch_amount);
2397         return (long)ret;
2398 }
2399
2400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong arg, jlong starting_point, jbyte batch_amount) {
2401         LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
2402         LDKPublicKey starting_point_conv = *(LDKPublicKey*)starting_point;
2403         FREE((void*)starting_point);
2404         LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
2405         *ret = (arg_conv->get_next_node_announcements)(arg_conv->this_arg, starting_point_conv, batch_amount);
2406         return (long)ret;
2407 }
2408
2409 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1call_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong arg, jlong node_id) {
2410         LDKRoutingMessageHandler* arg_conv = (LDKRoutingMessageHandler*)arg;
2411         LDKPublicKey node_id_conv = *(LDKPublicKey*)node_id;
2412         FREE((void*)node_id);
2413         return (arg_conv->should_request_full_sync)(arg_conv->this_arg, node_id_conv);
2414 }
2415
2416 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKMessageHandler_1optional_1none (JNIEnv * env, jclass _a) {
2417         LDKMessageHandler *ret = MALLOC(sizeof(LDKMessageHandler), "LDKMessageHandler");
2418         ret->inner = NULL;
2419         return (long)ret;
2420 }
2421 typedef struct LDKSocketDescriptor_JCalls {
2422         atomic_size_t refcnt;
2423         JavaVM *vm;
2424         jobject o;
2425         jmethodID send_data_meth;
2426         jmethodID disconnect_socket_meth;
2427         jmethodID eq_meth;
2428         jmethodID hash_meth;
2429 } LDKSocketDescriptor_JCalls;
2430 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
2431         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
2432         JNIEnv *env;
2433         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2434         long data_ref = (long)&data;
2435         return (*env)->CallLongMethod(env, j_calls->o, j_calls->send_data_meth, data_ref, resume_read);
2436 }
2437 void disconnect_socket_jcall(void* this_arg) {
2438         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
2439         JNIEnv *env;
2440         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2441         return (*env)->CallVoidMethod(env, j_calls->o, j_calls->disconnect_socket_meth);
2442 }
2443 bool eq_jcall(const void* this_arg, const void *other_arg) {
2444         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
2445         JNIEnv *env;
2446         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2447         return (*env)->CallBooleanMethod(env, j_calls->o, j_calls->eq_meth, other_arg);
2448 }
2449 uint64_t hash_jcall(const void* this_arg) {
2450         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
2451         JNIEnv *env;
2452         DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2453         return (*env)->CallLongMethod(env, j_calls->o, j_calls->hash_meth);
2454 }
2455 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
2456         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
2457         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2458                 JNIEnv *env;
2459                 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2460                 (*env)->DeleteGlobalRef(env, j_calls->o);
2461                 FREE(j_calls);
2462         }
2463 }
2464 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
2465         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
2466         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2467         return (void*) this_arg;
2468 }
2469 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
2470         jclass c = (*env)->GetObjectClass(env, o);
2471         DO_ASSERT(c != NULL);
2472         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
2473         atomic_init(&calls->refcnt, 1);
2474         DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2475         calls->o = (*env)->NewGlobalRef(env, o);
2476         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
2477         DO_ASSERT(calls->send_data_meth != NULL);
2478         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
2479         DO_ASSERT(calls->disconnect_socket_meth != NULL);
2480         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
2481         DO_ASSERT(calls->eq_meth != NULL);
2482         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
2483         DO_ASSERT(calls->hash_meth != NULL);
2484
2485         LDKSocketDescriptor ret = {
2486                 .this_arg = (void*) calls,
2487                 .send_data = send_data_jcall,
2488                 .disconnect_socket = disconnect_socket_jcall,
2489                 .eq = eq_jcall,
2490                 .hash = hash_jcall,
2491                 .clone = LDKSocketDescriptor_JCalls_clone,
2492                 .free = LDKSocketDescriptor_JCalls_free,
2493         };
2494         return ret;
2495 }
2496 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
2497         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
2498         *res_ptr = LDKSocketDescriptor_init(env, _a, o);
2499         return (long)res_ptr;
2500 }
2501 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2502         return ((LDKSocketDescriptor_JCalls*)val)->o;
2503 }
2504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1send_1data(JNIEnv * _env, jclass _b, jlong arg, jlong data, jboolean resume_read) {
2505         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
2506         LDKu8slice data_conv = *(LDKu8slice*)data;
2507         return (arg_conv->send_data)(arg_conv->this_arg, data_conv, resume_read);
2508 }
2509
2510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong arg) {
2511         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
2512         return (arg_conv->disconnect_socket)(arg_conv->this_arg);
2513 }
2514
2515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1call_1hash(JNIEnv * _env, jclass _b, jlong arg) {
2516         LDKSocketDescriptor* arg_conv = (LDKSocketDescriptor*)arg;
2517         return (arg_conv->hash)(arg_conv->this_arg);
2518 }
2519
2520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKPeerManager_1optional_1none (JNIEnv * env, jclass _a) {
2521         LDKPeerManager *ret = MALLOC(sizeof(LDKPeerManager), "LDKPeerManager");
2522         ret->inner = NULL;
2523         return (long)ret;
2524 }
2525 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2526         LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
2527         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
2528 }
2529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2530         return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
2531 }
2532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
2533         if (((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok) {
2534                 return (long)((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->contents.result;
2535         } else {
2536                 return (long)((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->contents.err;
2537         }
2538 }
2539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2540         return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
2541 }
2542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
2543         if (((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok) {
2544                 return (long)((LDKCResult_boolPeerHandleErrorZ*)arg)->contents.result;
2545         } else {
2546                 return (long)((LDKCResult_boolPeerHandleErrorZ*)arg)->contents.err;
2547         }
2548 }
2549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2550         return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
2551 }
2552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
2553         if (((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok) {
2554                 return (long)((LDKCResult_SecretKeySecpErrorZ*)arg)->contents.result;
2555         } else {
2556                 return (long)((LDKCResult_SecretKeySecpErrorZ*)arg)->contents.err;
2557         }
2558 }
2559 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2560         return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
2561 }
2562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
2563         if (((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok) {
2564                 return (long)((LDKCResult_PublicKeySecpErrorZ*)arg)->contents.result;
2565         } else {
2566                 return (long)((LDKCResult_PublicKeySecpErrorZ*)arg)->contents.err;
2567         }
2568 }
2569 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKTxCreationKeys_1optional_1none (JNIEnv * env, jclass _a) {
2570         LDKTxCreationKeys *ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
2571         ret->inner = NULL;
2572         return (long)ret;
2573 }
2574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2575         return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
2576 }
2577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
2578         if (((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok) {
2579                 return (long)((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->contents.result;
2580         } else {
2581                 return (long)((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->contents.err;
2582         }
2583 }
2584 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2585         LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
2586         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
2587 }
2588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouteHop_1optional_1none (JNIEnv * env, jclass _a) {
2589         LDKRouteHop *ret = MALLOC(sizeof(LDKRouteHop), "LDKRouteHop");
2590         ret->inner = NULL;
2591         return (long)ret;
2592 }
2593 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2594         LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
2595         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKRouteHop));
2596 }
2597 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2598         LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
2599         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
2600 }
2601 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouteHint_1optional_1none (JNIEnv * env, jclass _a) {
2602         LDKRouteHint *ret = MALLOC(sizeof(LDKRouteHint), "LDKRouteHint");
2603         ret->inner = NULL;
2604         return (long)ret;
2605 }
2606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRoutingFees_1optional_1none (JNIEnv * env, jclass _a) {
2607         LDKRoutingFees *ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
2608         ret->inner = NULL;
2609         return (long)ret;
2610 }
2611 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2612         return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
2613 }
2614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
2615         if (((LDKCResult_RouteLightningErrorZ*)arg)->result_ok) {
2616                 return (long)((LDKCResult_RouteLightningErrorZ*)arg)->contents.result;
2617         } else {
2618                 return (long)((LDKCResult_RouteLightningErrorZ*)arg)->contents.err;
2619         }
2620 }
2621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNetworkGraph_1optional_1none (JNIEnv * env, jclass _a) {
2622         LDKNetworkGraph *ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
2623         ret->inner = NULL;
2624         return (long)ret;
2625 }
2626 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2627         LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
2628         return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKRouteHint));
2629 }
2630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKLockedNetworkGraph_1optional_1none (JNIEnv * env, jclass _a) {
2631         LDKLockedNetworkGraph *ret = MALLOC(sizeof(LDKLockedNetworkGraph), "LDKLockedNetworkGraph");
2632         ret->inner = NULL;
2633         return (long)ret;
2634 }
2635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNetGraphMsgHandler_1optional_1none (JNIEnv * env, jclass _a) {
2636         LDKNetGraphMsgHandler *ret = MALLOC(sizeof(LDKNetGraphMsgHandler), "LDKNetGraphMsgHandler");
2637         ret->inner = NULL;
2638         return (long)ret;
2639 }
2640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKDirectionalChannelInfo_1optional_1none (JNIEnv * env, jclass _a) {
2641         LDKDirectionalChannelInfo *ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
2642         ret->inner = NULL;
2643         return (long)ret;
2644 }
2645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKChannelInfo_1optional_1none (JNIEnv * env, jclass _a) {
2646         LDKChannelInfo *ret = MALLOC(sizeof(LDKChannelInfo), "LDKChannelInfo");
2647         ret->inner = NULL;
2648         return (long)ret;
2649 }
2650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNodeAnnouncementInfo_1optional_1none (JNIEnv * env, jclass _a) {
2651         LDKNodeAnnouncementInfo *ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
2652         ret->inner = NULL;
2653         return (long)ret;
2654 }
2655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKNodeInfo_1optional_1none (JNIEnv * env, jclass _a) {
2656         LDKNodeInfo *ret = MALLOC(sizeof(LDKNodeInfo), "LDKNodeInfo");
2657         ret->inner = NULL;
2658         return (long)ret;
2659 }
2660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2661         LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
2662         FREE((void*)arg);
2663         return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
2664 }
2665
2666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2667         LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
2668         FREE((void*)arg);
2669         return C2Tuple_OutPointScriptZ_free(arg_conv);
2670 }
2671
2672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2673         LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
2674         FREE((void*)arg);
2675         return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
2676 }
2677
2678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2679         LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
2680         FREE((void*)arg);
2681         return C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
2682 }
2683
2684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
2685         LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
2686         FREE((void*)arg);
2687         return C2Tuple_u64u64Z_free(arg_conv);
2688 }
2689
2690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2691         LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
2692         FREE((void*)arg);
2693         return C2Tuple_usizeTransactionZ_free(arg_conv);
2694 }
2695
2696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2697         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
2698         FREE((void*)arg);
2699         return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
2700 }
2701
2702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2703         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
2704         FREE((void*)arg);
2705         return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
2706 }
2707
2708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2709         LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
2710         FREE((void*)arg);
2711         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2712         *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
2713         return (long)ret;
2714 }
2715
2716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2717         LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
2718         FREE((void*)arg);
2719         return CResult_CVec_SignatureZNoneZ_free(arg_conv);
2720 }
2721
2722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2723         LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
2724         FREE((void*)arg);
2725         LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2726         *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
2727         return (long)ret;
2728 }
2729
2730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2731         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
2732         FREE((void*)arg);
2733         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
2734         *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
2735         return (long)ret;
2736 }
2737
2738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2739         LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
2740         FREE((void*)arg);
2741         return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
2742 }
2743
2744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2745         LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
2746         FREE((void*)arg);
2747         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
2748         *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
2749         return (long)ret;
2750 }
2751
2752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2753         LDKAPIError arg_conv = *(LDKAPIError*)arg;
2754         FREE((void*)arg);
2755         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2756         *ret = CResult_NoneAPIErrorZ_err(arg_conv);
2757         return (long)ret;
2758 }
2759
2760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2761         LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
2762         FREE((void*)arg);
2763         return CResult_NoneAPIErrorZ_free(arg_conv);
2764 }
2765
2766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
2767         LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
2768         FREE((void*)arg);
2769         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2770         *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
2771         return (long)ret;
2772 }
2773
2774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2775         LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
2776         FREE((void*)arg);
2777         return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
2778 }
2779
2780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2781         LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
2782         FREE((void*)arg);
2783         LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
2784         *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
2785         return (long)ret;
2786 }
2787
2788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2789         LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
2790         FREE((void*)arg);
2791         return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
2792 }
2793
2794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2795         LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
2796         FREE((void*)arg);
2797         LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
2798         *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
2799         return (long)ret;
2800 }
2801
2802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2803         LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
2804         FREE((void*)arg);
2805         return CResult_NonePaymentSendFailureZ_free(arg_conv);
2806 }
2807
2808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2809         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
2810         FREE((void*)arg);
2811         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
2812         *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
2813         return (long)ret;
2814 }
2815
2816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2817         LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
2818         FREE((void*)arg);
2819         return CResult_NonePeerHandleErrorZ_free(arg_conv);
2820 }
2821
2822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
2823         LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
2824         FREE((void*)arg);
2825         LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
2826         *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
2827         return (long)ret;
2828 }
2829
2830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2831         LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
2832         FREE((void*)arg);
2833         return CResult_PublicKeySecpErrorZ_free(arg_conv);
2834 }
2835
2836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2837         LDKPublicKey arg_conv = *(LDKPublicKey*)arg;
2838         FREE((void*)arg);
2839         LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
2840         *ret = CResult_PublicKeySecpErrorZ_ok(arg_conv);
2841         return (long)ret;
2842 }
2843
2844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2845         LDKLightningError arg_conv = *(LDKLightningError*)arg;
2846         FREE((void*)arg);
2847         LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
2848         *ret = CResult_RouteLightningErrorZ_err(arg_conv);
2849         return (long)ret;
2850 }
2851
2852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2853         LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
2854         FREE((void*)arg);
2855         return CResult_RouteLightningErrorZ_free(arg_conv);
2856 }
2857
2858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2859         LDKRoute arg_conv = *(LDKRoute*)arg;
2860         FREE((void*)arg);
2861         LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
2862         *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
2863         return (long)ret;
2864 }
2865
2866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
2867         LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
2868         FREE((void*)arg);
2869         LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
2870         *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
2871         return (long)ret;
2872 }
2873
2874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2875         LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
2876         FREE((void*)arg);
2877         return CResult_SecretKeySecpErrorZ_free(arg_conv);
2878 }
2879
2880 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2881         LDKSecretKey arg_conv = *(LDKSecretKey*)arg;
2882         FREE((void*)arg);
2883         LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
2884         *ret = CResult_SecretKeySecpErrorZ_ok(arg_conv);
2885         return (long)ret;
2886 }
2887
2888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2889         LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
2890         FREE((void*)arg);
2891         return CResult_SignatureNoneZ_free(arg_conv);
2892 }
2893
2894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2895         LDKSignature arg_conv = *(LDKSignature*)arg;
2896         FREE((void*)arg);
2897         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2898         *ret = CResult_SignatureNoneZ_ok(arg_conv);
2899         return (long)ret;
2900 }
2901
2902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
2903         LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
2904         FREE((void*)arg);
2905         LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
2906         *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
2907         return (long)ret;
2908 }
2909
2910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2911         LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
2912         FREE((void*)arg);
2913         return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
2914 }
2915
2916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2917         LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
2918         FREE((void*)arg);
2919         LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
2920         *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
2921         return (long)ret;
2922 }
2923
2924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
2925         LDKAccessError arg_conv = *(LDKAccessError*)arg;
2926         FREE((void*)arg);
2927         LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2928         *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
2929         return (long)ret;
2930 }
2931
2932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2933         LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
2934         FREE((void*)arg);
2935         return CResult_TxOutAccessErrorZ_free(arg_conv);
2936 }
2937
2938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
2939         LDKTxOut arg_conv = *(LDKTxOut*)arg;
2940         FREE((void*)arg);
2941         LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
2942         *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
2943         return (long)ret;
2944 }
2945
2946 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2947         LDKLightningError arg_conv = *(LDKLightningError*)arg;
2948         FREE((void*)arg);
2949         LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2950         *ret = CResult_boolLightningErrorZ_err(arg_conv);
2951         return (long)ret;
2952 }
2953
2954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2955         LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
2956         FREE((void*)arg);
2957         return CResult_boolLightningErrorZ_free(arg_conv);
2958 }
2959
2960 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
2961         LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
2962         *ret = CResult_boolLightningErrorZ_ok(arg);
2963         return (long)ret;
2964 }
2965
2966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
2967         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
2968         FREE((void*)arg);
2969         LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
2970         *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
2971         return (long)ret;
2972 }
2973
2974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2975         LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
2976         FREE((void*)arg);
2977         return CResult_boolPeerHandleErrorZ_free(arg_conv);
2978 }
2979
2980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
2981         LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
2982         *ret = CResult_boolPeerHandleErrorZ_ok(arg);
2983         return (long)ret;
2984 }
2985
2986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2987         LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
2988         FREE((void*)arg);
2989         return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
2990 }
2991
2992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2993         LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
2994         FREE((void*)arg);
2995         return CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
2996 }
2997
2998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
2999         LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
3000         FREE((void*)arg);
3001         return CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
3002 }
3003
3004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3005         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
3006         FREE((void*)arg);
3007         return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
3008 }
3009
3010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3011         LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
3012         FREE((void*)arg);
3013         return CVec_CVec_RouteHopZZ_free(arg_conv);
3014 }
3015
3016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3017         LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
3018         FREE((void*)arg);
3019         return CVec_ChannelDetailsZ_free(arg_conv);
3020 }
3021
3022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3023         LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
3024         FREE((void*)arg);
3025         return CVec_ChannelMonitorZ_free(arg_conv);
3026 }
3027
3028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3029         LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
3030         FREE((void*)arg);
3031         return CVec_EventZ_free(arg_conv);
3032 }
3033
3034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3035         LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
3036         FREE((void*)arg);
3037         return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
3038 }
3039
3040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3041         LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
3042         FREE((void*)arg);
3043         return CVec_MessageSendEventZ_free(arg_conv);
3044 }
3045
3046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3047         LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
3048         FREE((void*)arg);
3049         return CVec_MonitorEventZ_free(arg_conv);
3050 }
3051
3052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3053         LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
3054         FREE((void*)arg);
3055         return CVec_NetAddressZ_free(arg_conv);
3056 }
3057
3058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3059         LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
3060         FREE((void*)arg);
3061         return CVec_NodeAnnouncementZ_free(arg_conv);
3062 }
3063
3064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3065         LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
3066         FREE((void*)arg);
3067         return CVec_PublicKeyZ_free(arg_conv);
3068 }
3069
3070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3071         LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
3072         FREE((void*)arg);
3073         return CVec_RouteHintZ_free(arg_conv);
3074 }
3075
3076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3077         LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
3078         FREE((void*)arg);
3079         return CVec_RouteHopZ_free(arg_conv);
3080 }
3081
3082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3083         LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
3084         FREE((void*)arg);
3085         return CVec_SignatureZ_free(arg_conv);
3086 }
3087
3088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3089         LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
3090         FREE((void*)arg);
3091         return CVec_SpendableOutputDescriptorZ_free(arg_conv);
3092 }
3093
3094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3095         LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
3096         FREE((void*)arg);
3097         return CVec_TransactionZ_free(arg_conv);
3098 }
3099
3100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3101         LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
3102         FREE((void*)arg);
3103         return CVec_TxOutZ_free(arg_conv);
3104 }
3105
3106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3107         LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
3108         FREE((void*)arg);
3109         return CVec_UpdateAddHTLCZ_free(arg_conv);
3110 }
3111
3112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3113         LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
3114         FREE((void*)arg);
3115         return CVec_UpdateFailHTLCZ_free(arg_conv);
3116 }
3117
3118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3119         LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
3120         FREE((void*)arg);
3121         return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
3122 }
3123
3124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
3125         LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
3126         FREE((void*)arg);
3127         return CVec_UpdateFulfillHTLCZ_free(arg_conv);
3128 }
3129
3130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
3131         LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
3132         FREE((void*)arg);
3133         return CVec_u64Z_free(arg_conv);
3134 }
3135
3136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
3137         LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
3138         FREE((void*)arg);
3139         return CVec_u8Z_free(arg_conv);
3140 }
3141
3142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
3143         LDKTransaction _res_conv = *(LDKTransaction*)_res;
3144         FREE((void*)_res);
3145         return Transaction_free(_res_conv);
3146 }
3147
3148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
3149         LDKTxOut _res_conv = *(LDKTxOut*)_res;
3150         FREE((void*)_res);
3151         return TxOut_free(_res_conv);
3152 }
3153
3154 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
3155         LDKTransaction b_conv = *(LDKTransaction*)b;
3156         FREE((void*)b);
3157         LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
3158         *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
3159         return (long)ret;
3160 }
3161
3162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
3163         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3164         *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
3165         return (long)ret;
3166 }
3167
3168 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
3169         LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
3170         *ret = CResult_NoneMonitorUpdateErrorZ_ok();
3171         return (long)ret;
3172 }
3173
3174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
3175         LDKOutPoint a_conv = *(LDKOutPoint*)a;
3176         FREE((void*)a);
3177         a_conv.is_owned = true;
3178         LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
3179         FREE((void*)b);
3180         LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3181         *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
3182         return (long)ret;
3183 }
3184
3185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
3186         LDKThirtyTwoBytes a_conv = *(LDKThirtyTwoBytes*)a;
3187         FREE((void*)a);
3188         LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
3189         FREE((void*)b);
3190         LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
3191         *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_conv, b_conv);
3192         return (long)ret;
3193 }
3194
3195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
3196         LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
3197         *ret = C2Tuple_u64u64Z_new(a, b);
3198         return (long)ret;
3199 }
3200
3201 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
3202         LDKSignature a_conv = *(LDKSignature*)a;
3203         FREE((void*)a);
3204         LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
3205         FREE((void*)b);
3206         LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
3207         *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
3208         return (long)ret;
3209 }
3210
3211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
3212         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
3213         *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
3214         return (long)ret;
3215 }
3216
3217 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
3218         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
3219         *ret = CResult_SignatureNoneZ_err();
3220         return (long)ret;
3221 }
3222
3223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
3224         LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
3225         *ret = CResult_CVec_SignatureZNoneZ_err();
3226         return (long)ret;
3227 }
3228
3229 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
3230         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3231         *ret = CResult_NoneAPIErrorZ_ok();
3232         return (long)ret;
3233 }
3234
3235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
3236         LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
3237         *ret = CResult_NonePaymentSendFailureZ_ok();
3238         return (long)ret;
3239 }
3240
3241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
3242         LDKChannelAnnouncement a_conv = *(LDKChannelAnnouncement*)a;
3243         FREE((void*)a);
3244         a_conv.is_owned = true;
3245         LDKChannelUpdate b_conv = *(LDKChannelUpdate*)b;
3246         FREE((void*)b);
3247         b_conv.is_owned = true;
3248         LDKChannelUpdate c_conv = *(LDKChannelUpdate*)c;
3249         FREE((void*)c);
3250         c_conv.is_owned = true;
3251         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3252         *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
3253         return (long)ret;
3254 }
3255
3256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
3257         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
3258         *ret = CResult_NonePeerHandleErrorZ_ok();
3259         return (long)ret;
3260 }
3261
3262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
3263         LDKHTLCOutputInCommitment a_conv = *(LDKHTLCOutputInCommitment*)a;
3264         FREE((void*)a);
3265         a_conv.is_owned = true;
3266         LDKSignature b_conv = *(LDKSignature*)b;
3267         FREE((void*)b);
3268         LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
3269         *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_conv);
3270         return (long)ret;
3271 }
3272
3273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3274         LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
3275         FREE((void*)this_ptr);
3276         return Event_free(this_ptr_conv);
3277 }
3278
3279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3280         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
3281         FREE((void*)this_ptr);
3282         return MessageSendEvent_free(this_ptr_conv);
3283 }
3284
3285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3286         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
3287         FREE((void*)this_ptr);
3288         return MessageSendEventsProvider_free(this_ptr_conv);
3289 }
3290
3291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3292         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
3293         FREE((void*)this_ptr);
3294         return EventsProvider_free(this_ptr_conv);
3295 }
3296
3297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3298         LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
3299         FREE((void*)this_ptr);
3300         return APIError_free(this_ptr_conv);
3301 }
3302
3303 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
3304         jclass ret = LDKLevel_to_java(_env, Level_max());
3305         return ret;
3306 }
3307
3308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3309         LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
3310         FREE((void*)this_ptr);
3311         return Logger_free(this_ptr_conv);
3312 }
3313
3314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3315         LDKChannelHandshakeConfig this_ptr_conv = *(LDKChannelHandshakeConfig*)this_ptr;
3316         FREE((void*)this_ptr);
3317         this_ptr_conv.is_owned = true;
3318         return ChannelHandshakeConfig_free(this_ptr_conv);
3319 }
3320
3321 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
3322         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
3323         return ChannelHandshakeConfig_get_minimum_depth(this_ptr_conv);
3324 }
3325
3326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
3327         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
3328         return ChannelHandshakeConfig_set_minimum_depth(this_ptr_conv, val);
3329 }
3330
3331 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
3332         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
3333         return ChannelHandshakeConfig_get_our_to_self_delay(this_ptr_conv);
3334 }
3335
3336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3337         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
3338         return ChannelHandshakeConfig_set_our_to_self_delay(this_ptr_conv, val);
3339 }
3340
3341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3342         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
3343         return ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr_conv);
3344 }
3345
3346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3347         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
3348         return ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr_conv, val);
3349 }
3350
3351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv * _env, jclass _b, jint minimum_depth_arg, jshort our_to_self_delay_arg, jlong our_htlc_minimum_msat_arg) {
3352         LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
3353         *ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
3354         DO_ASSERT(ret->is_owned);
3355         ret->is_owned = false;
3356         return (long)ret;
3357 }
3358
3359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
3360         LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
3361         *ret = ChannelHandshakeConfig_default();
3362         DO_ASSERT(ret->is_owned);
3363         ret->is_owned = false;
3364         return (long)ret;
3365 }
3366
3367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3368         LDKChannelHandshakeLimits this_ptr_conv = *(LDKChannelHandshakeLimits*)this_ptr;
3369         FREE((void*)this_ptr);
3370         this_ptr_conv.is_owned = true;
3371         return ChannelHandshakeLimits_free(this_ptr_conv);
3372 }
3373
3374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3375         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3376         return ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr_conv);
3377 }
3378
3379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3380         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3381         return ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr_conv, val);
3382 }
3383
3384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3385         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3386         return ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr_conv);
3387 }
3388
3389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3390         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3391         return ChannelHandshakeLimits_set_max_htlc_minimum_msat(this_ptr_conv, val);
3392 }
3393
3394 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3395         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3396         return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr_conv);
3397 }
3398
3399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3400         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3401         return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this_ptr_conv, val);
3402 }
3403
3404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3405         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3406         return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr_conv);
3407 }
3408
3409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3410         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3411         return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_ptr_conv, val);
3412 }
3413
3414 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
3415         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3416         return ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr_conv);
3417 }
3418
3419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3420         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3421         return ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr_conv, val);
3422 }
3423
3424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3425         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3426         return ChannelHandshakeLimits_get_min_dust_limit_satoshis(this_ptr_conv);
3427 }
3428
3429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3430         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3431         return ChannelHandshakeLimits_set_min_dust_limit_satoshis(this_ptr_conv, val);
3432 }
3433
3434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3435         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3436         return ChannelHandshakeLimits_get_max_dust_limit_satoshis(this_ptr_conv);
3437 }
3438
3439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3440         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3441         return ChannelHandshakeLimits_set_max_dust_limit_satoshis(this_ptr_conv, val);
3442 }
3443
3444 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
3445         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3446         return ChannelHandshakeLimits_get_max_minimum_depth(this_ptr_conv);
3447 }
3448
3449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
3450         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3451         return ChannelHandshakeLimits_set_max_minimum_depth(this_ptr_conv, val);
3452 }
3453
3454 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
3455         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3456         return ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr_conv);
3457 }
3458
3459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
3460         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3461         return ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr_conv, val);
3462 }
3463
3464 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
3465         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3466         return ChannelHandshakeLimits_get_their_to_self_delay(this_ptr_conv);
3467 }
3468
3469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3470         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
3471         return ChannelHandshakeLimits_set_their_to_self_delay(this_ptr_conv, val);
3472 }
3473
3474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv * _env, jclass _b, jlong min_funding_satoshis_arg, jlong max_htlc_minimum_msat_arg, jlong min_max_htlc_value_in_flight_msat_arg, jlong max_channel_reserve_satoshis_arg, jshort min_max_accepted_htlcs_arg, jlong min_dust_limit_satoshis_arg, jlong max_dust_limit_satoshis_arg, jint max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, jshort their_to_self_delay_arg) {
3475         LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
3476         *ret = ChannelHandshakeLimits_new(min_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, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
3477         DO_ASSERT(ret->is_owned);
3478         ret->is_owned = false;
3479         return (long)ret;
3480 }
3481
3482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
3483         LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
3484         *ret = ChannelHandshakeLimits_default();
3485         DO_ASSERT(ret->is_owned);
3486         ret->is_owned = false;
3487         return (long)ret;
3488 }
3489
3490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3491         LDKChannelConfig this_ptr_conv = *(LDKChannelConfig*)this_ptr;
3492         FREE((void*)this_ptr);
3493         this_ptr_conv.is_owned = true;
3494         return ChannelConfig_free(this_ptr_conv);
3495 }
3496
3497 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
3498         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
3499         return ChannelConfig_get_fee_proportional_millionths(this_ptr_conv);
3500 }
3501
3502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
3503         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
3504         return ChannelConfig_set_fee_proportional_millionths(this_ptr_conv, val);
3505 }
3506
3507 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
3508         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
3509         return ChannelConfig_get_announced_channel(this_ptr_conv);
3510 }
3511
3512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
3513         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
3514         return ChannelConfig_set_announced_channel(this_ptr_conv, val);
3515 }
3516
3517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
3518         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
3519         return ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptr_conv);
3520 }
3521
3522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
3523         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
3524         return ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr_conv, val);
3525 }
3526
3527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv * _env, jclass _b, jint fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
3528         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
3529         *ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
3530         DO_ASSERT(ret->is_owned);
3531         ret->is_owned = false;
3532         return (long)ret;
3533 }
3534
3535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
3536         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
3537         *ret = ChannelConfig_default();
3538         DO_ASSERT(ret->is_owned);
3539         ret->is_owned = false;
3540         return (long)ret;
3541 }
3542
3543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
3544         LDKChannelConfig* obj_conv = (LDKChannelConfig*)obj;
3545         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
3546         *ret = ChannelConfig_write(obj_conv);
3547         return (long)ret;
3548 }
3549
3550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
3551         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3552         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
3553         *ret = ChannelConfig_read(ser_conv);
3554         DO_ASSERT(ret->is_owned);
3555         ret->is_owned = false;
3556         return (long)ret;
3557 }
3558
3559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3560         LDKUserConfig this_ptr_conv = *(LDKUserConfig*)this_ptr;
3561         FREE((void*)this_ptr);
3562         this_ptr_conv.is_owned = true;
3563         return UserConfig_free(this_ptr_conv);
3564 }
3565
3566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
3567         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
3568         LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
3569         *ret = UserConfig_get_own_channel_config(this_ptr_conv);
3570         DO_ASSERT(ret->is_owned);
3571         ret->is_owned = false;
3572         return (long)ret;
3573 }
3574
3575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3576         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
3577         LDKChannelHandshakeConfig val_conv = *(LDKChannelHandshakeConfig*)val;
3578         FREE((void*)val);
3579         val_conv.is_owned = true;
3580         return UserConfig_set_own_channel_config(this_ptr_conv, val_conv);
3581 }
3582
3583 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
3584         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
3585         LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
3586         *ret = UserConfig_get_peer_channel_config_limits(this_ptr_conv);
3587         DO_ASSERT(ret->is_owned);
3588         ret->is_owned = false;
3589         return (long)ret;
3590 }
3591
3592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3593         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
3594         LDKChannelHandshakeLimits val_conv = *(LDKChannelHandshakeLimits*)val;
3595         FREE((void*)val);
3596         val_conv.is_owned = true;
3597         return UserConfig_set_peer_channel_config_limits(this_ptr_conv, val_conv);
3598 }
3599
3600 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
3601         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
3602         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
3603         *ret = UserConfig_get_channel_options(this_ptr_conv);
3604         DO_ASSERT(ret->is_owned);
3605         ret->is_owned = false;
3606         return (long)ret;
3607 }
3608
3609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3610         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
3611         LDKChannelConfig val_conv = *(LDKChannelConfig*)val;
3612         FREE((void*)val);
3613         val_conv.is_owned = true;
3614         return UserConfig_set_channel_options(this_ptr_conv, val_conv);
3615 }
3616
3617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv * _env, jclass _b, jlong own_channel_config_arg, jlong peer_channel_config_limits_arg, jlong channel_options_arg) {
3618         LDKChannelHandshakeConfig own_channel_config_arg_conv = *(LDKChannelHandshakeConfig*)own_channel_config_arg;
3619         FREE((void*)own_channel_config_arg);
3620         own_channel_config_arg_conv.is_owned = true;
3621         LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv = *(LDKChannelHandshakeLimits*)peer_channel_config_limits_arg;
3622         FREE((void*)peer_channel_config_limits_arg);
3623         peer_channel_config_limits_arg_conv.is_owned = true;
3624         LDKChannelConfig channel_options_arg_conv = *(LDKChannelConfig*)channel_options_arg;
3625         FREE((void*)channel_options_arg);
3626         channel_options_arg_conv.is_owned = true;
3627         LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
3628         *ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
3629         DO_ASSERT(ret->is_owned);
3630         ret->is_owned = false;
3631         return (long)ret;
3632 }
3633
3634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
3635         LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
3636         *ret = UserConfig_default();
3637         DO_ASSERT(ret->is_owned);
3638         ret->is_owned = false;
3639         return (long)ret;
3640 }
3641
3642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3643         LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
3644         FREE((void*)this_ptr);
3645         return Access_free(this_ptr_conv);
3646 }
3647
3648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3649         LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
3650         FREE((void*)this_ptr);
3651         return Watch_free(this_ptr_conv);
3652 }
3653
3654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3655         LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
3656         FREE((void*)this_ptr);
3657         return Filter_free(this_ptr_conv);
3658 }
3659
3660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3661         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
3662         FREE((void*)this_ptr);
3663         return BroadcasterInterface_free(this_ptr_conv);
3664 }
3665
3666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3667         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
3668         FREE((void*)this_ptr);
3669         return FeeEstimator_free(this_ptr_conv);
3670 }
3671
3672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3673         LDKChainMonitor this_ptr_conv = *(LDKChainMonitor*)this_ptr;
3674         FREE((void*)this_ptr);
3675         this_ptr_conv.is_owned = true;
3676         return ChainMonitor_free(this_ptr_conv);
3677 }
3678
3679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
3680         LDKChainMonitor* this_arg_conv = (LDKChainMonitor*)this_arg;
3681         unsigned char header_arr[80];
3682         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
3683         unsigned char (*header_ref)[80] = &header_arr;
3684         LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
3685         FREE((void*)txdata);
3686         return ChainMonitor_block_connected(this_arg_conv, header_ref, txdata_conv, height);
3687 }
3688
3689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
3690         LDKChainMonitor* this_arg_conv = (LDKChainMonitor*)this_arg;
3691         unsigned char header_arr[80];
3692         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
3693         unsigned char (*header_ref)[80] = &header_arr;
3694         return ChainMonitor_block_disconnected(this_arg_conv, header_ref, disconnected_height);
3695 }
3696
3697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
3698         LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
3699         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
3700         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
3701                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3702                 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
3703         }
3704         LDKLogger logger_conv = *(LDKLogger*)logger;
3705         if (logger_conv.free == LDKLogger_JCalls_free) {
3706                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3707                 LDKLogger_JCalls_clone(logger_conv.this_arg);
3708         }
3709         LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
3710         if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
3711                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3712                 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
3713         }
3714         LDKChainMonitor* ret = MALLOC(sizeof(LDKChainMonitor), "LDKChainMonitor");
3715         *ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
3716         DO_ASSERT(ret->is_owned);
3717         ret->is_owned = false;
3718         return (long)ret;
3719 }
3720
3721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
3722         LDKChainMonitor* this_arg_conv = (LDKChainMonitor*)this_arg;
3723         LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
3724         *ret = ChainMonitor_as_Watch(this_arg_conv);
3725         return (long)ret;
3726 }
3727
3728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
3729         LDKChainMonitor* this_arg_conv = (LDKChainMonitor*)this_arg;
3730         LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3731         *ret = ChainMonitor_as_EventsProvider(this_arg_conv);
3732         return (long)ret;
3733 }
3734
3735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3736         LDKChannelMonitorUpdate this_ptr_conv = *(LDKChannelMonitorUpdate*)this_ptr;
3737         FREE((void*)this_ptr);
3738         this_ptr_conv.is_owned = true;
3739         return ChannelMonitorUpdate_free(this_ptr_conv);
3740 }
3741
3742 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3743         LDKChannelMonitorUpdate* this_ptr_conv = (LDKChannelMonitorUpdate*)this_ptr;
3744         return ChannelMonitorUpdate_get_update_id(this_ptr_conv);
3745 }
3746
3747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3748         LDKChannelMonitorUpdate* this_ptr_conv = (LDKChannelMonitorUpdate*)this_ptr;
3749         return ChannelMonitorUpdate_set_update_id(this_ptr_conv, val);
3750 }
3751
3752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
3753         LDKChannelMonitorUpdate* obj_conv = (LDKChannelMonitorUpdate*)obj;
3754         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
3755         *ret = ChannelMonitorUpdate_write(obj_conv);
3756         return (long)ret;
3757 }
3758
3759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
3760         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3761         LDKChannelMonitorUpdate* ret = MALLOC(sizeof(LDKChannelMonitorUpdate), "LDKChannelMonitorUpdate");
3762         *ret = ChannelMonitorUpdate_read(ser_conv);
3763         DO_ASSERT(ret->is_owned);
3764         ret->is_owned = false;
3765         return (long)ret;
3766 }
3767
3768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3769         LDKMonitorUpdateError this_ptr_conv = *(LDKMonitorUpdateError*)this_ptr;
3770         FREE((void*)this_ptr);
3771         this_ptr_conv.is_owned = true;
3772         return MonitorUpdateError_free(this_ptr_conv);
3773 }
3774
3775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3776         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)this_ptr;
3777         FREE((void*)this_ptr);
3778         this_ptr_conv.is_owned = true;
3779         return MonitorEvent_free(this_ptr_conv);
3780 }
3781
3782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3783         LDKHTLCUpdate this_ptr_conv = *(LDKHTLCUpdate*)this_ptr;
3784         FREE((void*)this_ptr);
3785         this_ptr_conv.is_owned = true;
3786         return HTLCUpdate_free(this_ptr_conv);
3787 }
3788
3789 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
3790         LDKHTLCUpdate* obj_conv = (LDKHTLCUpdate*)obj;
3791         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
3792         *ret = HTLCUpdate_write(obj_conv);
3793         return (long)ret;
3794 }
3795
3796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
3797         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3798         LDKHTLCUpdate* ret = MALLOC(sizeof(LDKHTLCUpdate), "LDKHTLCUpdate");
3799         *ret = HTLCUpdate_read(ser_conv);
3800         DO_ASSERT(ret->is_owned);
3801         ret->is_owned = false;
3802         return (long)ret;
3803 }
3804
3805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3806         LDKChannelMonitor this_ptr_conv = *(LDKChannelMonitor*)this_ptr;
3807         FREE((void*)this_ptr);
3808         this_ptr_conv.is_owned = true;
3809         return ChannelMonitor_free(this_ptr_conv);
3810 }
3811
3812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
3813         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3814         LDKChannelMonitorUpdate updates_conv = *(LDKChannelMonitorUpdate*)updates;
3815         FREE((void*)updates);
3816         updates_conv.is_owned = true;
3817         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
3818         LDKLogger* logger_conv = (LDKLogger*)logger;
3819         LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
3820         *ret = ChannelMonitor_update_monitor(this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
3821         return (long)ret;
3822 }
3823
3824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
3825         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3826         return ChannelMonitor_get_latest_update_id(this_arg_conv);
3827 }
3828
3829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
3830         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3831         LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3832         *ret = ChannelMonitor_get_funding_txo(this_arg_conv);
3833         return (long)ret;
3834 }
3835
3836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
3837         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3838         LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
3839         *ret = ChannelMonitor_get_and_clear_pending_monitor_events(this_arg_conv);
3840         return (long)ret;
3841 }
3842
3843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
3844         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3845         LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3846         *ret = ChannelMonitor_get_and_clear_pending_events(this_arg_conv);
3847         return (long)ret;
3848 }
3849
3850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
3851         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3852         LDKLogger* logger_conv = (LDKLogger*)logger;
3853         LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
3854         *ret = ChannelMonitor_get_latest_holder_commitment_txn(this_arg_conv, logger_conv);
3855         return (long)ret;
3856 }
3857
3858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height, jlong broadcaster, jlong fee_estimator, jlong logger) {
3859         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3860         unsigned char header_arr[80];
3861         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
3862         unsigned char (*header_ref)[80] = &header_arr;
3863         LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
3864         FREE((void*)txdata);
3865         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
3866         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
3867                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3868                 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
3869         }
3870         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
3871         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
3872                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3873                 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
3874         }
3875         LDKLogger logger_conv = *(LDKLogger*)logger;
3876         if (logger_conv.free == LDKLogger_JCalls_free) {
3877                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3878                 LDKLogger_JCalls_clone(logger_conv.this_arg);
3879         }
3880         LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
3881         *ret = ChannelMonitor_block_connected(this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
3882         return (long)ret;
3883 }
3884
3885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint height, jlong broadcaster, jlong fee_estimator, jlong logger) {
3886         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3887         unsigned char header_arr[80];
3888         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
3889         unsigned char (*header_ref)[80] = &header_arr;
3890         LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
3891         if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
3892                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3893                 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
3894         }
3895         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
3896         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
3897                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3898                 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
3899         }
3900         LDKLogger logger_conv = *(LDKLogger*)logger;
3901         if (logger_conv.free == LDKLogger_JCalls_free) {
3902                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
3903                 LDKLogger_JCalls_clone(logger_conv.this_arg);
3904         }
3905         return ChannelMonitor_block_disconnected(this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
3906 }
3907
3908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3909         LDKOutPoint this_ptr_conv = *(LDKOutPoint*)this_ptr;
3910         FREE((void*)this_ptr);
3911         this_ptr_conv.is_owned = true;
3912         return OutPoint_free(this_ptr_conv);
3913 }
3914
3915 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
3916         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
3917         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3918         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(this_ptr_conv));
3919         return ret_arr;
3920 }
3921
3922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3923         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
3924         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3925         FREE((void*)val);
3926         return OutPoint_set_txid(this_ptr_conv, val_conv);
3927 }
3928
3929 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
3930         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
3931         return OutPoint_get_index(this_ptr_conv);
3932 }
3933
3934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3935         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
3936         return OutPoint_set_index(this_ptr_conv, val);
3937 }
3938
3939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jlong txid_arg, jshort index_arg) {
3940         LDKThirtyTwoBytes txid_arg_conv = *(LDKThirtyTwoBytes*)txid_arg;
3941         FREE((void*)txid_arg);
3942         LDKOutPoint* ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint");
3943         *ret = OutPoint_new(txid_arg_conv, index_arg);
3944         DO_ASSERT(ret->is_owned);
3945         ret->is_owned = false;
3946         return (long)ret;
3947 }
3948
3949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
3950         LDKOutPoint* this_arg_conv = (LDKOutPoint*)this_arg;
3951         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
3952         *ret = OutPoint_to_channel_id(this_arg_conv);
3953         return (long)ret;
3954 }
3955
3956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
3957         LDKOutPoint* obj_conv = (LDKOutPoint*)obj;
3958         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
3959         *ret = OutPoint_write(obj_conv);
3960         return (long)ret;
3961 }
3962
3963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
3964         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3965         LDKOutPoint* ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint");
3966         *ret = OutPoint_read(ser_conv);
3967         DO_ASSERT(ret->is_owned);
3968         ret->is_owned = false;
3969         return (long)ret;
3970 }
3971
3972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3973         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
3974         FREE((void*)this_ptr);
3975         return SpendableOutputDescriptor_free(this_ptr_conv);
3976 }
3977
3978 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3979         LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
3980         FREE((void*)this_ptr);
3981         return ChannelKeys_free(this_ptr_conv);
3982 }
3983
3984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3985         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
3986         FREE((void*)this_ptr);
3987         return KeysInterface_free(this_ptr_conv);
3988 }
3989
3990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3991         LDKInMemoryChannelKeys this_ptr_conv = *(LDKInMemoryChannelKeys*)this_ptr;
3992         FREE((void*)this_ptr);
3993         this_ptr_conv.is_owned = true;
3994         return InMemoryChannelKeys_free(this_ptr_conv);
3995 }
3996
3997 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
3998         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
3999         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4000         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(this_ptr_conv));
4001         return ret_arr;
4002 }
4003
4004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4005         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4006         LDKSecretKey val_conv = *(LDKSecretKey*)val;
4007         FREE((void*)val);
4008         return InMemoryChannelKeys_set_funding_key(this_ptr_conv, val_conv);
4009 }
4010
4011 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
4012         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4013         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4014         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(this_ptr_conv));
4015         return ret_arr;
4016 }
4017
4018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4019         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4020         LDKSecretKey val_conv = *(LDKSecretKey*)val;
4021         FREE((void*)val);
4022         return InMemoryChannelKeys_set_revocation_base_key(this_ptr_conv, val_conv);
4023 }
4024
4025 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
4026         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4027         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4028         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(this_ptr_conv));
4029         return ret_arr;
4030 }
4031
4032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4033         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4034         LDKSecretKey val_conv = *(LDKSecretKey*)val;
4035         FREE((void*)val);
4036         return InMemoryChannelKeys_set_payment_key(this_ptr_conv, val_conv);
4037 }
4038
4039 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
4040         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4041         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4042         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(this_ptr_conv));
4043         return ret_arr;
4044 }
4045
4046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4047         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4048         LDKSecretKey val_conv = *(LDKSecretKey*)val;
4049         FREE((void*)val);
4050         return InMemoryChannelKeys_set_delayed_payment_base_key(this_ptr_conv, val_conv);
4051 }
4052
4053 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
4054         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4055         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4056         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(this_ptr_conv));
4057         return ret_arr;
4058 }
4059
4060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4061         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4062         LDKSecretKey val_conv = *(LDKSecretKey*)val;
4063         FREE((void*)val);
4064         return InMemoryChannelKeys_set_htlc_base_key(this_ptr_conv, val_conv);
4065 }
4066
4067 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
4068         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4069         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4070         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(this_ptr_conv));
4071         return ret_arr;
4072 }
4073
4074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4075         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
4076         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4077         FREE((void*)val);
4078         return InMemoryChannelKeys_set_commitment_seed(this_ptr_conv, val_conv);
4079 }
4080
4081 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jlong funding_key, jlong revocation_base_key, jlong payment_key, jlong delayed_payment_base_key, jlong htlc_base_key, jlong commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
4082         LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key;
4083         FREE((void*)funding_key);
4084         LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key;
4085         FREE((void*)revocation_base_key);
4086         LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key;
4087         FREE((void*)payment_key);
4088         LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key;
4089         FREE((void*)delayed_payment_base_key);
4090         LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key;
4091         FREE((void*)htlc_base_key);
4092         LDKThirtyTwoBytes commitment_seed_conv = *(LDKThirtyTwoBytes*)commitment_seed;
4093         FREE((void*)commitment_seed);
4094         LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
4095         FREE((void*)key_derivation_params);
4096         LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
4097         *ret = InMemoryChannelKeys_new(funding_key_conv, revocation_base_key_conv, payment_key_conv, delayed_payment_base_key_conv, htlc_base_key_conv, commitment_seed_conv, channel_value_satoshis, key_derivation_params_conv);
4098         DO_ASSERT(ret->is_owned);
4099         ret->is_owned = false;
4100         return (long)ret;
4101 }
4102
4103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
4104         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
4105         LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
4106         *ret = InMemoryChannelKeys_counterparty_pubkeys(this_arg_conv);
4107         DO_ASSERT(ret->is_owned);
4108         ret->is_owned = false;
4109         return (long)ret;
4110 }
4111
4112 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
4113         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
4114         return InMemoryChannelKeys_counterparty_selected_contest_delay(this_arg_conv);
4115 }
4116
4117 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
4118         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
4119         return InMemoryChannelKeys_holder_selected_contest_delay(this_arg_conv);
4120 }
4121
4122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
4123         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
4124         LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
4125         *ret = InMemoryChannelKeys_as_ChannelKeys(this_arg_conv);
4126         return (long)ret;
4127 }
4128
4129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
4130         LDKInMemoryChannelKeys* obj_conv = (LDKInMemoryChannelKeys*)obj;
4131         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
4132         *ret = InMemoryChannelKeys_write(obj_conv);
4133         return (long)ret;
4134 }
4135
4136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
4137         LDKu8slice ser_conv = *(LDKu8slice*)ser;
4138         LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
4139         *ret = InMemoryChannelKeys_read(ser_conv);
4140         DO_ASSERT(ret->is_owned);
4141         ret->is_owned = false;
4142         return (long)ret;
4143 }
4144
4145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4146         LDKKeysManager this_ptr_conv = *(LDKKeysManager*)this_ptr;
4147         FREE((void*)this_ptr);
4148         this_ptr_conv.is_owned = true;
4149         return KeysManager_free(this_ptr_conv);
4150 }
4151
4152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv * _env, jclass _b, jbyteArray seed, jclass network, jlong starting_time_secs, jint starting_time_nanos) {
4153         unsigned char seed_arr[32];
4154         (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
4155         unsigned char (*seed_ref)[32] = &seed_arr;
4156         LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
4157         LDKKeysManager* ret = MALLOC(sizeof(LDKKeysManager), "LDKKeysManager");
4158         *ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
4159         DO_ASSERT(ret->is_owned);
4160         ret->is_owned = false;
4161         return (long)ret;
4162 }
4163
4164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_value_satoshis, jlong params_1, jlong params_2) {
4165         LDKKeysManager* this_arg_conv = (LDKKeysManager*)this_arg;
4166         LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
4167         *ret = KeysManager_derive_channel_keys(this_arg_conv, channel_value_satoshis, params_1, params_2);
4168         DO_ASSERT(ret->is_owned);
4169         ret->is_owned = false;
4170         return (long)ret;
4171 }
4172
4173 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
4174         LDKKeysManager* this_arg_conv = (LDKKeysManager*)this_arg;
4175         LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4176         *ret = KeysManager_as_KeysInterface(this_arg_conv);
4177         return (long)ret;
4178 }
4179
4180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4181         LDKChannelManager this_ptr_conv = *(LDKChannelManager*)this_ptr;
4182         FREE((void*)this_ptr);
4183         this_ptr_conv.is_owned = true;
4184         return ChannelManager_free(this_ptr_conv);
4185 }
4186
4187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4188         LDKChannelDetails this_ptr_conv = *(LDKChannelDetails*)this_ptr;
4189         FREE((void*)this_ptr);
4190         this_ptr_conv.is_owned = true;
4191         return ChannelDetails_free(this_ptr_conv);
4192 }
4193
4194 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4195         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4196         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4197         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(this_ptr_conv));
4198         return ret_arr;
4199 }
4200
4201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4202         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4203         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4204         FREE((void*)val);
4205         return ChannelDetails_set_channel_id(this_ptr_conv, val_conv);
4206 }
4207
4208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4209         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4210         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4211         *ret = ChannelDetails_get_remote_network_id(this_ptr_conv);
4212         return (long)ret;
4213 }
4214
4215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4216         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4217         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4218         FREE((void*)val);
4219         return ChannelDetails_set_remote_network_id(this_ptr_conv, val_conv);
4220 }
4221
4222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
4223         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4224         LDKInitFeatures* ret = MALLOC(sizeof(LDKInitFeatures), "LDKInitFeatures");
4225         *ret = ChannelDetails_get_counterparty_features(this_ptr_conv);
4226         DO_ASSERT(ret->is_owned);
4227         ret->is_owned = false;
4228         return (long)ret;
4229 }
4230
4231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4232         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4233         LDKInitFeatures val_conv = *(LDKInitFeatures*)val;
4234         FREE((void*)val);
4235         val_conv.is_owned = true;
4236         return ChannelDetails_set_counterparty_features(this_ptr_conv, val_conv);
4237 }
4238
4239 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4240         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4241         return ChannelDetails_get_channel_value_satoshis(this_ptr_conv);
4242 }
4243
4244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4245         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4246         return ChannelDetails_set_channel_value_satoshis(this_ptr_conv, val);
4247 }
4248
4249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4250         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4251         return ChannelDetails_get_user_id(this_ptr_conv);
4252 }
4253
4254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4255         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4256         return ChannelDetails_set_user_id(this_ptr_conv, val);
4257 }
4258
4259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4260         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4261         return ChannelDetails_get_outbound_capacity_msat(this_ptr_conv);
4262 }
4263
4264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4265         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4266         return ChannelDetails_set_outbound_capacity_msat(this_ptr_conv, val);
4267 }
4268
4269 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4270         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4271         return ChannelDetails_get_inbound_capacity_msat(this_ptr_conv);
4272 }
4273
4274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4275         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4276         return ChannelDetails_set_inbound_capacity_msat(this_ptr_conv, val);
4277 }
4278
4279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
4280         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4281         return ChannelDetails_get_is_live(this_ptr_conv);
4282 }
4283
4284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4285         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
4286         return ChannelDetails_set_is_live(this_ptr_conv, val);
4287 }
4288
4289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4290         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)this_ptr;
4291         FREE((void*)this_ptr);
4292         this_ptr_conv.is_owned = true;
4293         return PaymentSendFailure_free(this_ptr_conv);
4294 }
4295
4296 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv * _env, jclass _b, jclass network, jlong fee_est, jlong chain_monitor, jlong tx_broadcaster, jlong logger, jlong keys_manager, jlong config, jlong current_blockchain_height) {
4297         LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
4298         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
4299         if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
4300                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4301                 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
4302         }
4303         LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
4304         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
4305                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4306                 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
4307         }
4308         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
4309         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
4310                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4311                 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
4312         }
4313         LDKLogger logger_conv = *(LDKLogger*)logger;
4314         if (logger_conv.free == LDKLogger_JCalls_free) {
4315                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4316                 LDKLogger_JCalls_clone(logger_conv.this_arg);
4317         }
4318         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
4319         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
4320                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4321                 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
4322         }
4323         LDKUserConfig config_conv = *(LDKUserConfig*)config;
4324         FREE((void*)config);
4325         config_conv.is_owned = true;
4326         LDKChannelManager* ret = MALLOC(sizeof(LDKChannelManager), "LDKChannelManager");
4327         *ret = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
4328         DO_ASSERT(ret->is_owned);
4329         ret->is_owned = false;
4330         return (long)ret;
4331 }
4332
4333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_network_key, jlong channel_value_satoshis, jlong push_msat, jlong user_id, jlong override_config) {
4334         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4335         LDKPublicKey their_network_key_conv = *(LDKPublicKey*)their_network_key;
4336         FREE((void*)their_network_key);
4337         LDKUserConfig override_config_conv = *(LDKUserConfig*)override_config;
4338         FREE((void*)override_config);
4339         override_config_conv.is_owned = true;
4340         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4341         *ret = ChannelManager_create_channel(this_arg_conv, their_network_key_conv, channel_value_satoshis, push_msat, user_id, override_config_conv);
4342         return (long)ret;
4343 }
4344
4345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
4346         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4347         LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
4348         *ret = ChannelManager_list_channels(this_arg_conv);
4349         return (long)ret;
4350 }
4351
4352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
4353         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4354         LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
4355         *ret = ChannelManager_list_usable_channels(this_arg_conv);
4356         return (long)ret;
4357 }
4358
4359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
4360         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4361         unsigned char channel_id_arr[32];
4362         (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
4363         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
4364         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4365         *ret = ChannelManager_close_channel(this_arg_conv, channel_id_ref);
4366         return (long)ret;
4367 }
4368
4369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
4370         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4371         unsigned char channel_id_arr[32];
4372         (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
4373         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
4374         return ChannelManager_force_close_channel(this_arg_conv, channel_id_ref);
4375 }
4376
4377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
4378         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4379         return ChannelManager_force_close_all_channels(this_arg_conv);
4380 }
4381
4382 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv * _env, jclass _b, jlong this_arg, jlong route, jlong payment_hash, jlong payment_secret) {
4383         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4384         LDKRoute* route_conv = (LDKRoute*)route;
4385         LDKThirtyTwoBytes payment_hash_conv = *(LDKThirtyTwoBytes*)payment_hash;
4386         FREE((void*)payment_hash);
4387         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
4388         FREE((void*)payment_secret);
4389         LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4390         *ret = ChannelManager_send_payment(this_arg_conv, route_conv, payment_hash_conv, payment_secret_conv);
4391         return (long)ret;
4392 }
4393
4394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray temporary_channel_id, jlong funding_txo) {
4395         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4396         unsigned char temporary_channel_id_arr[32];
4397         (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
4398         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
4399         LDKOutPoint funding_txo_conv = *(LDKOutPoint*)funding_txo;
4400         FREE((void*)funding_txo);
4401         funding_txo_conv.is_owned = true;
4402         return ChannelManager_funding_transaction_generated(this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
4403 }
4404
4405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong rgb, jlong alias, jlong addresses) {
4406         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4407         LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
4408         FREE((void*)rgb);
4409         LDKThirtyTwoBytes alias_conv = *(LDKThirtyTwoBytes*)alias;
4410         FREE((void*)alias);
4411         LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
4412         FREE((void*)addresses);
4413         return ChannelManager_broadcast_node_announcement(this_arg_conv, rgb_conv, alias_conv, addresses_conv);
4414 }
4415
4416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
4417         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4418         return ChannelManager_process_pending_htlc_forwards(this_arg_conv);
4419 }
4420
4421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
4422         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4423         return ChannelManager_timer_chan_freshness_every_min(this_arg_conv);
4424 }
4425
4426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_hash, jlong payment_secret) {
4427         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4428         unsigned char payment_hash_arr[32];
4429         (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
4430         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
4431         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
4432         FREE((void*)payment_secret);
4433         return ChannelManager_fail_htlc_backwards(this_arg_conv, payment_hash_ref, payment_secret_conv);
4434 }
4435
4436 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv * _env, jclass _b, jlong this_arg, jlong payment_preimage, jlong payment_secret, jlong expected_amount) {
4437         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4438         LDKThirtyTwoBytes payment_preimage_conv = *(LDKThirtyTwoBytes*)payment_preimage;
4439         FREE((void*)payment_preimage);
4440         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
4441         FREE((void*)payment_secret);
4442         return ChannelManager_claim_funds(this_arg_conv, payment_preimage_conv, payment_secret_conv, expected_amount);
4443 }
4444
4445 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
4446         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4447         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4448         *ret = ChannelManager_get_our_node_id(this_arg_conv);
4449         return (long)ret;
4450 }
4451
4452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong highest_applied_update_id) {
4453         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4454         LDKOutPoint* funding_txo_conv = (LDKOutPoint*)funding_txo;
4455         return ChannelManager_channel_monitor_updated(this_arg_conv, funding_txo_conv, highest_applied_update_id);
4456 }
4457
4458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
4459         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4460         LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
4461         *ret = ChannelManager_as_MessageSendEventsProvider(this_arg_conv);
4462         return (long)ret;
4463 }
4464
4465 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
4466         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4467         LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
4468         *ret = ChannelManager_as_EventsProvider(this_arg_conv);
4469         return (long)ret;
4470 }
4471
4472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
4473         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4474         unsigned char header_arr[80];
4475         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
4476         unsigned char (*header_ref)[80] = &header_arr;
4477         LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
4478         FREE((void*)txdata);
4479         return ChannelManager_block_connected(this_arg_conv, header_ref, txdata_conv, height);
4480 }
4481
4482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
4483         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4484         unsigned char header_arr[80];
4485         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
4486         unsigned char (*header_ref)[80] = &header_arr;
4487         return ChannelManager_block_disconnected(this_arg_conv, header_ref);
4488 }
4489
4490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
4491         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
4492         LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4493         *ret = ChannelManager_as_ChannelMessageHandler(this_arg_conv);
4494         return (long)ret;
4495 }
4496
4497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4498         LDKChannelManagerReadArgs this_ptr_conv = *(LDKChannelManagerReadArgs*)this_ptr;
4499         FREE((void*)this_ptr);
4500         this_ptr_conv.is_owned = true;
4501         return ChannelManagerReadArgs_free(this_ptr_conv);
4502 }
4503
4504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
4505         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4506         long ret = (long)ChannelManagerReadArgs_get_keys_manager(this_ptr_conv);
4507         return ret;
4508 }
4509
4510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4511         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4512         LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
4513         if (val_conv.free == LDKKeysInterface_JCalls_free) {
4514                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4515                 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
4516         }
4517         return ChannelManagerReadArgs_set_keys_manager(this_ptr_conv, val_conv);
4518 }
4519
4520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
4521         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4522         long ret = (long)ChannelManagerReadArgs_get_fee_estimator(this_ptr_conv);
4523         return ret;
4524 }
4525
4526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4527         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4528         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
4529         if (val_conv.free == LDKFeeEstimator_JCalls_free) {
4530                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4531                 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
4532         }
4533         return ChannelManagerReadArgs_set_fee_estimator(this_ptr_conv, val_conv);
4534 }
4535
4536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
4537         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4538         long ret = (long)ChannelManagerReadArgs_get_chain_monitor(this_ptr_conv);
4539         return ret;
4540 }
4541
4542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4543         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4544         LDKWatch val_conv = *(LDKWatch*)val;
4545         if (val_conv.free == LDKWatch_JCalls_free) {
4546                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4547                 LDKWatch_JCalls_clone(val_conv.this_arg);
4548         }
4549         return ChannelManagerReadArgs_set_chain_monitor(this_ptr_conv, val_conv);
4550 }
4551
4552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
4553         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4554         long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(this_ptr_conv);
4555         return ret;
4556 }
4557
4558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4559         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4560         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
4561         if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
4562                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4563                 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
4564         }
4565         return ChannelManagerReadArgs_set_tx_broadcaster(this_ptr_conv, val_conv);
4566 }
4567
4568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
4569         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4570         long ret = (long)ChannelManagerReadArgs_get_logger(this_ptr_conv);
4571         return ret;
4572 }
4573
4574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4575         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4576         LDKLogger val_conv = *(LDKLogger*)val;
4577         if (val_conv.free == LDKLogger_JCalls_free) {
4578                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4579                 LDKLogger_JCalls_clone(val_conv.this_arg);
4580         }
4581         return ChannelManagerReadArgs_set_logger(this_ptr_conv, val_conv);
4582 }
4583
4584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
4585         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4586         LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
4587         *ret = ChannelManagerReadArgs_get_default_config(this_ptr_conv);
4588         DO_ASSERT(ret->is_owned);
4589         ret->is_owned = false;
4590         return (long)ret;
4591 }
4592
4593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4594         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
4595         LDKUserConfig val_conv = *(LDKUserConfig*)val;
4596         FREE((void*)val);
4597         val_conv.is_owned = true;
4598         return ChannelManagerReadArgs_set_default_config(this_ptr_conv, val_conv);
4599 }
4600
4601 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv * _env, jclass _b, jlong keys_manager, jlong fee_estimator, jlong chain_monitor, jlong tx_broadcaster, jlong logger, jlong default_config, jlong channel_monitors) {
4602         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
4603         if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
4604                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4605                 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
4606         }
4607         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
4608         if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
4609                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4610                 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
4611         }
4612         LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
4613         if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
4614                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4615                 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
4616         }
4617         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
4618         if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
4619                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4620                 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
4621         }
4622         LDKLogger logger_conv = *(LDKLogger*)logger;
4623         if (logger_conv.free == LDKLogger_JCalls_free) {
4624                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
4625                 LDKLogger_JCalls_clone(logger_conv.this_arg);
4626         }
4627         LDKUserConfig default_config_conv = *(LDKUserConfig*)default_config;
4628         FREE((void*)default_config);
4629         default_config_conv.is_owned = true;
4630         LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
4631         FREE((void*)channel_monitors);
4632         LDKChannelManagerReadArgs* ret = MALLOC(sizeof(LDKChannelManagerReadArgs), "LDKChannelManagerReadArgs");
4633         *ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
4634         DO_ASSERT(ret->is_owned);
4635         ret->is_owned = false;
4636         return (long)ret;
4637 }
4638
4639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4640         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)this_ptr;
4641         FREE((void*)this_ptr);
4642         this_ptr_conv.is_owned = true;
4643         return DecodeError_free(this_ptr_conv);
4644 }
4645
4646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4647         LDKInit this_ptr_conv = *(LDKInit*)this_ptr;
4648         FREE((void*)this_ptr);
4649         this_ptr_conv.is_owned = true;
4650         return Init_free(this_ptr_conv);
4651 }
4652
4653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4654         LDKErrorMessage this_ptr_conv = *(LDKErrorMessage*)this_ptr;
4655         FREE((void*)this_ptr);
4656         this_ptr_conv.is_owned = true;
4657         return ErrorMessage_free(this_ptr_conv);
4658 }
4659
4660 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4661         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
4662         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4663         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(this_ptr_conv));
4664         return ret_arr;
4665 }
4666
4667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4668         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
4669         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4670         FREE((void*)val);
4671         return ErrorMessage_set_channel_id(this_ptr_conv, val_conv);
4672 }
4673
4674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
4675         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
4676         LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
4677         *ret = ErrorMessage_get_data(this_ptr_conv);
4678         return (long)ret;
4679 }
4680
4681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4682         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
4683         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
4684         FREE((void*)val);
4685         return ErrorMessage_set_data(this_ptr_conv, val_conv);
4686 }
4687
4688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong data_arg) {
4689         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
4690         FREE((void*)channel_id_arg);
4691         LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
4692         FREE((void*)data_arg);
4693         LDKErrorMessage* ret = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage");
4694         *ret = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
4695         DO_ASSERT(ret->is_owned);
4696         ret->is_owned = false;
4697         return (long)ret;
4698 }
4699
4700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4701         LDKPing this_ptr_conv = *(LDKPing*)this_ptr;
4702         FREE((void*)this_ptr);
4703         this_ptr_conv.is_owned = true;
4704         return Ping_free(this_ptr_conv);
4705 }
4706
4707 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
4708         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
4709         return Ping_get_ponglen(this_ptr_conv);
4710 }
4711
4712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4713         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
4714         return Ping_set_ponglen(this_ptr_conv, val);
4715 }
4716
4717 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
4718         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
4719         return Ping_get_byteslen(this_ptr_conv);
4720 }
4721
4722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4723         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
4724         return Ping_set_byteslen(this_ptr_conv, val);
4725 }
4726
4727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
4728         LDKPing* ret = MALLOC(sizeof(LDKPing), "LDKPing");
4729         *ret = Ping_new(ponglen_arg, byteslen_arg);
4730         DO_ASSERT(ret->is_owned);
4731         ret->is_owned = false;
4732         return (long)ret;
4733 }
4734
4735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4736         LDKPong this_ptr_conv = *(LDKPong*)this_ptr;
4737         FREE((void*)this_ptr);
4738         this_ptr_conv.is_owned = true;
4739         return Pong_free(this_ptr_conv);
4740 }
4741
4742 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
4743         LDKPong* this_ptr_conv = (LDKPong*)this_ptr;
4744         return Pong_get_byteslen(this_ptr_conv);
4745 }
4746
4747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4748         LDKPong* this_ptr_conv = (LDKPong*)this_ptr;
4749         return Pong_set_byteslen(this_ptr_conv, val);
4750 }
4751
4752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
4753         LDKPong* ret = MALLOC(sizeof(LDKPong), "LDKPong");
4754         *ret = Pong_new(byteslen_arg);
4755         DO_ASSERT(ret->is_owned);
4756         ret->is_owned = false;
4757         return (long)ret;
4758 }
4759
4760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4761         LDKOpenChannel this_ptr_conv = *(LDKOpenChannel*)this_ptr;
4762         FREE((void*)this_ptr);
4763         this_ptr_conv.is_owned = true;
4764         return OpenChannel_free(this_ptr_conv);
4765 }
4766
4767 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
4768         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4769         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4770         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(this_ptr_conv));
4771         return ret_arr;
4772 }
4773
4774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4775         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4776         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4777         FREE((void*)val);
4778         return OpenChannel_set_chain_hash(this_ptr_conv, val_conv);
4779 }
4780
4781 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4782         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4783         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4784         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(this_ptr_conv));
4785         return ret_arr;
4786 }
4787
4788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4789         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4790         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4791         FREE((void*)val);
4792         return OpenChannel_set_temporary_channel_id(this_ptr_conv, val_conv);
4793 }
4794
4795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4796         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4797         return OpenChannel_get_funding_satoshis(this_ptr_conv);
4798 }
4799
4800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4801         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4802         return OpenChannel_set_funding_satoshis(this_ptr_conv, val);
4803 }
4804
4805 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4806         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4807         return OpenChannel_get_push_msat(this_ptr_conv);
4808 }
4809
4810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4811         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4812         return OpenChannel_set_push_msat(this_ptr_conv, val);
4813 }
4814
4815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4816         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4817         return OpenChannel_get_dust_limit_satoshis(this_ptr_conv);
4818 }
4819
4820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4821         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4822         return OpenChannel_set_dust_limit_satoshis(this_ptr_conv, val);
4823 }
4824
4825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4826         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4827         return OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr_conv);
4828 }
4829
4830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4831         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4832         return OpenChannel_set_max_htlc_value_in_flight_msat(this_ptr_conv, val);
4833 }
4834
4835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4836         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4837         return OpenChannel_get_channel_reserve_satoshis(this_ptr_conv);
4838 }
4839
4840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4841         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4842         return OpenChannel_set_channel_reserve_satoshis(this_ptr_conv, val);
4843 }
4844
4845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4846         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4847         return OpenChannel_get_htlc_minimum_msat(this_ptr_conv);
4848 }
4849
4850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4851         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4852         return OpenChannel_set_htlc_minimum_msat(this_ptr_conv, val);
4853 }
4854
4855 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
4856         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4857         return OpenChannel_get_feerate_per_kw(this_ptr_conv);
4858 }
4859
4860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4861         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4862         return OpenChannel_set_feerate_per_kw(this_ptr_conv, val);
4863 }
4864
4865 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4866         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4867         return OpenChannel_get_to_self_delay(this_ptr_conv);
4868 }
4869
4870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4871         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4872         return OpenChannel_set_to_self_delay(this_ptr_conv, val);
4873 }
4874
4875 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4876         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4877         return OpenChannel_get_max_accepted_htlcs(this_ptr_conv);
4878 }
4879
4880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4881         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4882         return OpenChannel_set_max_accepted_htlcs(this_ptr_conv, val);
4883 }
4884
4885 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
4886         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4887         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4888         *ret = OpenChannel_get_funding_pubkey(this_ptr_conv);
4889         return (long)ret;
4890 }
4891
4892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4893         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4894         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4895         FREE((void*)val);
4896         return OpenChannel_set_funding_pubkey(this_ptr_conv, val_conv);
4897 }
4898
4899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
4900         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4901         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4902         *ret = OpenChannel_get_revocation_basepoint(this_ptr_conv);
4903         return (long)ret;
4904 }
4905
4906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4907         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4908         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4909         FREE((void*)val);
4910         return OpenChannel_set_revocation_basepoint(this_ptr_conv, val_conv);
4911 }
4912
4913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
4914         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4915         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4916         *ret = OpenChannel_get_payment_point(this_ptr_conv);
4917         return (long)ret;
4918 }
4919
4920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4921         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4922         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4923         FREE((void*)val);
4924         return OpenChannel_set_payment_point(this_ptr_conv, val_conv);
4925 }
4926
4927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
4928         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4929         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4930         *ret = OpenChannel_get_delayed_payment_basepoint(this_ptr_conv);
4931         return (long)ret;
4932 }
4933
4934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4935         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4936         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4937         FREE((void*)val);
4938         return OpenChannel_set_delayed_payment_basepoint(this_ptr_conv, val_conv);
4939 }
4940
4941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
4942         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4943         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4944         *ret = OpenChannel_get_htlc_basepoint(this_ptr_conv);
4945         return (long)ret;
4946 }
4947
4948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4949         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4950         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4951         FREE((void*)val);
4952         return OpenChannel_set_htlc_basepoint(this_ptr_conv, val_conv);
4953 }
4954
4955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
4956         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4957         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4958         *ret = OpenChannel_get_first_per_commitment_point(this_ptr_conv);
4959         return (long)ret;
4960 }
4961
4962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4963         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4964         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4965         FREE((void*)val);
4966         return OpenChannel_set_first_per_commitment_point(this_ptr_conv, val_conv);
4967 }
4968
4969 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
4970         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4971         return OpenChannel_get_channel_flags(this_ptr_conv);
4972 }
4973
4974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
4975         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
4976         return OpenChannel_set_channel_flags(this_ptr_conv, val);
4977 }
4978
4979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4980         LDKAcceptChannel this_ptr_conv = *(LDKAcceptChannel*)this_ptr;
4981         FREE((void*)this_ptr);
4982         this_ptr_conv.is_owned = true;
4983         return AcceptChannel_free(this_ptr_conv);
4984 }
4985
4986 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4987         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
4988         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4989         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(this_ptr_conv));
4990         return ret_arr;
4991 }
4992
4993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4994         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
4995         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4996         FREE((void*)val);
4997         return AcceptChannel_set_temporary_channel_id(this_ptr_conv, val_conv);
4998 }
4999
5000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5001         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5002         return AcceptChannel_get_dust_limit_satoshis(this_ptr_conv);
5003 }
5004
5005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5006         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5007         return AcceptChannel_set_dust_limit_satoshis(this_ptr_conv, val);
5008 }
5009
5010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5011         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5012         return AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr_conv);
5013 }
5014
5015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5016         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5017         return AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptr_conv, val);
5018 }
5019
5020 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5021         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5022         return AcceptChannel_get_channel_reserve_satoshis(this_ptr_conv);
5023 }
5024
5025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5026         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5027         return AcceptChannel_set_channel_reserve_satoshis(this_ptr_conv, val);
5028 }
5029
5030 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5031         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5032         return AcceptChannel_get_htlc_minimum_msat(this_ptr_conv);
5033 }
5034
5035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5036         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5037         return AcceptChannel_set_htlc_minimum_msat(this_ptr_conv, val);
5038 }
5039
5040 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5041         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5042         return AcceptChannel_get_minimum_depth(this_ptr_conv);
5043 }
5044
5045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5046         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5047         return AcceptChannel_set_minimum_depth(this_ptr_conv, val);
5048 }
5049
5050 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5051         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5052         return AcceptChannel_get_to_self_delay(this_ptr_conv);
5053 }
5054
5055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5056         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5057         return AcceptChannel_set_to_self_delay(this_ptr_conv, val);
5058 }
5059
5060 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5061         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5062         return AcceptChannel_get_max_accepted_htlcs(this_ptr_conv);
5063 }
5064
5065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5066         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5067         return AcceptChannel_set_max_accepted_htlcs(this_ptr_conv, val);
5068 }
5069
5070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5071         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5072         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5073         *ret = AcceptChannel_get_funding_pubkey(this_ptr_conv);
5074         return (long)ret;
5075 }
5076
5077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5078         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5079         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5080         FREE((void*)val);
5081         return AcceptChannel_set_funding_pubkey(this_ptr_conv, val_conv);
5082 }
5083
5084 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
5085         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5086         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5087         *ret = AcceptChannel_get_revocation_basepoint(this_ptr_conv);
5088         return (long)ret;
5089 }
5090
5091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5092         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5093         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5094         FREE((void*)val);
5095         return AcceptChannel_set_revocation_basepoint(this_ptr_conv, val_conv);
5096 }
5097
5098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
5099         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5100         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5101         *ret = AcceptChannel_get_payment_point(this_ptr_conv);
5102         return (long)ret;
5103 }
5104
5105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5106         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5107         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5108         FREE((void*)val);
5109         return AcceptChannel_set_payment_point(this_ptr_conv, val_conv);
5110 }
5111
5112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
5113         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5114         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5115         *ret = AcceptChannel_get_delayed_payment_basepoint(this_ptr_conv);
5116         return (long)ret;
5117 }
5118
5119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5120         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5121         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5122         FREE((void*)val);
5123         return AcceptChannel_set_delayed_payment_basepoint(this_ptr_conv, val_conv);
5124 }
5125
5126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
5127         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5128         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5129         *ret = AcceptChannel_get_htlc_basepoint(this_ptr_conv);
5130         return (long)ret;
5131 }
5132
5133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5134         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5135         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5136         FREE((void*)val);
5137         return AcceptChannel_set_htlc_basepoint(this_ptr_conv, val_conv);
5138 }
5139
5140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
5141         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5142         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5143         *ret = AcceptChannel_get_first_per_commitment_point(this_ptr_conv);
5144         return (long)ret;
5145 }
5146
5147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5148         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
5149         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5150         FREE((void*)val);
5151         return AcceptChannel_set_first_per_commitment_point(this_ptr_conv, val_conv);
5152 }
5153
5154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5155         LDKFundingCreated this_ptr_conv = *(LDKFundingCreated*)this_ptr;
5156         FREE((void*)this_ptr);
5157         this_ptr_conv.is_owned = true;
5158         return FundingCreated_free(this_ptr_conv);
5159 }
5160
5161 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5162         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5163         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5164         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(this_ptr_conv));
5165         return ret_arr;
5166 }
5167
5168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5169         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5170         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5171         FREE((void*)val);
5172         return FundingCreated_set_temporary_channel_id(this_ptr_conv, val_conv);
5173 }
5174
5175 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5176         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5177         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5178         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(this_ptr_conv));
5179         return ret_arr;
5180 }
5181
5182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5183         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5184         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5185         FREE((void*)val);
5186         return FundingCreated_set_funding_txid(this_ptr_conv, val_conv);
5187 }
5188
5189 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5190         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5191         return FundingCreated_get_funding_output_index(this_ptr_conv);
5192 }
5193
5194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5195         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5196         return FundingCreated_set_funding_output_index(this_ptr_conv, val);
5197 }
5198
5199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
5200         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5201         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
5202         *ret = FundingCreated_get_signature(this_ptr_conv);
5203         return (long)ret;
5204 }
5205
5206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5207         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
5208         LDKSignature val_conv = *(LDKSignature*)val;
5209         FREE((void*)val);
5210         return FundingCreated_set_signature(this_ptr_conv, val_conv);
5211 }
5212
5213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jlong temporary_channel_id_arg, jlong funding_txid_arg, jshort funding_output_index_arg, jlong signature_arg) {
5214         LDKThirtyTwoBytes temporary_channel_id_arg_conv = *(LDKThirtyTwoBytes*)temporary_channel_id_arg;
5215         FREE((void*)temporary_channel_id_arg);
5216         LDKThirtyTwoBytes funding_txid_arg_conv = *(LDKThirtyTwoBytes*)funding_txid_arg;
5217         FREE((void*)funding_txid_arg);
5218         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
5219         FREE((void*)signature_arg);
5220         LDKFundingCreated* ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated");
5221         *ret = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_conv, funding_output_index_arg, signature_arg_conv);
5222         DO_ASSERT(ret->is_owned);
5223         ret->is_owned = false;
5224         return (long)ret;
5225 }
5226
5227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5228         LDKFundingSigned this_ptr_conv = *(LDKFundingSigned*)this_ptr;
5229         FREE((void*)this_ptr);
5230         this_ptr_conv.is_owned = true;
5231         return FundingSigned_free(this_ptr_conv);
5232 }
5233
5234 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5235         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
5236         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5237         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(this_ptr_conv));
5238         return ret_arr;
5239 }
5240
5241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5242         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
5243         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5244         FREE((void*)val);
5245         return FundingSigned_set_channel_id(this_ptr_conv, val_conv);
5246 }
5247
5248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
5249         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
5250         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
5251         *ret = FundingSigned_get_signature(this_ptr_conv);
5252         return (long)ret;
5253 }
5254
5255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5256         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
5257         LDKSignature val_conv = *(LDKSignature*)val;
5258         FREE((void*)val);
5259         return FundingSigned_set_signature(this_ptr_conv, val_conv);
5260 }
5261
5262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong signature_arg) {
5263         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5264         FREE((void*)channel_id_arg);
5265         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
5266         FREE((void*)signature_arg);
5267         LDKFundingSigned* ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned");
5268         *ret = FundingSigned_new(channel_id_arg_conv, signature_arg_conv);
5269         DO_ASSERT(ret->is_owned);
5270         ret->is_owned = false;
5271         return (long)ret;
5272 }
5273
5274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5275         LDKFundingLocked this_ptr_conv = *(LDKFundingLocked*)this_ptr;
5276         FREE((void*)this_ptr);
5277         this_ptr_conv.is_owned = true;
5278         return FundingLocked_free(this_ptr_conv);
5279 }
5280
5281 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5282         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
5283         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5284         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(this_ptr_conv));
5285         return ret_arr;
5286 }
5287
5288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5289         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
5290         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5291         FREE((void*)val);
5292         return FundingLocked_set_channel_id(this_ptr_conv, val_conv);
5293 }
5294
5295 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
5296         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
5297         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5298         *ret = FundingLocked_get_next_per_commitment_point(this_ptr_conv);
5299         return (long)ret;
5300 }
5301
5302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5303         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
5304         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5305         FREE((void*)val);
5306         return FundingLocked_set_next_per_commitment_point(this_ptr_conv, val_conv);
5307 }
5308
5309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong next_per_commitment_point_arg) {
5310         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5311         FREE((void*)channel_id_arg);
5312         LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg;
5313         FREE((void*)next_per_commitment_point_arg);
5314         LDKFundingLocked* ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked");
5315         *ret = FundingLocked_new(channel_id_arg_conv, next_per_commitment_point_arg_conv);
5316         DO_ASSERT(ret->is_owned);
5317         ret->is_owned = false;
5318         return (long)ret;
5319 }
5320
5321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5322         LDKShutdown this_ptr_conv = *(LDKShutdown*)this_ptr;
5323         FREE((void*)this_ptr);
5324         this_ptr_conv.is_owned = true;
5325         return Shutdown_free(this_ptr_conv);
5326 }
5327
5328 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5329         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
5330         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5331         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(this_ptr_conv));
5332         return ret_arr;
5333 }
5334
5335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5336         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
5337         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5338         FREE((void*)val);
5339         return Shutdown_set_channel_id(this_ptr_conv, val_conv);
5340 }
5341
5342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5343         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
5344         LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
5345         *ret = Shutdown_get_scriptpubkey(this_ptr_conv);
5346         return (long)ret;
5347 }
5348
5349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5350         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
5351         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
5352         FREE((void*)val);
5353         return Shutdown_set_scriptpubkey(this_ptr_conv, val_conv);
5354 }
5355
5356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong scriptpubkey_arg) {
5357         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5358         FREE((void*)channel_id_arg);
5359         LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
5360         FREE((void*)scriptpubkey_arg);
5361         LDKShutdown* ret = MALLOC(sizeof(LDKShutdown), "LDKShutdown");
5362         *ret = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_conv);
5363         DO_ASSERT(ret->is_owned);
5364         ret->is_owned = false;
5365         return (long)ret;
5366 }
5367
5368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5369         LDKClosingSigned this_ptr_conv = *(LDKClosingSigned*)this_ptr;
5370         FREE((void*)this_ptr);
5371         this_ptr_conv.is_owned = true;
5372         return ClosingSigned_free(this_ptr_conv);
5373 }
5374
5375 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5376         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
5377         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5378         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(this_ptr_conv));
5379         return ret_arr;
5380 }
5381
5382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5383         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
5384         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5385         FREE((void*)val);
5386         return ClosingSigned_set_channel_id(this_ptr_conv, val_conv);
5387 }
5388
5389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5390         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
5391         return ClosingSigned_get_fee_satoshis(this_ptr_conv);
5392 }
5393
5394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5395         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
5396         return ClosingSigned_set_fee_satoshis(this_ptr_conv, val);
5397 }
5398
5399 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
5400         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
5401         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
5402         *ret = ClosingSigned_get_signature(this_ptr_conv);
5403         return (long)ret;
5404 }
5405
5406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5407         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
5408         LDKSignature val_conv = *(LDKSignature*)val;
5409         FREE((void*)val);
5410         return ClosingSigned_set_signature(this_ptr_conv, val_conv);
5411 }
5412
5413 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong fee_satoshis_arg, jlong signature_arg) {
5414         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5415         FREE((void*)channel_id_arg);
5416         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
5417         FREE((void*)signature_arg);
5418         LDKClosingSigned* ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned");
5419         *ret = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_conv);
5420         DO_ASSERT(ret->is_owned);
5421         ret->is_owned = false;
5422         return (long)ret;
5423 }
5424
5425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5426         LDKUpdateAddHTLC this_ptr_conv = *(LDKUpdateAddHTLC*)this_ptr;
5427         FREE((void*)this_ptr);
5428         this_ptr_conv.is_owned = true;
5429         return UpdateAddHTLC_free(this_ptr_conv);
5430 }
5431
5432 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5433         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5434         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5435         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(this_ptr_conv));
5436         return ret_arr;
5437 }
5438
5439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5440         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5441         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5442         FREE((void*)val);
5443         return UpdateAddHTLC_set_channel_id(this_ptr_conv, val_conv);
5444 }
5445
5446 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5447         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5448         return UpdateAddHTLC_get_htlc_id(this_ptr_conv);
5449 }
5450
5451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5452         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5453         return UpdateAddHTLC_set_htlc_id(this_ptr_conv, val);
5454 }
5455
5456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5457         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5458         return UpdateAddHTLC_get_amount_msat(this_ptr_conv);
5459 }
5460
5461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5462         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5463         return UpdateAddHTLC_set_amount_msat(this_ptr_conv, val);
5464 }
5465
5466 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
5467         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5468         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5469         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(this_ptr_conv));
5470         return ret_arr;
5471 }
5472
5473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5474         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5475         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5476         FREE((void*)val);
5477         return UpdateAddHTLC_set_payment_hash(this_ptr_conv, val_conv);
5478 }
5479
5480 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
5481         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5482         return UpdateAddHTLC_get_cltv_expiry(this_ptr_conv);
5483 }
5484
5485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5486         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
5487         return UpdateAddHTLC_set_cltv_expiry(this_ptr_conv, val);
5488 }
5489
5490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5491         LDKUpdateFulfillHTLC this_ptr_conv = *(LDKUpdateFulfillHTLC*)this_ptr;
5492         FREE((void*)this_ptr);
5493         this_ptr_conv.is_owned = true;
5494         return UpdateFulfillHTLC_free(this_ptr_conv);
5495 }
5496
5497 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5498         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
5499         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5500         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(this_ptr_conv));
5501         return ret_arr;
5502 }
5503
5504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5505         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
5506         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5507         FREE((void*)val);
5508         return UpdateFulfillHTLC_set_channel_id(this_ptr_conv, val_conv);
5509 }
5510
5511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5512         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
5513         return UpdateFulfillHTLC_get_htlc_id(this_ptr_conv);
5514 }
5515
5516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5517         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
5518         return UpdateFulfillHTLC_set_htlc_id(this_ptr_conv, val);
5519 }
5520
5521 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
5522         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
5523         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5524         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(this_ptr_conv));
5525         return ret_arr;
5526 }
5527
5528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5529         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
5530         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5531         FREE((void*)val);
5532         return UpdateFulfillHTLC_set_payment_preimage(this_ptr_conv, val_conv);
5533 }
5534
5535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong htlc_id_arg, jlong payment_preimage_arg) {
5536         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5537         FREE((void*)channel_id_arg);
5538         LDKThirtyTwoBytes payment_preimage_arg_conv = *(LDKThirtyTwoBytes*)payment_preimage_arg;
5539         FREE((void*)payment_preimage_arg);
5540         LDKUpdateFulfillHTLC* ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC");
5541         *ret = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_conv);
5542         DO_ASSERT(ret->is_owned);
5543         ret->is_owned = false;
5544         return (long)ret;
5545 }
5546
5547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5548         LDKUpdateFailHTLC this_ptr_conv = *(LDKUpdateFailHTLC*)this_ptr;
5549         FREE((void*)this_ptr);
5550         this_ptr_conv.is_owned = true;
5551         return UpdateFailHTLC_free(this_ptr_conv);
5552 }
5553
5554 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5555         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
5556         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5557         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(this_ptr_conv));
5558         return ret_arr;
5559 }
5560
5561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5562         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
5563         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5564         FREE((void*)val);
5565         return UpdateFailHTLC_set_channel_id(this_ptr_conv, val_conv);
5566 }
5567
5568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5569         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
5570         return UpdateFailHTLC_get_htlc_id(this_ptr_conv);
5571 }
5572
5573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5574         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
5575         return UpdateFailHTLC_set_htlc_id(this_ptr_conv, val);
5576 }
5577
5578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5579         LDKUpdateFailMalformedHTLC this_ptr_conv = *(LDKUpdateFailMalformedHTLC*)this_ptr;
5580         FREE((void*)this_ptr);
5581         this_ptr_conv.is_owned = true;
5582         return UpdateFailMalformedHTLC_free(this_ptr_conv);
5583 }
5584
5585 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5586         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
5587         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5588         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(this_ptr_conv));
5589         return ret_arr;
5590 }
5591
5592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5593         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
5594         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5595         FREE((void*)val);
5596         return UpdateFailMalformedHTLC_set_channel_id(this_ptr_conv, val_conv);
5597 }
5598
5599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5600         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
5601         return UpdateFailMalformedHTLC_get_htlc_id(this_ptr_conv);
5602 }
5603
5604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5605         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
5606         return UpdateFailMalformedHTLC_set_htlc_id(this_ptr_conv, val);
5607 }
5608
5609 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
5610         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
5611         return UpdateFailMalformedHTLC_get_failure_code(this_ptr_conv);
5612 }
5613
5614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5615         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
5616         return UpdateFailMalformedHTLC_set_failure_code(this_ptr_conv, val);
5617 }
5618
5619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5620         LDKCommitmentSigned this_ptr_conv = *(LDKCommitmentSigned*)this_ptr;
5621         FREE((void*)this_ptr);
5622         this_ptr_conv.is_owned = true;
5623         return CommitmentSigned_free(this_ptr_conv);
5624 }
5625
5626 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5627         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
5628         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5629         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(this_ptr_conv));
5630         return ret_arr;
5631 }
5632
5633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5634         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
5635         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5636         FREE((void*)val);
5637         return CommitmentSigned_set_channel_id(this_ptr_conv, val_conv);
5638 }
5639
5640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
5641         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
5642         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
5643         *ret = CommitmentSigned_get_signature(this_ptr_conv);
5644         return (long)ret;
5645 }
5646
5647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5648         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
5649         LDKSignature val_conv = *(LDKSignature*)val;
5650         FREE((void*)val);
5651         return CommitmentSigned_set_signature(this_ptr_conv, val_conv);
5652 }
5653
5654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5655         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
5656         LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
5657         FREE((void*)val);
5658         return CommitmentSigned_set_htlc_signatures(this_ptr_conv, val_conv);
5659 }
5660
5661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong signature_arg, jlong htlc_signatures_arg) {
5662         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5663         FREE((void*)channel_id_arg);
5664         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
5665         FREE((void*)signature_arg);
5666         LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
5667         FREE((void*)htlc_signatures_arg);
5668         LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
5669         *ret = CommitmentSigned_new(channel_id_arg_conv, signature_arg_conv, htlc_signatures_arg_conv);
5670         DO_ASSERT(ret->is_owned);
5671         ret->is_owned = false;
5672         return (long)ret;
5673 }
5674
5675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5676         LDKRevokeAndACK this_ptr_conv = *(LDKRevokeAndACK*)this_ptr;
5677         FREE((void*)this_ptr);
5678         this_ptr_conv.is_owned = true;
5679         return RevokeAndACK_free(this_ptr_conv);
5680 }
5681
5682 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5683         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
5684         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5685         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(this_ptr_conv));
5686         return ret_arr;
5687 }
5688
5689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5690         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
5691         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5692         FREE((void*)val);
5693         return RevokeAndACK_set_channel_id(this_ptr_conv, val_conv);
5694 }
5695
5696 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
5697         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
5698         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5699         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(this_ptr_conv));
5700         return ret_arr;
5701 }
5702
5703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5704         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
5705         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5706         FREE((void*)val);
5707         return RevokeAndACK_set_per_commitment_secret(this_ptr_conv, val_conv);
5708 }
5709
5710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
5711         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
5712         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5713         *ret = RevokeAndACK_get_next_per_commitment_point(this_ptr_conv);
5714         return (long)ret;
5715 }
5716
5717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5718         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
5719         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5720         FREE((void*)val);
5721         return RevokeAndACK_set_next_per_commitment_point(this_ptr_conv, val_conv);
5722 }
5723
5724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong per_commitment_secret_arg, jlong next_per_commitment_point_arg) {
5725         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5726         FREE((void*)channel_id_arg);
5727         LDKThirtyTwoBytes per_commitment_secret_arg_conv = *(LDKThirtyTwoBytes*)per_commitment_secret_arg;
5728         FREE((void*)per_commitment_secret_arg);
5729         LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg;
5730         FREE((void*)next_per_commitment_point_arg);
5731         LDKRevokeAndACK* ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK");
5732         *ret = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_conv, next_per_commitment_point_arg_conv);
5733         DO_ASSERT(ret->is_owned);
5734         ret->is_owned = false;
5735         return (long)ret;
5736 }
5737
5738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5739         LDKUpdateFee this_ptr_conv = *(LDKUpdateFee*)this_ptr;
5740         FREE((void*)this_ptr);
5741         this_ptr_conv.is_owned = true;
5742         return UpdateFee_free(this_ptr_conv);
5743 }
5744
5745 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5746         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
5747         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5748         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(this_ptr_conv));
5749         return ret_arr;
5750 }
5751
5752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5753         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
5754         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5755         FREE((void*)val);
5756         return UpdateFee_set_channel_id(this_ptr_conv, val_conv);
5757 }
5758
5759 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
5760         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
5761         return UpdateFee_get_feerate_per_kw(this_ptr_conv);
5762 }
5763
5764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5765         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
5766         return UpdateFee_set_feerate_per_kw(this_ptr_conv, val);
5767 }
5768
5769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jint feerate_per_kw_arg) {
5770         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5771         FREE((void*)channel_id_arg);
5772         LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
5773         *ret = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
5774         DO_ASSERT(ret->is_owned);
5775         ret->is_owned = false;
5776         return (long)ret;
5777 }
5778
5779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5780         LDKDataLossProtect this_ptr_conv = *(LDKDataLossProtect*)this_ptr;
5781         FREE((void*)this_ptr);
5782         this_ptr_conv.is_owned = true;
5783         return DataLossProtect_free(this_ptr_conv);
5784 }
5785
5786 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
5787         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
5788         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5789         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(this_ptr_conv));
5790         return ret_arr;
5791 }
5792
5793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5794         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
5795         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5796         FREE((void*)val);
5797         return DataLossProtect_set_your_last_per_commitment_secret(this_ptr_conv, val_conv);
5798 }
5799
5800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
5801         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
5802         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5803         *ret = DataLossProtect_get_my_current_per_commitment_point(this_ptr_conv);
5804         return (long)ret;
5805 }
5806
5807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5808         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
5809         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5810         FREE((void*)val);
5811         return DataLossProtect_set_my_current_per_commitment_point(this_ptr_conv, val_conv);
5812 }
5813
5814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jlong your_last_per_commitment_secret_arg, jlong my_current_per_commitment_point_arg) {
5815         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_conv = *(LDKThirtyTwoBytes*)your_last_per_commitment_secret_arg;
5816         FREE((void*)your_last_per_commitment_secret_arg);
5817         LDKPublicKey my_current_per_commitment_point_arg_conv = *(LDKPublicKey*)my_current_per_commitment_point_arg;
5818         FREE((void*)my_current_per_commitment_point_arg);
5819         LDKDataLossProtect* ret = MALLOC(sizeof(LDKDataLossProtect), "LDKDataLossProtect");
5820         *ret = DataLossProtect_new(your_last_per_commitment_secret_arg_conv, my_current_per_commitment_point_arg_conv);
5821         DO_ASSERT(ret->is_owned);
5822         ret->is_owned = false;
5823         return (long)ret;
5824 }
5825
5826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5827         LDKChannelReestablish this_ptr_conv = *(LDKChannelReestablish*)this_ptr;
5828         FREE((void*)this_ptr);
5829         this_ptr_conv.is_owned = true;
5830         return ChannelReestablish_free(this_ptr_conv);
5831 }
5832
5833 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5834         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
5835         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5836         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(this_ptr_conv));
5837         return ret_arr;
5838 }
5839
5840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5841         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
5842         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5843         FREE((void*)val);
5844         return ChannelReestablish_set_channel_id(this_ptr_conv, val_conv);
5845 }
5846
5847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
5848         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
5849         return ChannelReestablish_get_next_local_commitment_number(this_ptr_conv);
5850 }
5851
5852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5853         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
5854         return ChannelReestablish_set_next_local_commitment_number(this_ptr_conv, val);
5855 }
5856
5857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
5858         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
5859         return ChannelReestablish_get_next_remote_commitment_number(this_ptr_conv);
5860 }
5861
5862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5863         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
5864         return ChannelReestablish_set_next_remote_commitment_number(this_ptr_conv, val);
5865 }
5866
5867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5868         LDKAnnouncementSignatures this_ptr_conv = *(LDKAnnouncementSignatures*)this_ptr;
5869         FREE((void*)this_ptr);
5870         this_ptr_conv.is_owned = true;
5871         return AnnouncementSignatures_free(this_ptr_conv);
5872 }
5873
5874 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5875         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5876         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5877         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(this_ptr_conv));
5878         return ret_arr;
5879 }
5880
5881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5882         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5883         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
5884         FREE((void*)val);
5885         return AnnouncementSignatures_set_channel_id(this_ptr_conv, val_conv);
5886 }
5887
5888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5889         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5890         return AnnouncementSignatures_get_short_channel_id(this_ptr_conv);
5891 }
5892
5893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5894         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5895         return AnnouncementSignatures_set_short_channel_id(this_ptr_conv, val);
5896 }
5897
5898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
5899         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5900         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
5901         *ret = AnnouncementSignatures_get_node_signature(this_ptr_conv);
5902         return (long)ret;
5903 }
5904
5905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5906         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5907         LDKSignature val_conv = *(LDKSignature*)val;
5908         FREE((void*)val);
5909         return AnnouncementSignatures_set_node_signature(this_ptr_conv, val_conv);
5910 }
5911
5912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
5913         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5914         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
5915         *ret = AnnouncementSignatures_get_bitcoin_signature(this_ptr_conv);
5916         return (long)ret;
5917 }
5918
5919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5920         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
5921         LDKSignature val_conv = *(LDKSignature*)val;
5922         FREE((void*)val);
5923         return AnnouncementSignatures_set_bitcoin_signature(this_ptr_conv, val_conv);
5924 }
5925
5926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong short_channel_id_arg, jlong node_signature_arg, jlong bitcoin_signature_arg) {
5927         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
5928         FREE((void*)channel_id_arg);
5929         LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg;
5930         FREE((void*)node_signature_arg);
5931         LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg;
5932         FREE((void*)bitcoin_signature_arg);
5933         LDKAnnouncementSignatures* ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures");
5934         *ret = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
5935         DO_ASSERT(ret->is_owned);
5936         ret->is_owned = false;
5937         return (long)ret;
5938 }
5939
5940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5941         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
5942         FREE((void*)this_ptr);
5943         return NetAddress_free(this_ptr_conv);
5944 }
5945
5946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5947         LDKUnsignedNodeAnnouncement this_ptr_conv = *(LDKUnsignedNodeAnnouncement*)this_ptr;
5948         FREE((void*)this_ptr);
5949         this_ptr_conv.is_owned = true;
5950         return UnsignedNodeAnnouncement_free(this_ptr_conv);
5951 }
5952
5953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5954         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
5955         LDKNodeFeatures* ret = MALLOC(sizeof(LDKNodeFeatures), "LDKNodeFeatures");
5956         *ret = UnsignedNodeAnnouncement_get_features(this_ptr_conv);
5957         DO_ASSERT(ret->is_owned);
5958         ret->is_owned = false;
5959         return (long)ret;
5960 }
5961
5962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5963         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
5964         LDKNodeFeatures val_conv = *(LDKNodeFeatures*)val;
5965         FREE((void*)val);
5966         val_conv.is_owned = true;
5967         return UnsignedNodeAnnouncement_set_features(this_ptr_conv, val_conv);
5968 }
5969
5970 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
5971         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
5972         return UnsignedNodeAnnouncement_get_timestamp(this_ptr_conv);
5973 }
5974
5975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5976         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
5977         return UnsignedNodeAnnouncement_set_timestamp(this_ptr_conv, val);
5978 }
5979
5980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5981         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
5982         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5983         *ret = UnsignedNodeAnnouncement_get_node_id(this_ptr_conv);
5984         return (long)ret;
5985 }
5986
5987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5988         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
5989         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5990         FREE((void*)val);
5991         return UnsignedNodeAnnouncement_set_node_id(this_ptr_conv, val_conv);
5992 }
5993
5994 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
5995         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
5996         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
5997         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(this_ptr_conv));
5998         return ret_arr;
5999 }
6000
6001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6002         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
6003         LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
6004         FREE((void*)val);
6005         return UnsignedNodeAnnouncement_set_rgb(this_ptr_conv, val_conv);
6006 }
6007
6008 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
6009         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
6010         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6011         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(this_ptr_conv));
6012         return ret_arr;
6013 }
6014
6015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6016         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
6017         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6018         FREE((void*)val);
6019         return UnsignedNodeAnnouncement_set_alias(this_ptr_conv, val_conv);
6020 }
6021
6022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6023         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
6024         LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
6025         FREE((void*)val);
6026         return UnsignedNodeAnnouncement_set_addresses(this_ptr_conv, val_conv);
6027 }
6028
6029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6030         LDKNodeAnnouncement this_ptr_conv = *(LDKNodeAnnouncement*)this_ptr;
6031         FREE((void*)this_ptr);
6032         this_ptr_conv.is_owned = true;
6033         return NodeAnnouncement_free(this_ptr_conv);
6034 }
6035
6036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6037         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
6038         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6039         *ret = NodeAnnouncement_get_signature(this_ptr_conv);
6040         return (long)ret;
6041 }
6042
6043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6044         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
6045         LDKSignature val_conv = *(LDKSignature*)val;
6046         FREE((void*)val);
6047         return NodeAnnouncement_set_signature(this_ptr_conv, val_conv);
6048 }
6049
6050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
6051         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
6052         LDKUnsignedNodeAnnouncement* ret = MALLOC(sizeof(LDKUnsignedNodeAnnouncement), "LDKUnsignedNodeAnnouncement");
6053         *ret = NodeAnnouncement_get_contents(this_ptr_conv);
6054         DO_ASSERT(ret->is_owned);
6055         ret->is_owned = false;
6056         return (long)ret;
6057 }
6058
6059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6060         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
6061         LDKUnsignedNodeAnnouncement val_conv = *(LDKUnsignedNodeAnnouncement*)val;
6062         FREE((void*)val);
6063         val_conv.is_owned = true;
6064         return NodeAnnouncement_set_contents(this_ptr_conv, val_conv);
6065 }
6066
6067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
6068         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6069         FREE((void*)signature_arg);
6070         LDKUnsignedNodeAnnouncement contents_arg_conv = *(LDKUnsignedNodeAnnouncement*)contents_arg;
6071         FREE((void*)contents_arg);
6072         contents_arg_conv.is_owned = true;
6073         LDKNodeAnnouncement* ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
6074         *ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
6075         DO_ASSERT(ret->is_owned);
6076         ret->is_owned = false;
6077         return (long)ret;
6078 }
6079
6080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6081         LDKUnsignedChannelAnnouncement this_ptr_conv = *(LDKUnsignedChannelAnnouncement*)this_ptr;
6082         FREE((void*)this_ptr);
6083         this_ptr_conv.is_owned = true;
6084         return UnsignedChannelAnnouncement_free(this_ptr_conv);
6085 }
6086
6087 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6088         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6089         LDKChannelFeatures* ret = MALLOC(sizeof(LDKChannelFeatures), "LDKChannelFeatures");
6090         *ret = UnsignedChannelAnnouncement_get_features(this_ptr_conv);
6091         DO_ASSERT(ret->is_owned);
6092         ret->is_owned = false;
6093         return (long)ret;
6094 }
6095
6096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6097         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6098         LDKChannelFeatures val_conv = *(LDKChannelFeatures*)val;
6099         FREE((void*)val);
6100         val_conv.is_owned = true;
6101         return UnsignedChannelAnnouncement_set_features(this_ptr_conv, val_conv);
6102 }
6103
6104 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6105         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6106         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6107         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(this_ptr_conv));
6108         return ret_arr;
6109 }
6110
6111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6112         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6113         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6114         FREE((void*)val);
6115         return UnsignedChannelAnnouncement_set_chain_hash(this_ptr_conv, val_conv);
6116 }
6117
6118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6119         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6120         return UnsignedChannelAnnouncement_get_short_channel_id(this_ptr_conv);
6121 }
6122
6123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6124         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6125         return UnsignedChannelAnnouncement_set_short_channel_id(this_ptr_conv, val);
6126 }
6127
6128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
6129         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6130         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6131         *ret = UnsignedChannelAnnouncement_get_node_id_1(this_ptr_conv);
6132         return (long)ret;
6133 }
6134
6135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6136         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6137         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6138         FREE((void*)val);
6139         return UnsignedChannelAnnouncement_set_node_id_1(this_ptr_conv, val_conv);
6140 }
6141
6142 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
6143         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6144         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6145         *ret = UnsignedChannelAnnouncement_get_node_id_2(this_ptr_conv);
6146         return (long)ret;
6147 }
6148
6149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6150         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6151         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6152         FREE((void*)val);
6153         return UnsignedChannelAnnouncement_set_node_id_2(this_ptr_conv, val_conv);
6154 }
6155
6156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
6157         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6158         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6159         *ret = UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr_conv);
6160         return (long)ret;
6161 }
6162
6163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6164         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6165         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6166         FREE((void*)val);
6167         return UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr_conv, val_conv);
6168 }
6169
6170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
6171         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6172         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6173         *ret = UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr_conv);
6174         return (long)ret;
6175 }
6176
6177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6178         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
6179         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6180         FREE((void*)val);
6181         return UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr_conv, val_conv);
6182 }
6183
6184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6185         LDKChannelAnnouncement this_ptr_conv = *(LDKChannelAnnouncement*)this_ptr;
6186         FREE((void*)this_ptr);
6187         this_ptr_conv.is_owned = true;
6188         return ChannelAnnouncement_free(this_ptr_conv);
6189 }
6190
6191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
6192         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6193         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6194         *ret = ChannelAnnouncement_get_node_signature_1(this_ptr_conv);
6195         return (long)ret;
6196 }
6197
6198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6199         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6200         LDKSignature val_conv = *(LDKSignature*)val;
6201         FREE((void*)val);
6202         return ChannelAnnouncement_set_node_signature_1(this_ptr_conv, val_conv);
6203 }
6204
6205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
6206         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6207         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6208         *ret = ChannelAnnouncement_get_node_signature_2(this_ptr_conv);
6209         return (long)ret;
6210 }
6211
6212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6213         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6214         LDKSignature val_conv = *(LDKSignature*)val;
6215         FREE((void*)val);
6216         return ChannelAnnouncement_set_node_signature_2(this_ptr_conv, val_conv);
6217 }
6218
6219 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
6220         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6221         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6222         *ret = ChannelAnnouncement_get_bitcoin_signature_1(this_ptr_conv);
6223         return (long)ret;
6224 }
6225
6226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6227         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6228         LDKSignature val_conv = *(LDKSignature*)val;
6229         FREE((void*)val);
6230         return ChannelAnnouncement_set_bitcoin_signature_1(this_ptr_conv, val_conv);
6231 }
6232
6233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
6234         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6235         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6236         *ret = ChannelAnnouncement_get_bitcoin_signature_2(this_ptr_conv);
6237         return (long)ret;
6238 }
6239
6240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6241         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6242         LDKSignature val_conv = *(LDKSignature*)val;
6243         FREE((void*)val);
6244         return ChannelAnnouncement_set_bitcoin_signature_2(this_ptr_conv, val_conv);
6245 }
6246
6247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
6248         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6249         LDKUnsignedChannelAnnouncement* ret = MALLOC(sizeof(LDKUnsignedChannelAnnouncement), "LDKUnsignedChannelAnnouncement");
6250         *ret = ChannelAnnouncement_get_contents(this_ptr_conv);
6251         DO_ASSERT(ret->is_owned);
6252         ret->is_owned = false;
6253         return (long)ret;
6254 }
6255
6256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6257         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
6258         LDKUnsignedChannelAnnouncement val_conv = *(LDKUnsignedChannelAnnouncement*)val;
6259         FREE((void*)val);
6260         val_conv.is_owned = true;
6261         return ChannelAnnouncement_set_contents(this_ptr_conv, val_conv);
6262 }
6263
6264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv * _env, jclass _b, jlong node_signature_1_arg, jlong node_signature_2_arg, jlong bitcoin_signature_1_arg, jlong bitcoin_signature_2_arg, jlong contents_arg) {
6265         LDKSignature node_signature_1_arg_conv = *(LDKSignature*)node_signature_1_arg;
6266         FREE((void*)node_signature_1_arg);
6267         LDKSignature node_signature_2_arg_conv = *(LDKSignature*)node_signature_2_arg;
6268         FREE((void*)node_signature_2_arg);
6269         LDKSignature bitcoin_signature_1_arg_conv = *(LDKSignature*)bitcoin_signature_1_arg;
6270         FREE((void*)bitcoin_signature_1_arg);
6271         LDKSignature bitcoin_signature_2_arg_conv = *(LDKSignature*)bitcoin_signature_2_arg;
6272         FREE((void*)bitcoin_signature_2_arg);
6273         LDKUnsignedChannelAnnouncement contents_arg_conv = *(LDKUnsignedChannelAnnouncement*)contents_arg;
6274         FREE((void*)contents_arg);
6275         contents_arg_conv.is_owned = true;
6276         LDKChannelAnnouncement* ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
6277         *ret = ChannelAnnouncement_new(node_signature_1_arg_conv, node_signature_2_arg_conv, bitcoin_signature_1_arg_conv, bitcoin_signature_2_arg_conv, contents_arg_conv);
6278         DO_ASSERT(ret->is_owned);
6279         ret->is_owned = false;
6280         return (long)ret;
6281 }
6282
6283 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6284         LDKUnsignedChannelUpdate this_ptr_conv = *(LDKUnsignedChannelUpdate*)this_ptr;
6285         FREE((void*)this_ptr);
6286         this_ptr_conv.is_owned = true;
6287         return UnsignedChannelUpdate_free(this_ptr_conv);
6288 }
6289
6290 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6291         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6292         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6293         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(this_ptr_conv));
6294         return ret_arr;
6295 }
6296
6297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6298         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6299         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6300         FREE((void*)val);
6301         return UnsignedChannelUpdate_set_chain_hash(this_ptr_conv, val_conv);
6302 }
6303
6304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6305         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6306         return UnsignedChannelUpdate_get_short_channel_id(this_ptr_conv);
6307 }
6308
6309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6310         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6311         return UnsignedChannelUpdate_set_short_channel_id(this_ptr_conv, val);
6312 }
6313
6314 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
6315         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6316         return UnsignedChannelUpdate_get_timestamp(this_ptr_conv);
6317 }
6318
6319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6320         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6321         return UnsignedChannelUpdate_set_timestamp(this_ptr_conv, val);
6322 }
6323
6324 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6325         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6326         return UnsignedChannelUpdate_get_flags(this_ptr_conv);
6327 }
6328
6329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6330         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6331         return UnsignedChannelUpdate_set_flags(this_ptr_conv, val);
6332 }
6333
6334 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
6335         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6336         return UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr_conv);
6337 }
6338
6339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6340         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6341         return UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr_conv, val);
6342 }
6343
6344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6345         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6346         return UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr_conv);
6347 }
6348
6349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6350         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6351         return UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr_conv, val);
6352 }
6353
6354 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6355         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6356         return UnsignedChannelUpdate_get_fee_base_msat(this_ptr_conv);
6357 }
6358
6359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6360         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6361         return UnsignedChannelUpdate_set_fee_base_msat(this_ptr_conv, val);
6362 }
6363
6364 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
6365         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6366         return UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr_conv);
6367 }
6368
6369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6370         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
6371         return UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr_conv, val);
6372 }
6373
6374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6375         LDKChannelUpdate this_ptr_conv = *(LDKChannelUpdate*)this_ptr;
6376         FREE((void*)this_ptr);
6377         this_ptr_conv.is_owned = true;
6378         return ChannelUpdate_free(this_ptr_conv);
6379 }
6380
6381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
6382         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
6383         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6384         *ret = ChannelUpdate_get_signature(this_ptr_conv);
6385         return (long)ret;
6386 }
6387
6388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6389         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
6390         LDKSignature val_conv = *(LDKSignature*)val;
6391         FREE((void*)val);
6392         return ChannelUpdate_set_signature(this_ptr_conv, val_conv);
6393 }
6394
6395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
6396         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
6397         LDKUnsignedChannelUpdate* ret = MALLOC(sizeof(LDKUnsignedChannelUpdate), "LDKUnsignedChannelUpdate");
6398         *ret = ChannelUpdate_get_contents(this_ptr_conv);
6399         DO_ASSERT(ret->is_owned);
6400         ret->is_owned = false;
6401         return (long)ret;
6402 }
6403
6404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6405         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
6406         LDKUnsignedChannelUpdate val_conv = *(LDKUnsignedChannelUpdate*)val;
6407         FREE((void*)val);
6408         val_conv.is_owned = true;
6409         return ChannelUpdate_set_contents(this_ptr_conv, val_conv);
6410 }
6411
6412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
6413         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
6414         FREE((void*)signature_arg);
6415         LDKUnsignedChannelUpdate contents_arg_conv = *(LDKUnsignedChannelUpdate*)contents_arg;
6416         FREE((void*)contents_arg);
6417         contents_arg_conv.is_owned = true;
6418         LDKChannelUpdate* ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
6419         *ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
6420         DO_ASSERT(ret->is_owned);
6421         ret->is_owned = false;
6422         return (long)ret;
6423 }
6424
6425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6426         LDKQueryChannelRange this_ptr_conv = *(LDKQueryChannelRange*)this_ptr;
6427         FREE((void*)this_ptr);
6428         this_ptr_conv.is_owned = true;
6429         return QueryChannelRange_free(this_ptr_conv);
6430 }
6431
6432 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6433         LDKQueryChannelRange* this_ptr_conv = (LDKQueryChannelRange*)this_ptr;
6434         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6435         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(this_ptr_conv));
6436         return ret_arr;
6437 }
6438
6439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6440         LDKQueryChannelRange* this_ptr_conv = (LDKQueryChannelRange*)this_ptr;
6441         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6442         FREE((void*)val);
6443         return QueryChannelRange_set_chain_hash(this_ptr_conv, val_conv);
6444 }
6445
6446 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
6447         LDKQueryChannelRange* this_ptr_conv = (LDKQueryChannelRange*)this_ptr;
6448         return QueryChannelRange_get_first_blocknum(this_ptr_conv);
6449 }
6450
6451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6452         LDKQueryChannelRange* this_ptr_conv = (LDKQueryChannelRange*)this_ptr;
6453         return QueryChannelRange_set_first_blocknum(this_ptr_conv, val);
6454 }
6455
6456 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
6457         LDKQueryChannelRange* this_ptr_conv = (LDKQueryChannelRange*)this_ptr;
6458         return QueryChannelRange_get_number_of_blocks(this_ptr_conv);
6459 }
6460
6461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6462         LDKQueryChannelRange* this_ptr_conv = (LDKQueryChannelRange*)this_ptr;
6463         return QueryChannelRange_set_number_of_blocks(this_ptr_conv, val);
6464 }
6465
6466 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg) {
6467         LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg;
6468         FREE((void*)chain_hash_arg);
6469         LDKQueryChannelRange* ret = MALLOC(sizeof(LDKQueryChannelRange), "LDKQueryChannelRange");
6470         *ret = QueryChannelRange_new(chain_hash_arg_conv, first_blocknum_arg, number_of_blocks_arg);
6471         DO_ASSERT(ret->is_owned);
6472         ret->is_owned = false;
6473         return (long)ret;
6474 }
6475
6476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6477         LDKReplyChannelRange this_ptr_conv = *(LDKReplyChannelRange*)this_ptr;
6478         FREE((void*)this_ptr);
6479         this_ptr_conv.is_owned = true;
6480         return ReplyChannelRange_free(this_ptr_conv);
6481 }
6482
6483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6484         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6485         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6486         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(this_ptr_conv));
6487         return ret_arr;
6488 }
6489
6490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6491         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6492         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6493         FREE((void*)val);
6494         return ReplyChannelRange_set_chain_hash(this_ptr_conv, val_conv);
6495 }
6496
6497 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
6498         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6499         return ReplyChannelRange_get_first_blocknum(this_ptr_conv);
6500 }
6501
6502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6503         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6504         return ReplyChannelRange_set_first_blocknum(this_ptr_conv, val);
6505 }
6506
6507 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
6508         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6509         return ReplyChannelRange_get_number_of_blocks(this_ptr_conv);
6510 }
6511
6512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6513         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6514         return ReplyChannelRange_set_number_of_blocks(this_ptr_conv, val);
6515 }
6516
6517 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
6518         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6519         return ReplyChannelRange_get_full_information(this_ptr_conv);
6520 }
6521
6522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6523         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6524         return ReplyChannelRange_set_full_information(this_ptr_conv, val);
6525 }
6526
6527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6528         LDKReplyChannelRange* this_ptr_conv = (LDKReplyChannelRange*)this_ptr;
6529         LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
6530         FREE((void*)val);
6531         return ReplyChannelRange_set_short_channel_ids(this_ptr_conv, val_conv);
6532 }
6533
6534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg, jboolean full_information_arg, jlong short_channel_ids_arg) {
6535         LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg;
6536         FREE((void*)chain_hash_arg);
6537         LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
6538         FREE((void*)short_channel_ids_arg);
6539         LDKReplyChannelRange* ret = MALLOC(sizeof(LDKReplyChannelRange), "LDKReplyChannelRange");
6540         *ret = ReplyChannelRange_new(chain_hash_arg_conv, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
6541         DO_ASSERT(ret->is_owned);
6542         ret->is_owned = false;
6543         return (long)ret;
6544 }
6545
6546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6547         LDKQueryShortChannelIds this_ptr_conv = *(LDKQueryShortChannelIds*)this_ptr;
6548         FREE((void*)this_ptr);
6549         this_ptr_conv.is_owned = true;
6550         return QueryShortChannelIds_free(this_ptr_conv);
6551 }
6552
6553 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6554         LDKQueryShortChannelIds* this_ptr_conv = (LDKQueryShortChannelIds*)this_ptr;
6555         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6556         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(this_ptr_conv));
6557         return ret_arr;
6558 }
6559
6560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6561         LDKQueryShortChannelIds* this_ptr_conv = (LDKQueryShortChannelIds*)this_ptr;
6562         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6563         FREE((void*)val);
6564         return QueryShortChannelIds_set_chain_hash(this_ptr_conv, val_conv);
6565 }
6566
6567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6568         LDKQueryShortChannelIds* this_ptr_conv = (LDKQueryShortChannelIds*)this_ptr;
6569         LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
6570         FREE((void*)val);
6571         return QueryShortChannelIds_set_short_channel_ids(this_ptr_conv, val_conv);
6572 }
6573
6574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jlong short_channel_ids_arg) {
6575         LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg;
6576         FREE((void*)chain_hash_arg);
6577         LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
6578         FREE((void*)short_channel_ids_arg);
6579         LDKQueryShortChannelIds* ret = MALLOC(sizeof(LDKQueryShortChannelIds), "LDKQueryShortChannelIds");
6580         *ret = QueryShortChannelIds_new(chain_hash_arg_conv, short_channel_ids_arg_conv);
6581         DO_ASSERT(ret->is_owned);
6582         ret->is_owned = false;
6583         return (long)ret;
6584 }
6585
6586 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6587         LDKReplyShortChannelIdsEnd this_ptr_conv = *(LDKReplyShortChannelIdsEnd*)this_ptr;
6588         FREE((void*)this_ptr);
6589         this_ptr_conv.is_owned = true;
6590         return ReplyShortChannelIdsEnd_free(this_ptr_conv);
6591 }
6592
6593 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6594         LDKReplyShortChannelIdsEnd* this_ptr_conv = (LDKReplyShortChannelIdsEnd*)this_ptr;
6595         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6596         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(this_ptr_conv));
6597         return ret_arr;
6598 }
6599
6600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6601         LDKReplyShortChannelIdsEnd* this_ptr_conv = (LDKReplyShortChannelIdsEnd*)this_ptr;
6602         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6603         FREE((void*)val);
6604         return ReplyShortChannelIdsEnd_set_chain_hash(this_ptr_conv, val_conv);
6605 }
6606
6607 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
6608         LDKReplyShortChannelIdsEnd* this_ptr_conv = (LDKReplyShortChannelIdsEnd*)this_ptr;
6609         return ReplyShortChannelIdsEnd_get_full_information(this_ptr_conv);
6610 }
6611
6612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6613         LDKReplyShortChannelIdsEnd* this_ptr_conv = (LDKReplyShortChannelIdsEnd*)this_ptr;
6614         return ReplyShortChannelIdsEnd_set_full_information(this_ptr_conv, val);
6615 }
6616
6617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jboolean full_information_arg) {
6618         LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg;
6619         FREE((void*)chain_hash_arg);
6620         LDKReplyShortChannelIdsEnd* ret = MALLOC(sizeof(LDKReplyShortChannelIdsEnd), "LDKReplyShortChannelIdsEnd");
6621         *ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_conv, full_information_arg);
6622         DO_ASSERT(ret->is_owned);
6623         ret->is_owned = false;
6624         return (long)ret;
6625 }
6626
6627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6628         LDKGossipTimestampFilter this_ptr_conv = *(LDKGossipTimestampFilter*)this_ptr;
6629         FREE((void*)this_ptr);
6630         this_ptr_conv.is_owned = true;
6631         return GossipTimestampFilter_free(this_ptr_conv);
6632 }
6633
6634 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6635         LDKGossipTimestampFilter* this_ptr_conv = (LDKGossipTimestampFilter*)this_ptr;
6636         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6637         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(this_ptr_conv));
6638         return ret_arr;
6639 }
6640
6641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6642         LDKGossipTimestampFilter* this_ptr_conv = (LDKGossipTimestampFilter*)this_ptr;
6643         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6644         FREE((void*)val);
6645         return GossipTimestampFilter_set_chain_hash(this_ptr_conv, val_conv);
6646 }
6647
6648 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
6649         LDKGossipTimestampFilter* this_ptr_conv = (LDKGossipTimestampFilter*)this_ptr;
6650         return GossipTimestampFilter_get_first_timestamp(this_ptr_conv);
6651 }
6652
6653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6654         LDKGossipTimestampFilter* this_ptr_conv = (LDKGossipTimestampFilter*)this_ptr;
6655         return GossipTimestampFilter_set_first_timestamp(this_ptr_conv, val);
6656 }
6657
6658 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
6659         LDKGossipTimestampFilter* this_ptr_conv = (LDKGossipTimestampFilter*)this_ptr;
6660         return GossipTimestampFilter_get_timestamp_range(this_ptr_conv);
6661 }
6662
6663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6664         LDKGossipTimestampFilter* this_ptr_conv = (LDKGossipTimestampFilter*)this_ptr;
6665         return GossipTimestampFilter_set_timestamp_range(this_ptr_conv, val);
6666 }
6667
6668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv * _env, jclass _b, jlong chain_hash_arg, jint first_timestamp_arg, jint timestamp_range_arg) {
6669         LDKThirtyTwoBytes chain_hash_arg_conv = *(LDKThirtyTwoBytes*)chain_hash_arg;
6670         FREE((void*)chain_hash_arg);
6671         LDKGossipTimestampFilter* ret = MALLOC(sizeof(LDKGossipTimestampFilter), "LDKGossipTimestampFilter");
6672         *ret = GossipTimestampFilter_new(chain_hash_arg_conv, first_timestamp_arg, timestamp_range_arg);
6673         DO_ASSERT(ret->is_owned);
6674         ret->is_owned = false;
6675         return (long)ret;
6676 }
6677
6678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6679         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
6680         FREE((void*)this_ptr);
6681         return ErrorAction_free(this_ptr_conv);
6682 }
6683
6684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6685         LDKLightningError this_ptr_conv = *(LDKLightningError*)this_ptr;
6686         FREE((void*)this_ptr);
6687         this_ptr_conv.is_owned = true;
6688         return LightningError_free(this_ptr_conv);
6689 }
6690
6691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
6692         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
6693         LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6694         *ret = LightningError_get_err(this_ptr_conv);
6695         return (long)ret;
6696 }
6697
6698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6699         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
6700         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6701         FREE((void*)val);
6702         return LightningError_set_err(this_ptr_conv, val_conv);
6703 }
6704
6705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
6706         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
6707         LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
6708         *ret = LightningError_get_action(this_ptr_conv);
6709         return (long)ret;
6710 }
6711
6712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6713         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
6714         LDKErrorAction val_conv = *(LDKErrorAction*)val;
6715         FREE((void*)val);
6716         return LightningError_set_action(this_ptr_conv, val_conv);
6717 }
6718
6719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
6720         LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
6721         FREE((void*)err_arg);
6722         LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
6723         FREE((void*)action_arg);
6724         LDKLightningError* ret = MALLOC(sizeof(LDKLightningError), "LDKLightningError");
6725         *ret = LightningError_new(err_arg_conv, action_arg_conv);
6726         DO_ASSERT(ret->is_owned);
6727         ret->is_owned = false;
6728         return (long)ret;
6729 }
6730
6731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6732         LDKCommitmentUpdate this_ptr_conv = *(LDKCommitmentUpdate*)this_ptr;
6733         FREE((void*)this_ptr);
6734         this_ptr_conv.is_owned = true;
6735         return CommitmentUpdate_free(this_ptr_conv);
6736 }
6737
6738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6739         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6740         LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
6741         FREE((void*)val);
6742         return CommitmentUpdate_set_update_add_htlcs(this_ptr_conv, val_conv);
6743 }
6744
6745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6746         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6747         LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
6748         FREE((void*)val);
6749         return CommitmentUpdate_set_update_fulfill_htlcs(this_ptr_conv, val_conv);
6750 }
6751
6752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6753         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6754         LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
6755         FREE((void*)val);
6756         return CommitmentUpdate_set_update_fail_htlcs(this_ptr_conv, val_conv);
6757 }
6758
6759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6760         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6761         LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
6762         FREE((void*)val);
6763         return CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr_conv, val_conv);
6764 }
6765
6766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
6767         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6768         LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
6769         *ret = CommitmentUpdate_get_update_fee(this_ptr_conv);
6770         DO_ASSERT(ret->is_owned);
6771         ret->is_owned = false;
6772         return (long)ret;
6773 }
6774
6775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6776         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6777         LDKUpdateFee val_conv = *(LDKUpdateFee*)val;
6778         FREE((void*)val);
6779         val_conv.is_owned = true;
6780         return CommitmentUpdate_set_update_fee(this_ptr_conv, val_conv);
6781 }
6782
6783 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6784         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6785         LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
6786         *ret = CommitmentUpdate_get_commitment_signed(this_ptr_conv);
6787         DO_ASSERT(ret->is_owned);
6788         ret->is_owned = false;
6789         return (long)ret;
6790 }
6791
6792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6793         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
6794         LDKCommitmentSigned val_conv = *(LDKCommitmentSigned*)val;
6795         FREE((void*)val);
6796         val_conv.is_owned = true;
6797         return CommitmentUpdate_set_commitment_signed(this_ptr_conv, val_conv);
6798 }
6799
6800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv * _env, jclass _b, jlong update_add_htlcs_arg, jlong update_fulfill_htlcs_arg, jlong update_fail_htlcs_arg, jlong update_fail_malformed_htlcs_arg, jlong update_fee_arg, jlong commitment_signed_arg) {
6801         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
6802         FREE((void*)update_add_htlcs_arg);
6803         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
6804         FREE((void*)update_fulfill_htlcs_arg);
6805         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
6806         FREE((void*)update_fail_htlcs_arg);
6807         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
6808         FREE((void*)update_fail_malformed_htlcs_arg);
6809         LDKUpdateFee update_fee_arg_conv = *(LDKUpdateFee*)update_fee_arg;
6810         FREE((void*)update_fee_arg);
6811         update_fee_arg_conv.is_owned = true;
6812         LDKCommitmentSigned commitment_signed_arg_conv = *(LDKCommitmentSigned*)commitment_signed_arg;
6813         FREE((void*)commitment_signed_arg);
6814         commitment_signed_arg_conv.is_owned = true;
6815         LDKCommitmentUpdate* ret = MALLOC(sizeof(LDKCommitmentUpdate), "LDKCommitmentUpdate");
6816         *ret = CommitmentUpdate_new(update_add_htlcs_arg_conv, update_fulfill_htlcs_arg_conv, update_fail_htlcs_arg_conv, update_fail_malformed_htlcs_arg_conv, update_fee_arg_conv, commitment_signed_arg_conv);
6817         DO_ASSERT(ret->is_owned);
6818         ret->is_owned = false;
6819         return (long)ret;
6820 }
6821
6822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6823         LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
6824         FREE((void*)this_ptr);
6825         return HTLCFailChannelUpdate_free(this_ptr_conv);
6826 }
6827
6828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6829         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
6830         FREE((void*)this_ptr);
6831         return ChannelMessageHandler_free(this_ptr_conv);
6832 }
6833
6834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6835         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
6836         FREE((void*)this_ptr);
6837         return RoutingMessageHandler_free(this_ptr_conv);
6838 }
6839
6840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
6841         LDKAcceptChannel* obj_conv = (LDKAcceptChannel*)obj;
6842         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6843         *ret = AcceptChannel_write(obj_conv);
6844         return (long)ret;
6845 }
6846
6847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
6848         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6849         LDKAcceptChannel* ret = MALLOC(sizeof(LDKAcceptChannel), "LDKAcceptChannel");
6850         *ret = AcceptChannel_read(ser_conv);
6851         DO_ASSERT(ret->is_owned);
6852         ret->is_owned = false;
6853         return (long)ret;
6854 }
6855
6856 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
6857         LDKAnnouncementSignatures* obj_conv = (LDKAnnouncementSignatures*)obj;
6858         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6859         *ret = AnnouncementSignatures_write(obj_conv);
6860         return (long)ret;
6861 }
6862
6863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
6864         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6865         LDKAnnouncementSignatures* ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures");
6866         *ret = AnnouncementSignatures_read(ser_conv);
6867         DO_ASSERT(ret->is_owned);
6868         ret->is_owned = false;
6869         return (long)ret;
6870 }
6871
6872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
6873         LDKChannelReestablish* obj_conv = (LDKChannelReestablish*)obj;
6874         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6875         *ret = ChannelReestablish_write(obj_conv);
6876         return (long)ret;
6877 }
6878
6879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
6880         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6881         LDKChannelReestablish* ret = MALLOC(sizeof(LDKChannelReestablish), "LDKChannelReestablish");
6882         *ret = ChannelReestablish_read(ser_conv);
6883         DO_ASSERT(ret->is_owned);
6884         ret->is_owned = false;
6885         return (long)ret;
6886 }
6887
6888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
6889         LDKClosingSigned* obj_conv = (LDKClosingSigned*)obj;
6890         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6891         *ret = ClosingSigned_write(obj_conv);
6892         return (long)ret;
6893 }
6894
6895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
6896         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6897         LDKClosingSigned* ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned");
6898         *ret = ClosingSigned_read(ser_conv);
6899         DO_ASSERT(ret->is_owned);
6900         ret->is_owned = false;
6901         return (long)ret;
6902 }
6903
6904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
6905         LDKCommitmentSigned* obj_conv = (LDKCommitmentSigned*)obj;
6906         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6907         *ret = CommitmentSigned_write(obj_conv);
6908         return (long)ret;
6909 }
6910
6911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
6912         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6913         LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
6914         *ret = CommitmentSigned_read(ser_conv);
6915         DO_ASSERT(ret->is_owned);
6916         ret->is_owned = false;
6917         return (long)ret;
6918 }
6919
6920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
6921         LDKFundingCreated* obj_conv = (LDKFundingCreated*)obj;
6922         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6923         *ret = FundingCreated_write(obj_conv);
6924         return (long)ret;
6925 }
6926
6927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
6928         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6929         LDKFundingCreated* ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated");
6930         *ret = FundingCreated_read(ser_conv);
6931         DO_ASSERT(ret->is_owned);
6932         ret->is_owned = false;
6933         return (long)ret;
6934 }
6935
6936 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
6937         LDKFundingSigned* obj_conv = (LDKFundingSigned*)obj;
6938         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6939         *ret = FundingSigned_write(obj_conv);
6940         return (long)ret;
6941 }
6942
6943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
6944         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6945         LDKFundingSigned* ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned");
6946         *ret = FundingSigned_read(ser_conv);
6947         DO_ASSERT(ret->is_owned);
6948         ret->is_owned = false;
6949         return (long)ret;
6950 }
6951
6952 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
6953         LDKFundingLocked* obj_conv = (LDKFundingLocked*)obj;
6954         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6955         *ret = FundingLocked_write(obj_conv);
6956         return (long)ret;
6957 }
6958
6959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
6960         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6961         LDKFundingLocked* ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked");
6962         *ret = FundingLocked_read(ser_conv);
6963         DO_ASSERT(ret->is_owned);
6964         ret->is_owned = false;
6965         return (long)ret;
6966 }
6967
6968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
6969         LDKInit* obj_conv = (LDKInit*)obj;
6970         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6971         *ret = Init_write(obj_conv);
6972         return (long)ret;
6973 }
6974
6975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
6976         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6977         LDKInit* ret = MALLOC(sizeof(LDKInit), "LDKInit");
6978         *ret = Init_read(ser_conv);
6979         DO_ASSERT(ret->is_owned);
6980         ret->is_owned = false;
6981         return (long)ret;
6982 }
6983
6984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
6985         LDKOpenChannel* obj_conv = (LDKOpenChannel*)obj;
6986         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6987         *ret = OpenChannel_write(obj_conv);
6988         return (long)ret;
6989 }
6990
6991 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
6992         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6993         LDKOpenChannel* ret = MALLOC(sizeof(LDKOpenChannel), "LDKOpenChannel");
6994         *ret = OpenChannel_read(ser_conv);
6995         DO_ASSERT(ret->is_owned);
6996         ret->is_owned = false;
6997         return (long)ret;
6998 }
6999
7000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
7001         LDKRevokeAndACK* obj_conv = (LDKRevokeAndACK*)obj;
7002         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7003         *ret = RevokeAndACK_write(obj_conv);
7004         return (long)ret;
7005 }
7006
7007 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
7008         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7009         LDKRevokeAndACK* ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK");
7010         *ret = RevokeAndACK_read(ser_conv);
7011         DO_ASSERT(ret->is_owned);
7012         ret->is_owned = false;
7013         return (long)ret;
7014 }
7015
7016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
7017         LDKShutdown* obj_conv = (LDKShutdown*)obj;
7018         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7019         *ret = Shutdown_write(obj_conv);
7020         return (long)ret;
7021 }
7022
7023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
7024         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7025         LDKShutdown* ret = MALLOC(sizeof(LDKShutdown), "LDKShutdown");
7026         *ret = Shutdown_read(ser_conv);
7027         DO_ASSERT(ret->is_owned);
7028         ret->is_owned = false;
7029         return (long)ret;
7030 }
7031
7032 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
7033         LDKUpdateFailHTLC* obj_conv = (LDKUpdateFailHTLC*)obj;
7034         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7035         *ret = UpdateFailHTLC_write(obj_conv);
7036         return (long)ret;
7037 }
7038
7039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
7040         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7041         LDKUpdateFailHTLC* ret = MALLOC(sizeof(LDKUpdateFailHTLC), "LDKUpdateFailHTLC");
7042         *ret = UpdateFailHTLC_read(ser_conv);
7043         DO_ASSERT(ret->is_owned);
7044         ret->is_owned = false;
7045         return (long)ret;
7046 }
7047
7048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
7049         LDKUpdateFailMalformedHTLC* obj_conv = (LDKUpdateFailMalformedHTLC*)obj;
7050         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7051         *ret = UpdateFailMalformedHTLC_write(obj_conv);
7052         return (long)ret;
7053 }
7054
7055 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
7056         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7057         LDKUpdateFailMalformedHTLC* ret = MALLOC(sizeof(LDKUpdateFailMalformedHTLC), "LDKUpdateFailMalformedHTLC");
7058         *ret = UpdateFailMalformedHTLC_read(ser_conv);
7059         DO_ASSERT(ret->is_owned);
7060         ret->is_owned = false;
7061         return (long)ret;
7062 }
7063
7064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
7065         LDKUpdateFee* obj_conv = (LDKUpdateFee*)obj;
7066         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7067         *ret = UpdateFee_write(obj_conv);
7068         return (long)ret;
7069 }
7070
7071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
7072         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7073         LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
7074         *ret = UpdateFee_read(ser_conv);
7075         DO_ASSERT(ret->is_owned);
7076         ret->is_owned = false;
7077         return (long)ret;
7078 }
7079
7080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
7081         LDKUpdateFulfillHTLC* obj_conv = (LDKUpdateFulfillHTLC*)obj;
7082         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7083         *ret = UpdateFulfillHTLC_write(obj_conv);
7084         return (long)ret;
7085 }
7086
7087 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
7088         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7089         LDKUpdateFulfillHTLC* ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC");
7090         *ret = UpdateFulfillHTLC_read(ser_conv);
7091         DO_ASSERT(ret->is_owned);
7092         ret->is_owned = false;
7093         return (long)ret;
7094 }
7095
7096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
7097         LDKUpdateAddHTLC* obj_conv = (LDKUpdateAddHTLC*)obj;
7098         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7099         *ret = UpdateAddHTLC_write(obj_conv);
7100         return (long)ret;
7101 }
7102
7103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
7104         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7105         LDKUpdateAddHTLC* ret = MALLOC(sizeof(LDKUpdateAddHTLC), "LDKUpdateAddHTLC");
7106         *ret = UpdateAddHTLC_read(ser_conv);
7107         DO_ASSERT(ret->is_owned);
7108         ret->is_owned = false;
7109         return (long)ret;
7110 }
7111
7112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
7113         LDKPing* obj_conv = (LDKPing*)obj;
7114         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7115         *ret = Ping_write(obj_conv);
7116         return (long)ret;
7117 }
7118
7119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
7120         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7121         LDKPing* ret = MALLOC(sizeof(LDKPing), "LDKPing");
7122         *ret = Ping_read(ser_conv);
7123         DO_ASSERT(ret->is_owned);
7124         ret->is_owned = false;
7125         return (long)ret;
7126 }
7127
7128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
7129         LDKPong* obj_conv = (LDKPong*)obj;
7130         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7131         *ret = Pong_write(obj_conv);
7132         return (long)ret;
7133 }
7134
7135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
7136         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7137         LDKPong* ret = MALLOC(sizeof(LDKPong), "LDKPong");
7138         *ret = Pong_read(ser_conv);
7139         DO_ASSERT(ret->is_owned);
7140         ret->is_owned = false;
7141         return (long)ret;
7142 }
7143
7144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
7145         LDKUnsignedChannelAnnouncement* obj_conv = (LDKUnsignedChannelAnnouncement*)obj;
7146         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7147         *ret = UnsignedChannelAnnouncement_write(obj_conv);
7148         return (long)ret;
7149 }
7150
7151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
7152         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7153         LDKUnsignedChannelAnnouncement* ret = MALLOC(sizeof(LDKUnsignedChannelAnnouncement), "LDKUnsignedChannelAnnouncement");
7154         *ret = UnsignedChannelAnnouncement_read(ser_conv);
7155         DO_ASSERT(ret->is_owned);
7156         ret->is_owned = false;
7157         return (long)ret;
7158 }
7159
7160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
7161         LDKChannelAnnouncement* obj_conv = (LDKChannelAnnouncement*)obj;
7162         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7163         *ret = ChannelAnnouncement_write(obj_conv);
7164         return (long)ret;
7165 }
7166
7167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
7168         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7169         LDKChannelAnnouncement* ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
7170         *ret = ChannelAnnouncement_read(ser_conv);
7171         DO_ASSERT(ret->is_owned);
7172         ret->is_owned = false;
7173         return (long)ret;
7174 }
7175
7176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
7177         LDKUnsignedChannelUpdate* obj_conv = (LDKUnsignedChannelUpdate*)obj;
7178         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7179         *ret = UnsignedChannelUpdate_write(obj_conv);
7180         return (long)ret;
7181 }
7182
7183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
7184         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7185         LDKUnsignedChannelUpdate* ret = MALLOC(sizeof(LDKUnsignedChannelUpdate), "LDKUnsignedChannelUpdate");
7186         *ret = UnsignedChannelUpdate_read(ser_conv);
7187         DO_ASSERT(ret->is_owned);
7188         ret->is_owned = false;
7189         return (long)ret;
7190 }
7191
7192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
7193         LDKChannelUpdate* obj_conv = (LDKChannelUpdate*)obj;
7194         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7195         *ret = ChannelUpdate_write(obj_conv);
7196         return (long)ret;
7197 }
7198
7199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
7200         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7201         LDKChannelUpdate* ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
7202         *ret = ChannelUpdate_read(ser_conv);
7203         DO_ASSERT(ret->is_owned);
7204         ret->is_owned = false;
7205         return (long)ret;
7206 }
7207
7208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
7209         LDKErrorMessage* obj_conv = (LDKErrorMessage*)obj;
7210         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7211         *ret = ErrorMessage_write(obj_conv);
7212         return (long)ret;
7213 }
7214
7215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
7216         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7217         LDKErrorMessage* ret = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage");
7218         *ret = ErrorMessage_read(ser_conv);
7219         DO_ASSERT(ret->is_owned);
7220         ret->is_owned = false;
7221         return (long)ret;
7222 }
7223
7224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
7225         LDKUnsignedNodeAnnouncement* obj_conv = (LDKUnsignedNodeAnnouncement*)obj;
7226         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7227         *ret = UnsignedNodeAnnouncement_write(obj_conv);
7228         return (long)ret;
7229 }
7230
7231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
7232         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7233         LDKUnsignedNodeAnnouncement* ret = MALLOC(sizeof(LDKUnsignedNodeAnnouncement), "LDKUnsignedNodeAnnouncement");
7234         *ret = UnsignedNodeAnnouncement_read(ser_conv);
7235         DO_ASSERT(ret->is_owned);
7236         ret->is_owned = false;
7237         return (long)ret;
7238 }
7239
7240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
7241         LDKNodeAnnouncement* obj_conv = (LDKNodeAnnouncement*)obj;
7242         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7243         *ret = NodeAnnouncement_write(obj_conv);
7244         return (long)ret;
7245 }
7246
7247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
7248         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7249         LDKNodeAnnouncement* ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
7250         *ret = NodeAnnouncement_read(ser_conv);
7251         DO_ASSERT(ret->is_owned);
7252         ret->is_owned = false;
7253         return (long)ret;
7254 }
7255
7256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jlong ser) {
7257         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7258         LDKQueryShortChannelIds* ret = MALLOC(sizeof(LDKQueryShortChannelIds), "LDKQueryShortChannelIds");
7259         *ret = QueryShortChannelIds_read(ser_conv);
7260         DO_ASSERT(ret->is_owned);
7261         ret->is_owned = false;
7262         return (long)ret;
7263 }
7264
7265 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
7266         LDKQueryShortChannelIds* obj_conv = (LDKQueryShortChannelIds*)obj;
7267         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7268         *ret = QueryShortChannelIds_write(obj_conv);
7269         return (long)ret;
7270 }
7271
7272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jlong ser) {
7273         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7274         LDKReplyShortChannelIdsEnd* ret = MALLOC(sizeof(LDKReplyShortChannelIdsEnd), "LDKReplyShortChannelIdsEnd");
7275         *ret = ReplyShortChannelIdsEnd_read(ser_conv);
7276         DO_ASSERT(ret->is_owned);
7277         ret->is_owned = false;
7278         return (long)ret;
7279 }
7280
7281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
7282         LDKReplyShortChannelIdsEnd* obj_conv = (LDKReplyShortChannelIdsEnd*)obj;
7283         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7284         *ret = ReplyShortChannelIdsEnd_write(obj_conv);
7285         return (long)ret;
7286 }
7287
7288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
7289         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7290         LDKQueryChannelRange* ret = MALLOC(sizeof(LDKQueryChannelRange), "LDKQueryChannelRange");
7291         *ret = QueryChannelRange_read(ser_conv);
7292         DO_ASSERT(ret->is_owned);
7293         ret->is_owned = false;
7294         return (long)ret;
7295 }
7296
7297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
7298         LDKQueryChannelRange* obj_conv = (LDKQueryChannelRange*)obj;
7299         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7300         *ret = QueryChannelRange_write(obj_conv);
7301         return (long)ret;
7302 }
7303
7304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jlong ser) {
7305         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7306         LDKReplyChannelRange* ret = MALLOC(sizeof(LDKReplyChannelRange), "LDKReplyChannelRange");
7307         *ret = ReplyChannelRange_read(ser_conv);
7308         DO_ASSERT(ret->is_owned);
7309         ret->is_owned = false;
7310         return (long)ret;
7311 }
7312
7313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
7314         LDKReplyChannelRange* obj_conv = (LDKReplyChannelRange*)obj;
7315         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7316         *ret = ReplyChannelRange_write(obj_conv);
7317         return (long)ret;
7318 }
7319
7320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jlong ser) {
7321         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7322         LDKGossipTimestampFilter* ret = MALLOC(sizeof(LDKGossipTimestampFilter), "LDKGossipTimestampFilter");
7323         *ret = GossipTimestampFilter_read(ser_conv);
7324         DO_ASSERT(ret->is_owned);
7325         ret->is_owned = false;
7326         return (long)ret;
7327 }
7328
7329 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
7330         LDKGossipTimestampFilter* obj_conv = (LDKGossipTimestampFilter*)obj;
7331         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7332         *ret = GossipTimestampFilter_write(obj_conv);
7333         return (long)ret;
7334 }
7335
7336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7337         LDKMessageHandler this_ptr_conv = *(LDKMessageHandler*)this_ptr;
7338         FREE((void*)this_ptr);
7339         this_ptr_conv.is_owned = true;
7340         return MessageHandler_free(this_ptr_conv);
7341 }
7342
7343 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
7344         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
7345         long ret = (long)MessageHandler_get_chan_handler(this_ptr_conv);
7346         return ret;
7347 }
7348
7349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7350         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
7351         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
7352         if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
7353                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7354                 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
7355         }
7356         return MessageHandler_set_chan_handler(this_ptr_conv, val_conv);
7357 }
7358
7359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
7360         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
7361         long ret = (long)MessageHandler_get_route_handler(this_ptr_conv);
7362         return ret;
7363 }
7364
7365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7366         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
7367         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
7368         if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
7369                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7370                 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
7371         }
7372         return MessageHandler_set_route_handler(this_ptr_conv, val_conv);
7373 }
7374
7375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
7376         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
7377         if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
7378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7379                 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
7380         }
7381         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
7382         if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
7383                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7384                 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
7385         }
7386         LDKMessageHandler* ret = MALLOC(sizeof(LDKMessageHandler), "LDKMessageHandler");
7387         *ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
7388         DO_ASSERT(ret->is_owned);
7389         ret->is_owned = false;
7390         return (long)ret;
7391 }
7392
7393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7394         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
7395         FREE((void*)this_ptr);
7396         return SocketDescriptor_free(this_ptr_conv);
7397 }
7398
7399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7400         LDKPeerHandleError this_ptr_conv = *(LDKPeerHandleError*)this_ptr;
7401         FREE((void*)this_ptr);
7402         this_ptr_conv.is_owned = true;
7403         return PeerHandleError_free(this_ptr_conv);
7404 }
7405
7406 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
7407         LDKPeerHandleError* this_ptr_conv = (LDKPeerHandleError*)this_ptr;
7408         return PeerHandleError_get_no_connection_possible(this_ptr_conv);
7409 }
7410
7411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7412         LDKPeerHandleError* this_ptr_conv = (LDKPeerHandleError*)this_ptr;
7413         return PeerHandleError_set_no_connection_possible(this_ptr_conv, val);
7414 }
7415
7416 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
7417         LDKPeerHandleError* ret = MALLOC(sizeof(LDKPeerHandleError), "LDKPeerHandleError");
7418         *ret = PeerHandleError_new(no_connection_possible_arg);
7419         DO_ASSERT(ret->is_owned);
7420         ret->is_owned = false;
7421         return (long)ret;
7422 }
7423
7424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7425         LDKPeerManager this_ptr_conv = *(LDKPeerManager*)this_ptr;
7426         FREE((void*)this_ptr);
7427         this_ptr_conv.is_owned = true;
7428         return PeerManager_free(this_ptr_conv);
7429 }
7430
7431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jlong our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
7432         LDKMessageHandler message_handler_conv = *(LDKMessageHandler*)message_handler;
7433         FREE((void*)message_handler);
7434         message_handler_conv.is_owned = true;
7435         LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
7436         FREE((void*)our_node_secret);
7437         unsigned char ephemeral_random_data_arr[32];
7438         (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
7439         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
7440         LDKLogger logger_conv = *(LDKLogger*)logger;
7441         if (logger_conv.free == LDKLogger_JCalls_free) {
7442                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7443                 LDKLogger_JCalls_clone(logger_conv.this_arg);
7444         }
7445         LDKPeerManager* ret = MALLOC(sizeof(LDKPeerManager), "LDKPeerManager");
7446         *ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
7447         DO_ASSERT(ret->is_owned);
7448         ret->is_owned = false;
7449         return (long)ret;
7450 }
7451
7452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
7453         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7454         LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
7455         *ret = PeerManager_get_peer_node_ids(this_arg_conv);
7456         return (long)ret;
7457 }
7458
7459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_node_id, jlong descriptor) {
7460         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7461         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
7462         FREE((void*)their_node_id);
7463         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
7464         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
7465                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7466                 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
7467         }
7468         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
7469         *ret = PeerManager_new_outbound_connection(this_arg_conv, their_node_id_conv, descriptor_conv);
7470         return (long)ret;
7471 }
7472
7473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
7474         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7475         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
7476         if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
7477                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7478                 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
7479         }
7480         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7481         *ret = PeerManager_new_inbound_connection(this_arg_conv, descriptor_conv);
7482         return (long)ret;
7483 }
7484
7485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
7486         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7487         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
7488         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
7489         *ret = PeerManager_write_buffer_space_avail(this_arg_conv, descriptor_conv);
7490         return (long)ret;
7491 }
7492
7493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
7494         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7495         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
7496         LDKu8slice data_conv = *(LDKu8slice*)data;
7497         LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7498         *ret = PeerManager_read_event(this_arg_conv, peer_descriptor_conv, data_conv);
7499         return (long)ret;
7500 }
7501
7502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
7503         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7504         return PeerManager_process_events(this_arg_conv);
7505 }
7506
7507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
7508         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7509         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
7510         return PeerManager_socket_disconnected(this_arg_conv, descriptor_conv);
7511 }
7512
7513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
7514         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
7515         return PeerManager_timer_tick_occured(this_arg_conv);
7516 }
7517
7518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
7519         unsigned char commitment_seed_arr[32];
7520         (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
7521         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
7522         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
7523         *ret = build_commitment_secret(commitment_seed_ref, idx);
7524         return (long)ret;
7525 }
7526
7527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jlong per_commitment_point, jbyteArray base_secret) {
7528         LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
7529         FREE((void*)per_commitment_point);
7530         unsigned char base_secret_arr[32];
7531         (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
7532         unsigned char (*base_secret_ref)[32] = &base_secret_arr;
7533         LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
7534         *ret = derive_private_key(per_commitment_point_conv, base_secret_ref);
7535         return (long)ret;
7536 }
7537
7538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jlong per_commitment_point, jlong base_point) {
7539         LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
7540         FREE((void*)per_commitment_point);
7541         LDKPublicKey base_point_conv = *(LDKPublicKey*)base_point;
7542         FREE((void*)base_point);
7543         LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
7544         *ret = derive_public_key(per_commitment_point_conv, base_point_conv);
7545         return (long)ret;
7546 }
7547
7548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_secret, jbyteArray countersignatory_revocation_base_secret) {
7549         unsigned char per_commitment_secret_arr[32];
7550         (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
7551         unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
7552         unsigned char countersignatory_revocation_base_secret_arr[32];
7553         (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
7554         unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
7555         LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
7556         *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
7557         return (long)ret;
7558 }
7559
7560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv * _env, jclass _b, jlong per_commitment_point, jlong countersignatory_revocation_base_point) {
7561         LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
7562         FREE((void*)per_commitment_point);
7563         LDKPublicKey countersignatory_revocation_base_point_conv = *(LDKPublicKey*)countersignatory_revocation_base_point;
7564         FREE((void*)countersignatory_revocation_base_point);
7565         LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
7566         *ret = derive_public_revocation_key(per_commitment_point_conv, countersignatory_revocation_base_point_conv);
7567         return (long)ret;
7568 }
7569
7570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7571         LDKTxCreationKeys this_ptr_conv = *(LDKTxCreationKeys*)this_ptr;
7572         FREE((void*)this_ptr);
7573         this_ptr_conv.is_owned = true;
7574         return TxCreationKeys_free(this_ptr_conv);
7575 }
7576
7577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7578         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7579         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7580         *ret = TxCreationKeys_get_per_commitment_point(this_ptr_conv);
7581         return (long)ret;
7582 }
7583
7584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7585         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7586         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7587         FREE((void*)val);
7588         return TxCreationKeys_set_per_commitment_point(this_ptr_conv, val_conv);
7589 }
7590
7591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
7592         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7593         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7594         *ret = TxCreationKeys_get_revocation_key(this_ptr_conv);
7595         return (long)ret;
7596 }
7597
7598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7599         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7600         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7601         FREE((void*)val);
7602         return TxCreationKeys_set_revocation_key(this_ptr_conv, val_conv);
7603 }
7604
7605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
7606         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7607         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7608         *ret = TxCreationKeys_get_broadcaster_htlc_key(this_ptr_conv);
7609         return (long)ret;
7610 }
7611
7612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7613         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7614         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7615         FREE((void*)val);
7616         return TxCreationKeys_set_broadcaster_htlc_key(this_ptr_conv, val_conv);
7617 }
7618
7619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
7620         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7621         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7622         *ret = TxCreationKeys_get_countersignatory_htlc_key(this_ptr_conv);
7623         return (long)ret;
7624 }
7625
7626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7627         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7628         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7629         FREE((void*)val);
7630         return TxCreationKeys_set_countersignatory_htlc_key(this_ptr_conv, val_conv);
7631 }
7632
7633 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
7634         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7635         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7636         *ret = TxCreationKeys_get_broadcaster_delayed_payment_key(this_ptr_conv);
7637         return (long)ret;
7638 }
7639
7640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7641         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
7642         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7643         FREE((void*)val);
7644         return TxCreationKeys_set_broadcaster_delayed_payment_key(this_ptr_conv, val_conv);
7645 }
7646
7647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong per_commitment_point_arg, jlong revocation_key_arg, jlong broadcaster_htlc_key_arg, jlong countersignatory_htlc_key_arg, jlong broadcaster_delayed_payment_key_arg) {
7648         LDKPublicKey per_commitment_point_arg_conv = *(LDKPublicKey*)per_commitment_point_arg;
7649         FREE((void*)per_commitment_point_arg);
7650         LDKPublicKey revocation_key_arg_conv = *(LDKPublicKey*)revocation_key_arg;
7651         FREE((void*)revocation_key_arg);
7652         LDKPublicKey broadcaster_htlc_key_arg_conv = *(LDKPublicKey*)broadcaster_htlc_key_arg;
7653         FREE((void*)broadcaster_htlc_key_arg);
7654         LDKPublicKey countersignatory_htlc_key_arg_conv = *(LDKPublicKey*)countersignatory_htlc_key_arg;
7655         FREE((void*)countersignatory_htlc_key_arg);
7656         LDKPublicKey broadcaster_delayed_payment_key_arg_conv = *(LDKPublicKey*)broadcaster_delayed_payment_key_arg;
7657         FREE((void*)broadcaster_delayed_payment_key_arg);
7658         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
7659         *ret = TxCreationKeys_new(per_commitment_point_arg_conv, revocation_key_arg_conv, broadcaster_htlc_key_arg_conv, countersignatory_htlc_key_arg_conv, broadcaster_delayed_payment_key_arg_conv);
7660         DO_ASSERT(ret->is_owned);
7661         ret->is_owned = false;
7662         return (long)ret;
7663 }
7664
7665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
7666         LDKTxCreationKeys* obj_conv = (LDKTxCreationKeys*)obj;
7667         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7668         *ret = TxCreationKeys_write(obj_conv);
7669         return (long)ret;
7670 }
7671
7672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
7673         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7674         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
7675         *ret = TxCreationKeys_read(ser_conv);
7676         DO_ASSERT(ret->is_owned);
7677         ret->is_owned = false;
7678         return (long)ret;
7679 }
7680
7681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7682         LDKPreCalculatedTxCreationKeys this_ptr_conv = *(LDKPreCalculatedTxCreationKeys*)this_ptr;
7683         FREE((void*)this_ptr);
7684         this_ptr_conv.is_owned = true;
7685         return PreCalculatedTxCreationKeys_free(this_ptr_conv);
7686 }
7687
7688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
7689         LDKTxCreationKeys keys_conv = *(LDKTxCreationKeys*)keys;
7690         FREE((void*)keys);
7691         keys_conv.is_owned = true;
7692         LDKPreCalculatedTxCreationKeys* ret = MALLOC(sizeof(LDKPreCalculatedTxCreationKeys), "LDKPreCalculatedTxCreationKeys");
7693         *ret = PreCalculatedTxCreationKeys_new(keys_conv);
7694         DO_ASSERT(ret->is_owned);
7695         ret->is_owned = false;
7696         return (long)ret;
7697 }
7698
7699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
7700         LDKPreCalculatedTxCreationKeys* this_arg_conv = (LDKPreCalculatedTxCreationKeys*)this_arg;
7701         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
7702         *ret = PreCalculatedTxCreationKeys_trust_key_derivation(this_arg_conv);
7703         DO_ASSERT(ret->is_owned);
7704         ret->is_owned = false;
7705         return (long)ret;
7706 }
7707
7708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
7709         LDKPreCalculatedTxCreationKeys* this_arg_conv = (LDKPreCalculatedTxCreationKeys*)this_arg;
7710         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7711         *ret = PreCalculatedTxCreationKeys_per_commitment_point(this_arg_conv);
7712         return (long)ret;
7713 }
7714
7715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7716         LDKChannelPublicKeys this_ptr_conv = *(LDKChannelPublicKeys*)this_ptr;
7717         FREE((void*)this_ptr);
7718         this_ptr_conv.is_owned = true;
7719         return ChannelPublicKeys_free(this_ptr_conv);
7720 }
7721
7722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7723         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7724         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7725         *ret = ChannelPublicKeys_get_funding_pubkey(this_ptr_conv);
7726         return (long)ret;
7727 }
7728
7729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7730         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7731         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7732         FREE((void*)val);
7733         return ChannelPublicKeys_set_funding_pubkey(this_ptr_conv, val_conv);
7734 }
7735
7736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7737         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7738         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7739         *ret = ChannelPublicKeys_get_revocation_basepoint(this_ptr_conv);
7740         return (long)ret;
7741 }
7742
7743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7744         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7745         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7746         FREE((void*)val);
7747         return ChannelPublicKeys_set_revocation_basepoint(this_ptr_conv, val_conv);
7748 }
7749
7750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7751         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7752         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7753         *ret = ChannelPublicKeys_get_payment_point(this_ptr_conv);
7754         return (long)ret;
7755 }
7756
7757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7758         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7759         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7760         FREE((void*)val);
7761         return ChannelPublicKeys_set_payment_point(this_ptr_conv, val_conv);
7762 }
7763
7764 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7765         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7766         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7767         *ret = ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr_conv);
7768         return (long)ret;
7769 }
7770
7771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7772         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7773         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7774         FREE((void*)val);
7775         return ChannelPublicKeys_set_delayed_payment_basepoint(this_ptr_conv, val_conv);
7776 }
7777
7778 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7779         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7780         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
7781         *ret = ChannelPublicKeys_get_htlc_basepoint(this_ptr_conv);
7782         return (long)ret;
7783 }
7784
7785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7786         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
7787         LDKPublicKey val_conv = *(LDKPublicKey*)val;
7788         FREE((void*)val);
7789         return ChannelPublicKeys_set_htlc_basepoint(this_ptr_conv, val_conv);
7790 }
7791
7792 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv * _env, jclass _b, jlong funding_pubkey_arg, jlong revocation_basepoint_arg, jlong payment_point_arg, jlong delayed_payment_basepoint_arg, jlong htlc_basepoint_arg) {
7793         LDKPublicKey funding_pubkey_arg_conv = *(LDKPublicKey*)funding_pubkey_arg;
7794         FREE((void*)funding_pubkey_arg);
7795         LDKPublicKey revocation_basepoint_arg_conv = *(LDKPublicKey*)revocation_basepoint_arg;
7796         FREE((void*)revocation_basepoint_arg);
7797         LDKPublicKey payment_point_arg_conv = *(LDKPublicKey*)payment_point_arg;
7798         FREE((void*)payment_point_arg);
7799         LDKPublicKey delayed_payment_basepoint_arg_conv = *(LDKPublicKey*)delayed_payment_basepoint_arg;
7800         FREE((void*)delayed_payment_basepoint_arg);
7801         LDKPublicKey htlc_basepoint_arg_conv = *(LDKPublicKey*)htlc_basepoint_arg;
7802         FREE((void*)htlc_basepoint_arg);
7803         LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
7804         *ret = ChannelPublicKeys_new(funding_pubkey_arg_conv, revocation_basepoint_arg_conv, payment_point_arg_conv, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
7805         DO_ASSERT(ret->is_owned);
7806         ret->is_owned = false;
7807         return (long)ret;
7808 }
7809
7810 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
7811         LDKChannelPublicKeys* obj_conv = (LDKChannelPublicKeys*)obj;
7812         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7813         *ret = ChannelPublicKeys_write(obj_conv);
7814         return (long)ret;
7815 }
7816
7817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
7818         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7819         LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
7820         *ret = ChannelPublicKeys_read(ser_conv);
7821         DO_ASSERT(ret->is_owned);
7822         ret->is_owned = false;
7823         return (long)ret;
7824 }
7825
7826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv * _env, jclass _b, jlong per_commitment_point, jlong broadcaster_delayed_payment_base, jlong broadcaster_htlc_base, jlong countersignatory_revocation_base, jlong countersignatory_htlc_base) {
7827         LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
7828         FREE((void*)per_commitment_point);
7829         LDKPublicKey broadcaster_delayed_payment_base_conv = *(LDKPublicKey*)broadcaster_delayed_payment_base;
7830         FREE((void*)broadcaster_delayed_payment_base);
7831         LDKPublicKey broadcaster_htlc_base_conv = *(LDKPublicKey*)broadcaster_htlc_base;
7832         FREE((void*)broadcaster_htlc_base);
7833         LDKPublicKey countersignatory_revocation_base_conv = *(LDKPublicKey*)countersignatory_revocation_base;
7834         FREE((void*)countersignatory_revocation_base);
7835         LDKPublicKey countersignatory_htlc_base_conv = *(LDKPublicKey*)countersignatory_htlc_base;
7836         FREE((void*)countersignatory_htlc_base);
7837         LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
7838         *ret = TxCreationKeys_derive_new(per_commitment_point_conv, broadcaster_delayed_payment_base_conv, broadcaster_htlc_base_conv, countersignatory_revocation_base_conv, countersignatory_htlc_base_conv);
7839         return (long)ret;
7840 }
7841
7842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jlong revocation_key, jshort contest_delay, jlong broadcaster_delayed_payment_key) {
7843         LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
7844         FREE((void*)revocation_key);
7845         LDKPublicKey broadcaster_delayed_payment_key_conv = *(LDKPublicKey*)broadcaster_delayed_payment_key;
7846         FREE((void*)broadcaster_delayed_payment_key);
7847         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7848         *ret = get_revokeable_redeemscript(revocation_key_conv, contest_delay, broadcaster_delayed_payment_key_conv);
7849         return (long)ret;
7850 }
7851
7852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7853         LDKHTLCOutputInCommitment this_ptr_conv = *(LDKHTLCOutputInCommitment*)this_ptr;
7854         FREE((void*)this_ptr);
7855         this_ptr_conv.is_owned = true;
7856         return HTLCOutputInCommitment_free(this_ptr_conv);
7857 }
7858
7859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
7860         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7861         return HTLCOutputInCommitment_get_offered(this_ptr_conv);
7862 }
7863
7864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7865         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7866         return HTLCOutputInCommitment_set_offered(this_ptr_conv, val);
7867 }
7868
7869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7870         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7871         return HTLCOutputInCommitment_get_amount_msat(this_ptr_conv);
7872 }
7873
7874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7875         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7876         return HTLCOutputInCommitment_set_amount_msat(this_ptr_conv, val);
7877 }
7878
7879 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7880         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7881         return HTLCOutputInCommitment_get_cltv_expiry(this_ptr_conv);
7882 }
7883
7884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7885         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7886         return HTLCOutputInCommitment_set_cltv_expiry(this_ptr_conv, val);
7887 }
7888
7889 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7890         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7891         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7892         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(this_ptr_conv));
7893         return ret_arr;
7894 }
7895
7896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7897         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
7898         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
7899         FREE((void*)val);
7900         return HTLCOutputInCommitment_set_payment_hash(this_ptr_conv, val_conv);
7901 }
7902
7903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
7904         LDKHTLCOutputInCommitment* obj_conv = (LDKHTLCOutputInCommitment*)obj;
7905         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7906         *ret = HTLCOutputInCommitment_write(obj_conv);
7907         return (long)ret;
7908 }
7909
7910 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
7911         LDKu8slice ser_conv = *(LDKu8slice*)ser;
7912         LDKHTLCOutputInCommitment* ret = MALLOC(sizeof(LDKHTLCOutputInCommitment), "LDKHTLCOutputInCommitment");
7913         *ret = HTLCOutputInCommitment_read(ser_conv);
7914         DO_ASSERT(ret->is_owned);
7915         ret->is_owned = false;
7916         return (long)ret;
7917 }
7918
7919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
7920         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
7921         LDKTxCreationKeys* keys_conv = (LDKTxCreationKeys*)keys;
7922         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7923         *ret = get_htlc_redeemscript(htlc_conv, keys_conv);
7924         return (long)ret;
7925 }
7926
7927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jlong broadcaster, jlong countersignatory) {
7928         LDKPublicKey broadcaster_conv = *(LDKPublicKey*)broadcaster;
7929         FREE((void*)broadcaster);
7930         LDKPublicKey countersignatory_conv = *(LDKPublicKey*)countersignatory;
7931         FREE((void*)countersignatory);
7932         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
7933         *ret = make_funding_redeemscript(broadcaster_conv, countersignatory_conv);
7934         return (long)ret;
7935 }
7936
7937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort contest_delay, jlong htlc, jlong broadcaster_delayed_payment_key, jlong revocation_key) {
7938         unsigned char prev_hash_arr[32];
7939         (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
7940         unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
7941         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
7942         LDKPublicKey broadcaster_delayed_payment_key_conv = *(LDKPublicKey*)broadcaster_delayed_payment_key;
7943         FREE((void*)broadcaster_delayed_payment_key);
7944         LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
7945         FREE((void*)revocation_key);
7946         LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
7947         *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, htlc_conv, broadcaster_delayed_payment_key_conv, revocation_key_conv);
7948         return (long)ret;
7949 }
7950
7951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7952         LDKHolderCommitmentTransaction this_ptr_conv = *(LDKHolderCommitmentTransaction*)this_ptr;
7953         FREE((void*)this_ptr);
7954         this_ptr_conv.is_owned = true;
7955         return HolderCommitmentTransaction_free(this_ptr_conv);
7956 }
7957
7958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
7959         LDKHolderCommitmentTransaction* this_ptr_conv = (LDKHolderCommitmentTransaction*)this_ptr;
7960         LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
7961         *ret = HolderCommitmentTransaction_get_unsigned_tx(this_ptr_conv);
7962         return (long)ret;
7963 }
7964
7965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7966         LDKHolderCommitmentTransaction* this_ptr_conv = (LDKHolderCommitmentTransaction*)this_ptr;
7967         LDKTransaction val_conv = *(LDKTransaction*)val;
7968         FREE((void*)val);
7969         return HolderCommitmentTransaction_set_unsigned_tx(this_ptr_conv, val_conv);
7970 }
7971
7972 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
7973         LDKHolderCommitmentTransaction* this_ptr_conv = (LDKHolderCommitmentTransaction*)this_ptr;
7974         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
7975         *ret = HolderCommitmentTransaction_get_counterparty_sig(this_ptr_conv);
7976         return (long)ret;
7977 }
7978
7979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7980         LDKHolderCommitmentTransaction* this_ptr_conv = (LDKHolderCommitmentTransaction*)this_ptr;
7981         LDKSignature val_conv = *(LDKSignature*)val;
7982         FREE((void*)val);
7983         return HolderCommitmentTransaction_set_counterparty_sig(this_ptr_conv, val_conv);
7984 }
7985
7986 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7987         LDKHolderCommitmentTransaction* this_ptr_conv = (LDKHolderCommitmentTransaction*)this_ptr;
7988         return HolderCommitmentTransaction_get_feerate_per_kw(this_ptr_conv);
7989 }
7990
7991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7992         LDKHolderCommitmentTransaction* this_ptr_conv = (LDKHolderCommitmentTransaction*)this_ptr;
7993         return HolderCommitmentTransaction_set_feerate_per_kw(this_ptr_conv, val);
7994 }
7995
7996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7997         LDKHolderCommitmentTransaction* this_ptr_conv = (LDKHolderCommitmentTransaction*)this_ptr;
7998         LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
7999         FREE((void*)val);
8000         return HolderCommitmentTransaction_set_per_htlc(this_ptr_conv, val_conv);
8001 }
8002
8003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jlong counterparty_sig, jlong holder_funding_key, jlong counterparty_funding_key, jlong keys, jint feerate_per_kw, jlong htlc_data) {
8004         LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
8005         FREE((void*)unsigned_tx);
8006         LDKSignature counterparty_sig_conv = *(LDKSignature*)counterparty_sig;
8007         FREE((void*)counterparty_sig);
8008         LDKPublicKey holder_funding_key_conv = *(LDKPublicKey*)holder_funding_key;
8009         FREE((void*)holder_funding_key);
8010         LDKPublicKey counterparty_funding_key_conv = *(LDKPublicKey*)counterparty_funding_key;
8011         FREE((void*)counterparty_funding_key);
8012         LDKTxCreationKeys keys_conv = *(LDKTxCreationKeys*)keys;
8013         FREE((void*)keys);
8014         keys_conv.is_owned = true;
8015         LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
8016         FREE((void*)htlc_data);
8017         LDKHolderCommitmentTransaction* ret = MALLOC(sizeof(LDKHolderCommitmentTransaction), "LDKHolderCommitmentTransaction");
8018         *ret = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_conv, holder_funding_key_conv, counterparty_funding_key_conv, keys_conv, feerate_per_kw, htlc_data_conv);
8019         DO_ASSERT(ret->is_owned);
8020         ret->is_owned = false;
8021         return (long)ret;
8022 }
8023
8024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
8025         LDKHolderCommitmentTransaction* this_arg_conv = (LDKHolderCommitmentTransaction*)this_arg;
8026         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
8027         *ret = HolderCommitmentTransaction_trust_key_derivation(this_arg_conv);
8028         DO_ASSERT(ret->is_owned);
8029         ret->is_owned = false;
8030         return (long)ret;
8031 }
8032
8033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
8034         LDKHolderCommitmentTransaction* this_arg_conv = (LDKHolderCommitmentTransaction*)this_arg;
8035         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
8036         *ret = HolderCommitmentTransaction_txid(this_arg_conv);
8037         return (long)ret;
8038 }
8039
8040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1holder_1sig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jlong funding_redeemscript, jlong channel_value_satoshis) {
8041         LDKHolderCommitmentTransaction* this_arg_conv = (LDKHolderCommitmentTransaction*)this_arg;
8042         unsigned char funding_key_arr[32];
8043         (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
8044         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
8045         LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
8046         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
8047         *ret = HolderCommitmentTransaction_get_holder_sig(this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
8048         return (long)ret;
8049 }
8050
8051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1htlc_1sigs(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_base_key, jshort counterparty_selected_contest_delay) {
8052         LDKHolderCommitmentTransaction* this_arg_conv = (LDKHolderCommitmentTransaction*)this_arg;
8053         unsigned char htlc_base_key_arr[32];
8054         (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
8055         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
8056         LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
8057         *ret = HolderCommitmentTransaction_get_htlc_sigs(this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
8058         return (long)ret;
8059 }
8060
8061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
8062         LDKHolderCommitmentTransaction* obj_conv = (LDKHolderCommitmentTransaction*)obj;
8063         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8064         *ret = HolderCommitmentTransaction_write(obj_conv);
8065         return (long)ret;
8066 }
8067
8068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
8069         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8070         LDKHolderCommitmentTransaction* ret = MALLOC(sizeof(LDKHolderCommitmentTransaction), "LDKHolderCommitmentTransaction");
8071         *ret = HolderCommitmentTransaction_read(ser_conv);
8072         DO_ASSERT(ret->is_owned);
8073         ret->is_owned = false;
8074         return (long)ret;
8075 }
8076
8077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8078         LDKInitFeatures this_ptr_conv = *(LDKInitFeatures*)this_ptr;
8079         FREE((void*)this_ptr);
8080         this_ptr_conv.is_owned = true;
8081         return InitFeatures_free(this_ptr_conv);
8082 }
8083
8084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8085         LDKNodeFeatures this_ptr_conv = *(LDKNodeFeatures*)this_ptr;
8086         FREE((void*)this_ptr);
8087         this_ptr_conv.is_owned = true;
8088         return NodeFeatures_free(this_ptr_conv);
8089 }
8090
8091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8092         LDKChannelFeatures this_ptr_conv = *(LDKChannelFeatures*)this_ptr;
8093         FREE((void*)this_ptr);
8094         this_ptr_conv.is_owned = true;
8095         return ChannelFeatures_free(this_ptr_conv);
8096 }
8097
8098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8099         LDKRouteHop this_ptr_conv = *(LDKRouteHop*)this_ptr;
8100         FREE((void*)this_ptr);
8101         this_ptr_conv.is_owned = true;
8102         return RouteHop_free(this_ptr_conv);
8103 }
8104
8105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8106         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8107         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
8108         *ret = RouteHop_get_pubkey(this_ptr_conv);
8109         return (long)ret;
8110 }
8111
8112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8113         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8114         LDKPublicKey val_conv = *(LDKPublicKey*)val;
8115         FREE((void*)val);
8116         return RouteHop_set_pubkey(this_ptr_conv, val_conv);
8117 }
8118
8119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8120         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8121         LDKNodeFeatures* ret = MALLOC(sizeof(LDKNodeFeatures), "LDKNodeFeatures");
8122         *ret = RouteHop_get_node_features(this_ptr_conv);
8123         DO_ASSERT(ret->is_owned);
8124         ret->is_owned = false;
8125         return (long)ret;
8126 }
8127
8128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8129         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8130         LDKNodeFeatures val_conv = *(LDKNodeFeatures*)val;
8131         FREE((void*)val);
8132         val_conv.is_owned = true;
8133         return RouteHop_set_node_features(this_ptr_conv, val_conv);
8134 }
8135
8136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8137         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8138         return RouteHop_get_short_channel_id(this_ptr_conv);
8139 }
8140
8141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8142         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8143         return RouteHop_set_short_channel_id(this_ptr_conv, val);
8144 }
8145
8146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8147         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8148         LDKChannelFeatures* ret = MALLOC(sizeof(LDKChannelFeatures), "LDKChannelFeatures");
8149         *ret = RouteHop_get_channel_features(this_ptr_conv);
8150         DO_ASSERT(ret->is_owned);
8151         ret->is_owned = false;
8152         return (long)ret;
8153 }
8154
8155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8156         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8157         LDKChannelFeatures val_conv = *(LDKChannelFeatures*)val;
8158         FREE((void*)val);
8159         val_conv.is_owned = true;
8160         return RouteHop_set_channel_features(this_ptr_conv, val_conv);
8161 }
8162
8163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8164         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8165         return RouteHop_get_fee_msat(this_ptr_conv);
8166 }
8167
8168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8169         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8170         return RouteHop_set_fee_msat(this_ptr_conv, val);
8171 }
8172
8173 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8174         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8175         return RouteHop_get_cltv_expiry_delta(this_ptr_conv);
8176 }
8177
8178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8179         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
8180         return RouteHop_set_cltv_expiry_delta(this_ptr_conv, val);
8181 }
8182
8183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv * _env, jclass _b, jlong pubkey_arg, jlong node_features_arg, jlong short_channel_id_arg, jlong channel_features_arg, jlong fee_msat_arg, jint cltv_expiry_delta_arg) {
8184         LDKPublicKey pubkey_arg_conv = *(LDKPublicKey*)pubkey_arg;
8185         FREE((void*)pubkey_arg);
8186         LDKNodeFeatures node_features_arg_conv = *(LDKNodeFeatures*)node_features_arg;
8187         FREE((void*)node_features_arg);
8188         node_features_arg_conv.is_owned = true;
8189         LDKChannelFeatures channel_features_arg_conv = *(LDKChannelFeatures*)channel_features_arg;
8190         FREE((void*)channel_features_arg);
8191         channel_features_arg_conv.is_owned = true;
8192         LDKRouteHop* ret = MALLOC(sizeof(LDKRouteHop), "LDKRouteHop");
8193         *ret = RouteHop_new(pubkey_arg_conv, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
8194         DO_ASSERT(ret->is_owned);
8195         ret->is_owned = false;
8196         return (long)ret;
8197 }
8198
8199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8200         LDKRoute this_ptr_conv = *(LDKRoute*)this_ptr;
8201         FREE((void*)this_ptr);
8202         this_ptr_conv.is_owned = true;
8203         return Route_free(this_ptr_conv);
8204 }
8205
8206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8207         LDKRoute* this_ptr_conv = (LDKRoute*)this_ptr;
8208         LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
8209         FREE((void*)val);
8210         return Route_set_paths(this_ptr_conv, val_conv);
8211 }
8212
8213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
8214         LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
8215         FREE((void*)paths_arg);
8216         LDKRoute* ret = MALLOC(sizeof(LDKRoute), "LDKRoute");
8217         *ret = Route_new(paths_arg_conv);
8218         DO_ASSERT(ret->is_owned);
8219         ret->is_owned = false;
8220         return (long)ret;
8221 }
8222
8223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
8224         LDKRoute* obj_conv = (LDKRoute*)obj;
8225         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8226         *ret = Route_write(obj_conv);
8227         return (long)ret;
8228 }
8229
8230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
8231         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8232         LDKRoute* ret = MALLOC(sizeof(LDKRoute), "LDKRoute");
8233         *ret = Route_read(ser_conv);
8234         DO_ASSERT(ret->is_owned);
8235         ret->is_owned = false;
8236         return (long)ret;
8237 }
8238
8239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8240         LDKRouteHint this_ptr_conv = *(LDKRouteHint*)this_ptr;
8241         FREE((void*)this_ptr);
8242         this_ptr_conv.is_owned = true;
8243         return RouteHint_free(this_ptr_conv);
8244 }
8245
8246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8247         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8248         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
8249         *ret = RouteHint_get_src_node_id(this_ptr_conv);
8250         return (long)ret;
8251 }
8252
8253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8254         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8255         LDKPublicKey val_conv = *(LDKPublicKey*)val;
8256         FREE((void*)val);
8257         return RouteHint_set_src_node_id(this_ptr_conv, val_conv);
8258 }
8259
8260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8261         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8262         return RouteHint_get_short_channel_id(this_ptr_conv);
8263 }
8264
8265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8266         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8267         return RouteHint_set_short_channel_id(this_ptr_conv, val);
8268 }
8269
8270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
8271         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8272         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
8273         *ret = RouteHint_get_fees(this_ptr_conv);
8274         DO_ASSERT(ret->is_owned);
8275         ret->is_owned = false;
8276         return (long)ret;
8277 }
8278
8279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8280         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8281         LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
8282         FREE((void*)val);
8283         val_conv.is_owned = true;
8284         return RouteHint_set_fees(this_ptr_conv, val_conv);
8285 }
8286
8287 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8288         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8289         return RouteHint_get_cltv_expiry_delta(this_ptr_conv);
8290 }
8291
8292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8293         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8294         return RouteHint_set_cltv_expiry_delta(this_ptr_conv, val);
8295 }
8296
8297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8298         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8299         return RouteHint_get_htlc_minimum_msat(this_ptr_conv);
8300 }
8301
8302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8303         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
8304         return RouteHint_set_htlc_minimum_msat(this_ptr_conv, val);
8305 }
8306
8307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv * _env, jclass _b, jlong src_node_id_arg, jlong short_channel_id_arg, jlong fees_arg, jshort cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
8308         LDKPublicKey src_node_id_arg_conv = *(LDKPublicKey*)src_node_id_arg;
8309         FREE((void*)src_node_id_arg);
8310         LDKRoutingFees fees_arg_conv = *(LDKRoutingFees*)fees_arg;
8311         FREE((void*)fees_arg);
8312         fees_arg_conv.is_owned = true;
8313         LDKRouteHint* ret = MALLOC(sizeof(LDKRouteHint), "LDKRouteHint");
8314         *ret = RouteHint_new(src_node_id_arg_conv, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
8315         DO_ASSERT(ret->is_owned);
8316         ret->is_owned = false;
8317         return (long)ret;
8318 }
8319
8320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv * _env, jclass _b, jlong our_node_id, jlong network, jlong target, jlong first_hops, jlong last_hops, jlong final_value_msat, jint final_cltv, jlong logger) {
8321         LDKPublicKey our_node_id_conv = *(LDKPublicKey*)our_node_id;
8322         FREE((void*)our_node_id);
8323         LDKNetworkGraph* network_conv = (LDKNetworkGraph*)network;
8324         LDKPublicKey target_conv = *(LDKPublicKey*)target;
8325         FREE((void*)target);
8326         LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
8327         LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
8328         FREE((void*)last_hops);
8329         LDKLogger logger_conv = *(LDKLogger*)logger;
8330         if (logger_conv.free == LDKLogger_JCalls_free) {
8331                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8332                 LDKLogger_JCalls_clone(logger_conv.this_arg);
8333         }
8334         LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
8335         *ret = get_route(our_node_id_conv, network_conv, target_conv, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
8336         return (long)ret;
8337 }
8338
8339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8340         LDKNetworkGraph this_ptr_conv = *(LDKNetworkGraph*)this_ptr;
8341         FREE((void*)this_ptr);
8342         this_ptr_conv.is_owned = true;
8343         return NetworkGraph_free(this_ptr_conv);
8344 }
8345
8346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8347         LDKLockedNetworkGraph this_ptr_conv = *(LDKLockedNetworkGraph*)this_ptr;
8348         FREE((void*)this_ptr);
8349         this_ptr_conv.is_owned = true;
8350         return LockedNetworkGraph_free(this_ptr_conv);
8351 }
8352
8353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8354         LDKNetGraphMsgHandler this_ptr_conv = *(LDKNetGraphMsgHandler*)this_ptr;
8355         FREE((void*)this_ptr);
8356         this_ptr_conv.is_owned = true;
8357         return NetGraphMsgHandler_free(this_ptr_conv);
8358 }
8359
8360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
8361         LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
8362         LDKLogger logger_conv = *(LDKLogger*)logger;
8363         if (logger_conv.free == LDKLogger_JCalls_free) {
8364                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8365                 LDKLogger_JCalls_clone(logger_conv.this_arg);
8366         }
8367         LDKNetGraphMsgHandler* ret = MALLOC(sizeof(LDKNetGraphMsgHandler), "LDKNetGraphMsgHandler");
8368         *ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
8369         DO_ASSERT(ret->is_owned);
8370         ret->is_owned = false;
8371         return (long)ret;
8372 }
8373
8374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
8375         LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
8376         LDKLogger logger_conv = *(LDKLogger*)logger;
8377         if (logger_conv.free == LDKLogger_JCalls_free) {
8378                 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8379                 LDKLogger_JCalls_clone(logger_conv.this_arg);
8380         }
8381         LDKNetworkGraph network_graph_conv = *(LDKNetworkGraph*)network_graph;
8382         FREE((void*)network_graph);
8383         network_graph_conv.is_owned = true;
8384         LDKNetGraphMsgHandler* ret = MALLOC(sizeof(LDKNetGraphMsgHandler), "LDKNetGraphMsgHandler");
8385         *ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
8386         DO_ASSERT(ret->is_owned);
8387         ret->is_owned = false;
8388         return (long)ret;
8389 }
8390
8391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
8392         LDKNetGraphMsgHandler* this_arg_conv = (LDKNetGraphMsgHandler*)this_arg;
8393         LDKLockedNetworkGraph* ret = MALLOC(sizeof(LDKLockedNetworkGraph), "LDKLockedNetworkGraph");
8394         *ret = NetGraphMsgHandler_read_locked_graph(this_arg_conv);
8395         DO_ASSERT(ret->is_owned);
8396         ret->is_owned = false;
8397         return (long)ret;
8398 }
8399
8400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
8401         LDKLockedNetworkGraph* this_arg_conv = (LDKLockedNetworkGraph*)this_arg;
8402         LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
8403         *ret = LockedNetworkGraph_graph(this_arg_conv);
8404         DO_ASSERT(ret->is_owned);
8405         ret->is_owned = false;
8406         return (long)ret;
8407 }
8408
8409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
8410         LDKNetGraphMsgHandler* this_arg_conv = (LDKNetGraphMsgHandler*)this_arg;
8411         LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8412         *ret = NetGraphMsgHandler_as_RoutingMessageHandler(this_arg_conv);
8413         return (long)ret;
8414 }
8415
8416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8417         LDKDirectionalChannelInfo this_ptr_conv = *(LDKDirectionalChannelInfo*)this_ptr;
8418         FREE((void*)this_ptr);
8419         this_ptr_conv.is_owned = true;
8420         return DirectionalChannelInfo_free(this_ptr_conv);
8421 }
8422
8423 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
8424         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8425         return DirectionalChannelInfo_get_last_update(this_ptr_conv);
8426 }
8427
8428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8429         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8430         return DirectionalChannelInfo_set_last_update(this_ptr_conv, val);
8431 }
8432
8433 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
8434         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8435         return DirectionalChannelInfo_get_enabled(this_ptr_conv);
8436 }
8437
8438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8439         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8440         return DirectionalChannelInfo_set_enabled(this_ptr_conv, val);
8441 }
8442
8443 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8444         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8445         return DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr_conv);
8446 }
8447
8448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8449         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8450         return DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr_conv, val);
8451 }
8452
8453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8454         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8455         return DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr_conv);
8456 }
8457
8458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8459         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8460         return DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr_conv, val);
8461 }
8462
8463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
8464         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8465         LDKChannelUpdate* ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
8466         *ret = DirectionalChannelInfo_get_last_update_message(this_ptr_conv);
8467         DO_ASSERT(ret->is_owned);
8468         ret->is_owned = false;
8469         return (long)ret;
8470 }
8471
8472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8473         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
8474         LDKChannelUpdate val_conv = *(LDKChannelUpdate*)val;
8475         FREE((void*)val);
8476         val_conv.is_owned = true;
8477         return DirectionalChannelInfo_set_last_update_message(this_ptr_conv, val_conv);
8478 }
8479
8480 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
8481         LDKDirectionalChannelInfo* obj_conv = (LDKDirectionalChannelInfo*)obj;
8482         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8483         *ret = DirectionalChannelInfo_write(obj_conv);
8484         return (long)ret;
8485 }
8486
8487 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
8488         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8489         LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
8490         *ret = DirectionalChannelInfo_read(ser_conv);
8491         DO_ASSERT(ret->is_owned);
8492         ret->is_owned = false;
8493         return (long)ret;
8494 }
8495
8496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8497         LDKChannelInfo this_ptr_conv = *(LDKChannelInfo*)this_ptr;
8498         FREE((void*)this_ptr);
8499         this_ptr_conv.is_owned = true;
8500         return ChannelInfo_free(this_ptr_conv);
8501 }
8502
8503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8504         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8505         LDKChannelFeatures* ret = MALLOC(sizeof(LDKChannelFeatures), "LDKChannelFeatures");
8506         *ret = ChannelInfo_get_features(this_ptr_conv);
8507         DO_ASSERT(ret->is_owned);
8508         ret->is_owned = false;
8509         return (long)ret;
8510 }
8511
8512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8513         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8514         LDKChannelFeatures val_conv = *(LDKChannelFeatures*)val;
8515         FREE((void*)val);
8516         val_conv.is_owned = true;
8517         return ChannelInfo_set_features(this_ptr_conv, val_conv);
8518 }
8519
8520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
8521         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8522         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
8523         *ret = ChannelInfo_get_node_one(this_ptr_conv);
8524         return (long)ret;
8525 }
8526
8527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8528         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8529         LDKPublicKey val_conv = *(LDKPublicKey*)val;
8530         FREE((void*)val);
8531         return ChannelInfo_set_node_one(this_ptr_conv, val_conv);
8532 }
8533
8534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
8535         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8536         LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
8537         *ret = ChannelInfo_get_one_to_two(this_ptr_conv);
8538         DO_ASSERT(ret->is_owned);
8539         ret->is_owned = false;
8540         return (long)ret;
8541 }
8542
8543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8544         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8545         LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
8546         FREE((void*)val);
8547         val_conv.is_owned = true;
8548         return ChannelInfo_set_one_to_two(this_ptr_conv, val_conv);
8549 }
8550
8551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
8552         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8553         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
8554         *ret = ChannelInfo_get_node_two(this_ptr_conv);
8555         return (long)ret;
8556 }
8557
8558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8559         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8560         LDKPublicKey val_conv = *(LDKPublicKey*)val;
8561         FREE((void*)val);
8562         return ChannelInfo_set_node_two(this_ptr_conv, val_conv);
8563 }
8564
8565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
8566         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8567         LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
8568         *ret = ChannelInfo_get_two_to_one(this_ptr_conv);
8569         DO_ASSERT(ret->is_owned);
8570         ret->is_owned = false;
8571         return (long)ret;
8572 }
8573
8574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8575         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8576         LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
8577         FREE((void*)val);
8578         val_conv.is_owned = true;
8579         return ChannelInfo_set_two_to_one(this_ptr_conv, val_conv);
8580 }
8581
8582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
8583         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8584         LDKChannelAnnouncement* ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
8585         *ret = ChannelInfo_get_announcement_message(this_ptr_conv);
8586         DO_ASSERT(ret->is_owned);
8587         ret->is_owned = false;
8588         return (long)ret;
8589 }
8590
8591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8592         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
8593         LDKChannelAnnouncement val_conv = *(LDKChannelAnnouncement*)val;
8594         FREE((void*)val);
8595         val_conv.is_owned = true;
8596         return ChannelInfo_set_announcement_message(this_ptr_conv, val_conv);
8597 }
8598
8599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
8600         LDKChannelInfo* obj_conv = (LDKChannelInfo*)obj;
8601         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8602         *ret = ChannelInfo_write(obj_conv);
8603         return (long)ret;
8604 }
8605
8606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
8607         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8608         LDKChannelInfo* ret = MALLOC(sizeof(LDKChannelInfo), "LDKChannelInfo");
8609         *ret = ChannelInfo_read(ser_conv);
8610         DO_ASSERT(ret->is_owned);
8611         ret->is_owned = false;
8612         return (long)ret;
8613 }
8614
8615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8616         LDKRoutingFees this_ptr_conv = *(LDKRoutingFees*)this_ptr;
8617         FREE((void*)this_ptr);
8618         this_ptr_conv.is_owned = true;
8619         return RoutingFees_free(this_ptr_conv);
8620 }
8621
8622 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8623         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
8624         return RoutingFees_get_base_msat(this_ptr_conv);
8625 }
8626
8627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8628         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
8629         return RoutingFees_set_base_msat(this_ptr_conv, val);
8630 }
8631
8632 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8633         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
8634         return RoutingFees_get_proportional_millionths(this_ptr_conv);
8635 }
8636
8637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8638         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
8639         return RoutingFees_set_proportional_millionths(this_ptr_conv, val);
8640 }
8641
8642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
8643         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
8644         *ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
8645         DO_ASSERT(ret->is_owned);
8646         ret->is_owned = false;
8647         return (long)ret;
8648 }
8649
8650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
8651         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8652         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
8653         *ret = RoutingFees_read(ser_conv);
8654         DO_ASSERT(ret->is_owned);
8655         ret->is_owned = false;
8656         return (long)ret;
8657 }
8658
8659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
8660         LDKRoutingFees* obj_conv = (LDKRoutingFees*)obj;
8661         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8662         *ret = RoutingFees_write(obj_conv);
8663         return (long)ret;
8664 }
8665
8666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8667         LDKNodeAnnouncementInfo this_ptr_conv = *(LDKNodeAnnouncementInfo*)this_ptr;
8668         FREE((void*)this_ptr);
8669         this_ptr_conv.is_owned = true;
8670         return NodeAnnouncementInfo_free(this_ptr_conv);
8671 }
8672
8673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8674         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8675         LDKNodeFeatures* ret = MALLOC(sizeof(LDKNodeFeatures), "LDKNodeFeatures");
8676         *ret = NodeAnnouncementInfo_get_features(this_ptr_conv);
8677         DO_ASSERT(ret->is_owned);
8678         ret->is_owned = false;
8679         return (long)ret;
8680 }
8681
8682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8683         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8684         LDKNodeFeatures val_conv = *(LDKNodeFeatures*)val;
8685         FREE((void*)val);
8686         val_conv.is_owned = true;
8687         return NodeAnnouncementInfo_set_features(this_ptr_conv, val_conv);
8688 }
8689
8690 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
8691         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8692         return NodeAnnouncementInfo_get_last_update(this_ptr_conv);
8693 }
8694
8695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8696         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8697         return NodeAnnouncementInfo_set_last_update(this_ptr_conv, val);
8698 }
8699
8700 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
8701         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8702         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
8703         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(this_ptr_conv));
8704         return ret_arr;
8705 }
8706
8707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8708         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8709         LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
8710         FREE((void*)val);
8711         return NodeAnnouncementInfo_set_rgb(this_ptr_conv, val_conv);
8712 }
8713
8714 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
8715         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8716         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8717         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(this_ptr_conv));
8718         return ret_arr;
8719 }
8720
8721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8722         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8723         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
8724         FREE((void*)val);
8725         return NodeAnnouncementInfo_set_alias(this_ptr_conv, val_conv);
8726 }
8727
8728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8729         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8730         LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
8731         FREE((void*)val);
8732         return NodeAnnouncementInfo_set_addresses(this_ptr_conv, val_conv);
8733 }
8734
8735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
8736         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8737         LDKNodeAnnouncement* ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
8738         *ret = NodeAnnouncementInfo_get_announcement_message(this_ptr_conv);
8739         DO_ASSERT(ret->is_owned);
8740         ret->is_owned = false;
8741         return (long)ret;
8742 }
8743
8744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8745         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
8746         LDKNodeAnnouncement val_conv = *(LDKNodeAnnouncement*)val;
8747         FREE((void*)val);
8748         val_conv.is_owned = true;
8749         return NodeAnnouncementInfo_set_announcement_message(this_ptr_conv, val_conv);
8750 }
8751
8752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv * _env, jclass _b, jlong features_arg, jint last_update_arg, jlong rgb_arg, jlong alias_arg, jlong addresses_arg, jlong announcement_message_arg) {
8753         LDKNodeFeatures features_arg_conv = *(LDKNodeFeatures*)features_arg;
8754         FREE((void*)features_arg);
8755         features_arg_conv.is_owned = true;
8756         LDKThreeBytes rgb_arg_conv = *(LDKThreeBytes*)rgb_arg;
8757         FREE((void*)rgb_arg);
8758         LDKThirtyTwoBytes alias_arg_conv = *(LDKThirtyTwoBytes*)alias_arg;
8759         FREE((void*)alias_arg);
8760         LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
8761         FREE((void*)addresses_arg);
8762         LDKNodeAnnouncement announcement_message_arg_conv = *(LDKNodeAnnouncement*)announcement_message_arg;
8763         FREE((void*)announcement_message_arg);
8764         announcement_message_arg_conv.is_owned = true;
8765         LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
8766         *ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_conv, alias_arg_conv, addresses_arg_conv, announcement_message_arg_conv);
8767         DO_ASSERT(ret->is_owned);
8768         ret->is_owned = false;
8769         return (long)ret;
8770 }
8771
8772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
8773         LDKNodeAnnouncementInfo* obj_conv = (LDKNodeAnnouncementInfo*)obj;
8774         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8775         *ret = NodeAnnouncementInfo_write(obj_conv);
8776         return (long)ret;
8777 }
8778
8779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
8780         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8781         LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
8782         *ret = NodeAnnouncementInfo_read(ser_conv);
8783         DO_ASSERT(ret->is_owned);
8784         ret->is_owned = false;
8785         return (long)ret;
8786 }
8787
8788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8789         LDKNodeInfo this_ptr_conv = *(LDKNodeInfo*)this_ptr;
8790         FREE((void*)this_ptr);
8791         this_ptr_conv.is_owned = true;
8792         return NodeInfo_free(this_ptr_conv);
8793 }
8794
8795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8796         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
8797         LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
8798         FREE((void*)val);
8799         return NodeInfo_set_channels(this_ptr_conv, val_conv);
8800 }
8801
8802 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
8803         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
8804         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
8805         *ret = NodeInfo_get_lowest_inbound_channel_fees(this_ptr_conv);
8806         DO_ASSERT(ret->is_owned);
8807         ret->is_owned = false;
8808         return (long)ret;
8809 }
8810
8811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8812         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
8813         LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
8814         FREE((void*)val);
8815         val_conv.is_owned = true;
8816         return NodeInfo_set_lowest_inbound_channel_fees(this_ptr_conv, val_conv);
8817 }
8818
8819 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
8820         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
8821         LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
8822         *ret = NodeInfo_get_announcement_info(this_ptr_conv);
8823         DO_ASSERT(ret->is_owned);
8824         ret->is_owned = false;
8825         return (long)ret;
8826 }
8827
8828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8829         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
8830         LDKNodeAnnouncementInfo val_conv = *(LDKNodeAnnouncementInfo*)val;
8831         FREE((void*)val);
8832         val_conv.is_owned = true;
8833         return NodeInfo_set_announcement_info(this_ptr_conv, val_conv);
8834 }
8835
8836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv * _env, jclass _b, jlong channels_arg, jlong lowest_inbound_channel_fees_arg, jlong announcement_info_arg) {
8837         LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
8838         FREE((void*)channels_arg);
8839         LDKRoutingFees lowest_inbound_channel_fees_arg_conv = *(LDKRoutingFees*)lowest_inbound_channel_fees_arg;
8840         FREE((void*)lowest_inbound_channel_fees_arg);
8841         lowest_inbound_channel_fees_arg_conv.is_owned = true;
8842         LDKNodeAnnouncementInfo announcement_info_arg_conv = *(LDKNodeAnnouncementInfo*)announcement_info_arg;
8843         FREE((void*)announcement_info_arg);
8844         announcement_info_arg_conv.is_owned = true;
8845         LDKNodeInfo* ret = MALLOC(sizeof(LDKNodeInfo), "LDKNodeInfo");
8846         *ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
8847         DO_ASSERT(ret->is_owned);
8848         ret->is_owned = false;
8849         return (long)ret;
8850 }
8851
8852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
8853         LDKNodeInfo* obj_conv = (LDKNodeInfo*)obj;
8854         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8855         *ret = NodeInfo_write(obj_conv);
8856         return (long)ret;
8857 }
8858
8859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
8860         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8861         LDKNodeInfo* ret = MALLOC(sizeof(LDKNodeInfo), "LDKNodeInfo");
8862         *ret = NodeInfo_read(ser_conv);
8863         DO_ASSERT(ret->is_owned);
8864         ret->is_owned = false;
8865         return (long)ret;
8866 }
8867
8868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
8869         LDKNetworkGraph* obj_conv = (LDKNetworkGraph*)obj;
8870         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
8871         *ret = NetworkGraph_write(obj_conv);
8872         return (long)ret;
8873 }
8874
8875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
8876         LDKu8slice ser_conv = *(LDKu8slice*)ser;
8877         LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
8878         *ret = NetworkGraph_read(ser_conv);
8879         DO_ASSERT(ret->is_owned);
8880         ret->is_owned = false;
8881         return (long)ret;
8882 }
8883
8884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
8885         LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
8886         *ret = NetworkGraph_new();
8887         DO_ASSERT(ret->is_owned);
8888         ret->is_owned = false;
8889         return (long)ret;
8890 }
8891
8892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong short_channel_id, jboolean is_permanent) {
8893         LDKNetworkGraph* this_arg_conv = (LDKNetworkGraph*)this_arg;
8894         return NetworkGraph_close_channel_from_update(this_arg_conv, short_channel_id, is_permanent);
8895 }
8896