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