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