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