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