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