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