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