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