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