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