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