1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
9 // Always run a, then assert it is true:
10 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
11 // Assert a is true or do nothing
12 #define CHECK(a) DO_ASSERT(a)
14 // Running a leak check across all the allocations and frees of the JDK is a mess,
15 // so instead we implement our own naive leak checker here, relying on the -wrap
16 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
17 // and free'd in Rust or C across the generated bindings shared library.
21 static mtx_t allocation_mtx;
23 void __attribute__((constructor)) init_mtx() {
24 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
28 typedef struct allocation {
29 struct allocation* next;
31 const char* struct_name;
36 static allocation* allocation_ll = NULL;
38 void* __real_malloc(size_t len);
39 void* __real_calloc(size_t nmemb, size_t len);
40 static void new_allocation(void* res, const char* struct_name, size_t len) {
41 allocation* new_alloc = __real_malloc(sizeof(allocation));
43 new_alloc->struct_name = struct_name;
44 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
45 new_alloc->alloc_len = len;
46 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
47 new_alloc->next = allocation_ll;
48 allocation_ll = new_alloc;
49 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
51 static void* MALLOC(size_t len, const char* struct_name) {
52 void* res = __real_malloc(len);
53 new_allocation(res, struct_name, len);
56 void __real_free(void* ptr);
57 static void alloc_freed(void* ptr) {
59 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
60 allocation* it = allocation_ll;
61 while (it->ptr != ptr) {
62 p = it; it = it->next;
64 fprintf(stderr, "Tried to free unknown pointer %p at:\n", ptr);
66 int bt_len = backtrace(bt, BT_MAX);
67 backtrace_symbols_fd(bt, bt_len, STDERR_FILENO);
68 fprintf(stderr, "\n\n");
69 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
70 return; // addrsan should catch malloc-unknown and print more info than we have
73 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
74 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
75 DO_ASSERT(it->ptr == ptr);
78 static void FREE(void* ptr) {
79 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
84 void* __wrap_malloc(size_t len) {
85 void* res = __real_malloc(len);
86 new_allocation(res, "malloc call", len);
89 void* __wrap_calloc(size_t nmemb, size_t len) {
90 void* res = __real_calloc(nmemb, len);
91 new_allocation(res, "calloc call", len);
94 void __wrap_free(void* ptr) {
95 if (ptr == NULL) return;
100 void* __real_realloc(void* ptr, size_t newlen);
101 void* __wrap_realloc(void* ptr, size_t len) {
102 if (ptr != NULL) alloc_freed(ptr);
103 void* res = __real_realloc(ptr, len);
104 new_allocation(res, "realloc call", len);
107 void __wrap_reallocarray(void* ptr, size_t new_sz) {
108 // Rust doesn't seem to use reallocarray currently
112 void __attribute__((destructor)) check_leaks() {
113 size_t alloc_count = 0;
114 size_t alloc_size = 0;
115 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
116 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
117 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
118 fprintf(stderr, "\n\n");
120 alloc_size += a->alloc_len;
122 fprintf(stderr, "%lu allocations remained for %lu bytes.\n", alloc_count, alloc_size);
123 DO_ASSERT(allocation_ll == NULL);
126 static jmethodID ordinal_meth = NULL;
127 static jmethodID slicedef_meth = NULL;
128 static jclass slicedef_cls = NULL;
129 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
130 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
131 CHECK(ordinal_meth != NULL);
132 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
133 CHECK(slicedef_meth != NULL);
134 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
135 CHECK(slicedef_cls != NULL);
138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
139 return *((bool*)ptr);
141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
142 return *((long*)ptr);
144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
147 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
148 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
149 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
152 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
153 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
154 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
155 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
158 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
159 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
160 vec->datalen = (*env)->GetArrayLength(env, bytes);
161 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
162 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
165 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
166 LDKTransaction *txdata = (LDKTransaction*)ptr;
168 slice.data = txdata->data;
169 slice.datalen = txdata->datalen;
170 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
172 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
173 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
174 txdata->datalen = (*env)->GetArrayLength(env, bytes);
175 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
176 txdata->data_is_owned = false;
177 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
181 LDKTransaction *tx = (LDKTransaction*)ptr;
182 tx->data_is_owned = true;
183 Transaction_free(*tx);
186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
187 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
188 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
189 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
190 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
191 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
192 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
193 return (long)vec->datalen;
195 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
196 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
197 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
198 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
199 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
200 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
201 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
207 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
208 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
209 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
210 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
212 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
213 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
214 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
216 typedef jlongArray int64_tArray;
217 typedef jbyteArray int8_tArray;
219 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
220 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
221 char* err_buf = MALLOC(len + 1, "str conv buf");
222 memcpy(err_buf, chars, len);
224 jstring err_conv = (*env)->NewStringUTF(env, chars);
228 static jclass arr_of_B_clz = NULL;
229 static jclass arr_of_J_clz = NULL;
230 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
231 arr_of_B_clz = (*env)->FindClass(env, "[B");
232 CHECK(arr_of_B_clz != NULL);
233 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
234 arr_of_J_clz = (*env)->FindClass(env, "[J");
235 CHECK(arr_of_J_clz != NULL);
236 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
238 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
239 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
240 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
241 case 0: return LDKAccessError_UnknownChain;
242 case 1: return LDKAccessError_UnknownTx;
246 static jclass LDKAccessError_class = NULL;
247 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
248 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
249 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv *env, jclass clz) {
250 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
251 CHECK(LDKAccessError_class != NULL);
252 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
253 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
254 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
255 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
257 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
259 case LDKAccessError_UnknownChain:
260 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
261 case LDKAccessError_UnknownTx:
262 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
267 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
268 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
269 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
270 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
274 static jclass LDKChannelMonitorUpdateErr_class = NULL;
275 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
276 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
277 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
278 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
279 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
280 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
281 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
282 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
283 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
285 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
287 case LDKChannelMonitorUpdateErr_TemporaryFailure:
288 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
289 case LDKChannelMonitorUpdateErr_PermanentFailure:
290 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
295 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
296 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
297 case 0: return LDKConfirmationTarget_Background;
298 case 1: return LDKConfirmationTarget_Normal;
299 case 2: return LDKConfirmationTarget_HighPriority;
303 static jclass LDKConfirmationTarget_class = NULL;
304 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
305 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
306 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
307 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv *env, jclass clz) {
308 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
309 CHECK(LDKConfirmationTarget_class != NULL);
310 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
311 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
312 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
313 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
314 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
315 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
317 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
319 case LDKConfirmationTarget_Background:
320 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
321 case LDKConfirmationTarget_Normal:
322 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
323 case LDKConfirmationTarget_HighPriority:
324 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
329 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
330 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
331 case 0: return LDKLevel_Off;
332 case 1: return LDKLevel_Error;
333 case 2: return LDKLevel_Warn;
334 case 3: return LDKLevel_Info;
335 case 4: return LDKLevel_Debug;
336 case 5: return LDKLevel_Trace;
340 static jclass LDKLevel_class = NULL;
341 static jfieldID LDKLevel_LDKLevel_Off = NULL;
342 static jfieldID LDKLevel_LDKLevel_Error = NULL;
343 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
344 static jfieldID LDKLevel_LDKLevel_Info = NULL;
345 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
346 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
347 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv *env, jclass clz) {
348 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
349 CHECK(LDKLevel_class != NULL);
350 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
351 CHECK(LDKLevel_LDKLevel_Off != NULL);
352 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
353 CHECK(LDKLevel_LDKLevel_Error != NULL);
354 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
355 CHECK(LDKLevel_LDKLevel_Warn != NULL);
356 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
357 CHECK(LDKLevel_LDKLevel_Info != NULL);
358 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
359 CHECK(LDKLevel_LDKLevel_Debug != NULL);
360 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
361 CHECK(LDKLevel_LDKLevel_Trace != NULL);
363 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
366 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
368 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
370 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
372 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
374 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
376 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
381 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
382 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
383 case 0: return LDKNetwork_Bitcoin;
384 case 1: return LDKNetwork_Testnet;
385 case 2: return LDKNetwork_Regtest;
389 static jclass LDKNetwork_class = NULL;
390 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
391 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
392 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
393 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv *env, jclass clz) {
394 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
395 CHECK(LDKNetwork_class != NULL);
396 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
397 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
398 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
399 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
400 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
401 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
403 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
405 case LDKNetwork_Bitcoin:
406 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
407 case LDKNetwork_Testnet:
408 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
409 case LDKNetwork_Regtest:
410 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
415 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
416 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
417 case 0: return LDKSecp256k1Error_IncorrectSignature;
418 case 1: return LDKSecp256k1Error_InvalidMessage;
419 case 2: return LDKSecp256k1Error_InvalidPublicKey;
420 case 3: return LDKSecp256k1Error_InvalidSignature;
421 case 4: return LDKSecp256k1Error_InvalidSecretKey;
422 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
423 case 6: return LDKSecp256k1Error_InvalidTweak;
424 case 7: return LDKSecp256k1Error_TweakCheckFailed;
425 case 8: return LDKSecp256k1Error_NotEnoughMemory;
429 static jclass LDKSecp256k1Error_class = NULL;
430 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
431 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
432 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
433 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
434 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
435 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
436 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
437 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
438 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
439 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, jclass clz) {
440 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
441 CHECK(LDKSecp256k1Error_class != NULL);
442 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
443 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
444 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
445 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
446 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
447 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
448 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
449 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
450 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
451 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
452 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
453 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
454 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
455 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
456 LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/LDKSecp256k1Error;");
457 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
458 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
459 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
461 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
463 case LDKSecp256k1Error_IncorrectSignature:
464 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
465 case LDKSecp256k1Error_InvalidMessage:
466 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
467 case LDKSecp256k1Error_InvalidPublicKey:
468 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
469 case LDKSecp256k1Error_InvalidSignature:
470 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
471 case LDKSecp256k1Error_InvalidSecretKey:
472 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
473 case LDKSecp256k1Error_InvalidRecoveryId:
474 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
475 case LDKSecp256k1Error_InvalidTweak:
476 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
477 case LDKSecp256k1Error_TweakCheckFailed:
478 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
479 case LDKSecp256k1Error_NotEnoughMemory:
480 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
485 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
486 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
487 ret->datalen = (*env)->GetArrayLength(env, elems);
488 if (ret->datalen == 0) {
491 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
492 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
493 for (size_t i = 0; i < ret->datalen; i++) {
494 ret->data[i] = java_elems[i];
496 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
500 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
501 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
502 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
506 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
512 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
516 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)(ptr & ~1);
519 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
520 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
521 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
522 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
523 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
524 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
526 LDKSpendableOutputDescriptor_StaticOutput_class =
527 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
528 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
529 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
530 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
531 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
532 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
533 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
534 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
535 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
536 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
537 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
538 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
539 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
540 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
542 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
543 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
545 case LDKSpendableOutputDescriptor_StaticOutput: {
546 LDKOutPoint outpoint_var = obj->static_output.outpoint;
547 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
548 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
549 long outpoint_ref = (long)outpoint_var.inner & ~1;
550 long output_ref = ((long)&obj->static_output.output) | 1;
551 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
553 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
554 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
555 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
556 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
557 long outpoint_ref = (long)outpoint_var.inner & ~1;
558 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
559 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
560 long output_ref = ((long)&obj->dynamic_output_p2wsh.output) | 1;
561 long key_derivation_params_ref = (long)(&obj->dynamic_output_p2wsh.key_derivation_params) | 1;
562 int8_tArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
563 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
564 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, (long)output_ref, key_derivation_params_ref, revocation_pubkey_arr);
566 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
567 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
568 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
569 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
570 long outpoint_ref = (long)outpoint_var.inner & ~1;
571 long output_ref = ((long)&obj->static_output_counterparty_payment.output) | 1;
572 long key_derivation_params_ref = (long)(&obj->static_output_counterparty_payment.key_derivation_params) | 1;
573 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, (long)output_ref, key_derivation_params_ref);
578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
579 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
580 ret->datalen = (*env)->GetArrayLength(env, elems);
581 if (ret->datalen == 0) {
584 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
585 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
586 for (size_t i = 0; i < ret->datalen; i++) {
587 int64_t arr_elem = java_elems[i];
588 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
589 FREE((void*)arr_elem);
590 ret->data[i] = arr_elem_conv;
592 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
596 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
597 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
598 for (size_t i = 0; i < ret.datalen; i++) {
599 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
603 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
604 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
605 static jclass LDKErrorAction_IgnoreError_class = NULL;
606 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
607 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
608 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
610 LDKErrorAction_DisconnectPeer_class =
611 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
612 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
613 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
614 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
615 LDKErrorAction_IgnoreError_class =
616 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
617 CHECK(LDKErrorAction_IgnoreError_class != NULL);
618 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
619 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
620 LDKErrorAction_SendErrorMessage_class =
621 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
622 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
623 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
624 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
626 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
627 LDKErrorAction *obj = (LDKErrorAction*)ptr;
629 case LDKErrorAction_DisconnectPeer: {
630 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
631 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
632 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
633 long msg_ref = (long)msg_var.inner & ~1;
634 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
636 case LDKErrorAction_IgnoreError: {
637 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
639 case LDKErrorAction_SendErrorMessage: {
640 LDKErrorMessage msg_var = obj->send_error_message.msg;
641 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
642 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
643 long msg_ref = (long)msg_var.inner & ~1;
644 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
649 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
650 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
651 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
652 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
653 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
654 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
656 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
657 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
658 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
659 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
660 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
661 LDKHTLCFailChannelUpdate_ChannelClosed_class =
662 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
663 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
664 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
665 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
666 LDKHTLCFailChannelUpdate_NodeFailure_class =
667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
668 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
669 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
670 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
672 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
673 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
675 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
676 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
677 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
678 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
679 long msg_ref = (long)msg_var.inner & ~1;
680 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
682 case LDKHTLCFailChannelUpdate_ChannelClosed: {
683 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
685 case LDKHTLCFailChannelUpdate_NodeFailure: {
686 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
687 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
688 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
693 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
694 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
695 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
696 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
697 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
698 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
699 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
700 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
701 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
702 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
703 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
704 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
705 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
706 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
707 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
708 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
709 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
710 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
711 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
712 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
713 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
714 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
715 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
716 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
717 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
718 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
719 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
720 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
721 static jclass LDKMessageSendEvent_HandleError_class = NULL;
722 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
723 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
724 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
725 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
726 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
727 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
728 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
730 LDKMessageSendEvent_SendAcceptChannel_class =
731 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
732 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
733 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
734 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
735 LDKMessageSendEvent_SendOpenChannel_class =
736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
737 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
738 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
739 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
740 LDKMessageSendEvent_SendFundingCreated_class =
741 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
742 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
743 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
744 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
745 LDKMessageSendEvent_SendFundingSigned_class =
746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
747 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
748 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
749 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
750 LDKMessageSendEvent_SendFundingLocked_class =
751 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
752 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
753 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
754 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
755 LDKMessageSendEvent_SendAnnouncementSignatures_class =
756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
757 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
758 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
759 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
760 LDKMessageSendEvent_UpdateHTLCs_class =
761 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
762 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
763 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
764 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
765 LDKMessageSendEvent_SendRevokeAndACK_class =
766 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
767 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
768 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
769 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
770 LDKMessageSendEvent_SendClosingSigned_class =
771 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
772 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
773 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
774 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
775 LDKMessageSendEvent_SendShutdown_class =
776 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
777 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
778 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
779 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
780 LDKMessageSendEvent_SendChannelReestablish_class =
781 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
782 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
783 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
784 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
785 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
787 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
788 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
789 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
790 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
792 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
793 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
794 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
795 LDKMessageSendEvent_BroadcastChannelUpdate_class =
796 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
797 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
798 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
799 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
800 LDKMessageSendEvent_HandleError_class =
801 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
802 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
803 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
804 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
805 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
806 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
807 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
808 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
809 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
810 LDKMessageSendEvent_SendChannelRangeQuery_class =
811 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
812 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
813 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
814 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
815 LDKMessageSendEvent_SendShortIdsQuery_class =
816 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
817 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
818 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
819 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
821 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
822 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
824 case LDKMessageSendEvent_SendAcceptChannel: {
825 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
826 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
827 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
828 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
829 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
830 long msg_ref = (long)msg_var.inner & ~1;
831 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
833 case LDKMessageSendEvent_SendOpenChannel: {
834 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
835 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
836 LDKOpenChannel msg_var = obj->send_open_channel.msg;
837 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
838 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
839 long msg_ref = (long)msg_var.inner & ~1;
840 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
842 case LDKMessageSendEvent_SendFundingCreated: {
843 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
844 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
845 LDKFundingCreated msg_var = obj->send_funding_created.msg;
846 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
847 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
848 long msg_ref = (long)msg_var.inner & ~1;
849 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
851 case LDKMessageSendEvent_SendFundingSigned: {
852 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
853 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
854 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
855 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
856 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
857 long msg_ref = (long)msg_var.inner & ~1;
858 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
860 case LDKMessageSendEvent_SendFundingLocked: {
861 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
862 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
863 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
864 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
865 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
866 long msg_ref = (long)msg_var.inner & ~1;
867 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
869 case LDKMessageSendEvent_SendAnnouncementSignatures: {
870 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
871 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
872 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
873 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
874 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
875 long msg_ref = (long)msg_var.inner & ~1;
876 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
878 case LDKMessageSendEvent_UpdateHTLCs: {
879 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
880 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
881 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
882 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
883 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
884 long updates_ref = (long)updates_var.inner & ~1;
885 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
887 case LDKMessageSendEvent_SendRevokeAndACK: {
888 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
889 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
890 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
891 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
892 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
893 long msg_ref = (long)msg_var.inner & ~1;
894 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
896 case LDKMessageSendEvent_SendClosingSigned: {
897 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
898 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
899 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
900 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
901 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
902 long msg_ref = (long)msg_var.inner & ~1;
903 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
905 case LDKMessageSendEvent_SendShutdown: {
906 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
907 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
908 LDKShutdown msg_var = obj->send_shutdown.msg;
909 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
910 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
911 long msg_ref = (long)msg_var.inner & ~1;
912 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
914 case LDKMessageSendEvent_SendChannelReestablish: {
915 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
916 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
917 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
918 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
919 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
920 long msg_ref = (long)msg_var.inner & ~1;
921 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
923 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
924 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
925 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
926 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
927 long msg_ref = (long)msg_var.inner & ~1;
928 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
929 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
930 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
931 long update_msg_ref = (long)update_msg_var.inner & ~1;
932 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
934 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
935 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
936 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 long msg_ref = (long)msg_var.inner & ~1;
939 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
941 case LDKMessageSendEvent_BroadcastChannelUpdate: {
942 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
943 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
944 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 long msg_ref = (long)msg_var.inner & ~1;
946 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
948 case LDKMessageSendEvent_HandleError: {
949 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
950 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
951 long action_ref = ((long)&obj->handle_error.action) | 1;
952 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
954 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
955 long update_ref = ((long)&obj->payment_failure_network_update.update) | 1;
956 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
958 case LDKMessageSendEvent_SendChannelRangeQuery: {
959 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
960 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
961 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
962 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
963 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
964 long msg_ref = (long)msg_var.inner & ~1;
965 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
967 case LDKMessageSendEvent_SendShortIdsQuery: {
968 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
969 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
970 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
971 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
972 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
973 long msg_ref = (long)msg_var.inner & ~1;
974 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
980 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
981 ret->datalen = (*env)->GetArrayLength(env, elems);
982 if (ret->datalen == 0) {
985 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
986 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
987 for (size_t i = 0; i < ret->datalen; i++) {
988 int64_t arr_elem = java_elems[i];
989 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
990 FREE((void*)arr_elem);
991 ret->data[i] = arr_elem_conv;
993 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
997 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
998 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
999 for (size_t i = 0; i < ret.datalen; i++) {
1000 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1004 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1005 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1006 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1007 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1008 static jclass LDKEvent_PaymentReceived_class = NULL;
1009 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1010 static jclass LDKEvent_PaymentSent_class = NULL;
1011 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1012 static jclass LDKEvent_PaymentFailed_class = NULL;
1013 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1014 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1015 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1016 static jclass LDKEvent_SpendableOutputs_class = NULL;
1017 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1019 LDKEvent_FundingGenerationReady_class =
1020 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1021 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1022 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1023 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1024 LDKEvent_FundingBroadcastSafe_class =
1025 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1026 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1027 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1028 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1029 LDKEvent_PaymentReceived_class =
1030 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1031 CHECK(LDKEvent_PaymentReceived_class != NULL);
1032 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1033 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1034 LDKEvent_PaymentSent_class =
1035 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1036 CHECK(LDKEvent_PaymentSent_class != NULL);
1037 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1038 CHECK(LDKEvent_PaymentSent_meth != NULL);
1039 LDKEvent_PaymentFailed_class =
1040 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1041 CHECK(LDKEvent_PaymentFailed_class != NULL);
1042 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1043 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1044 LDKEvent_PendingHTLCsForwardable_class =
1045 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1046 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1047 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1048 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1049 LDKEvent_SpendableOutputs_class =
1050 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1051 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1052 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1053 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1055 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1056 LDKEvent *obj = (LDKEvent*)ptr;
1058 case LDKEvent_FundingGenerationReady: {
1059 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1060 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1061 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1062 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1063 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1064 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
1066 case LDKEvent_FundingBroadcastSafe: {
1067 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1068 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1069 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1070 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1071 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1073 case LDKEvent_PaymentReceived: {
1074 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1075 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1076 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1077 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1078 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1080 case LDKEvent_PaymentSent: {
1081 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1082 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1083 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1085 case LDKEvent_PaymentFailed: {
1086 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1087 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1088 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1090 case LDKEvent_PendingHTLCsForwardable: {
1091 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1093 case LDKEvent_SpendableOutputs: {
1094 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1095 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
1096 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
1097 for (size_t b = 0; b < outputs_var.datalen; b++) {
1098 long arr_conv_27_ref = ((long)&outputs_var.data[b]) | 1;
1099 outputs_arr_ptr[b] = arr_conv_27_ref;
1101 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
1102 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1108 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1109 ret->datalen = (*env)->GetArrayLength(env, elems);
1110 if (ret->datalen == 0) {
1113 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1114 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1115 for (size_t i = 0; i < ret->datalen; i++) {
1116 int64_t arr_elem = java_elems[i];
1117 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
1118 FREE((void*)arr_elem);
1119 ret->data[i] = arr_elem_conv;
1121 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1125 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1126 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1127 for (size_t i = 0; i < ret.datalen; i++) {
1128 ret.data[i] = Event_clone(&orig->data[i]);
1132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, intptr_t a, int8_tArray b) {
1133 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1135 LDKTransaction b_ref;
1136 b_ref.datalen = (*env)->GetArrayLength(env, b);
1137 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1138 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1139 b_ref.data_is_owned = false;
1143 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1144 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1148 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1149 LDKTransaction b_var = tuple->b;
1150 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1151 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1155 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1156 ret->datalen = (*env)->GetArrayLength(env, elems);
1157 if (ret->datalen == 0) {
1160 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1161 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1162 for (size_t i = 0; i < ret->datalen; i++) {
1163 int64_t arr_elem = java_elems[i];
1164 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1165 FREE((void*)arr_elem);
1166 ret->data[i] = arr_elem_conv;
1168 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1173 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1176 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1177 CHECK(val->result_ok);
1178 return *val->contents.result;
1180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1181 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1182 CHECK(!val->result_ok);
1183 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1187 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1188 ret->datalen = (*env)->GetArrayLength(env, elems);
1189 if (ret->datalen == 0) {
1192 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1193 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1194 for (size_t i = 0; i < ret->datalen; i++) {
1195 int64_t arr_elem = java_elems[i];
1196 LDKMonitorEvent arr_elem_conv;
1197 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1198 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1199 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
1200 ret->data[i] = arr_elem_conv;
1202 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1206 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1207 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1208 for (size_t i = 0; i < ret.datalen; i++) {
1209 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1214 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1217 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1218 CHECK(val->result_ok);
1219 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1220 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1221 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1222 long res_ref = (long)res_var.inner & ~1;
1225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1226 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
1227 CHECK(!val->result_ok);
1228 LDKDecodeError err_var = (*val->contents.err);
1229 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1230 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1231 long err_ref = (long)err_var.inner & ~1;
1234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1235 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1238 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1239 CHECK(val->result_ok);
1240 return *val->contents.result;
1242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1243 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
1244 CHECK(!val->result_ok);
1245 LDKMonitorUpdateError err_var = (*val->contents.err);
1246 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1247 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1248 long err_ref = (long)err_var.inner & ~1;
1251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1252 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1254 a_conv.inner = (void*)(a & (~1));
1255 a_conv.is_owned = (a & 1) || (a == 0);
1256 a_conv = OutPoint_clone(&a_conv);
1259 b_ref.datalen = (*env)->GetArrayLength(env, b);
1260 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1261 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1266 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1267 LDKOutPoint a_var = tuple->a;
1268 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1269 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1270 long a_ref = (long)a_var.inner & ~1;
1273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1274 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
1275 LDKCVec_u8Z b_var = tuple->b;
1276 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1277 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
1281 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1283 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
1288 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1289 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1293 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
1294 long b_ref = ((long)&tuple->b) | 1;
1297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1298 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1299 ret->datalen = (*env)->GetArrayLength(env, elems);
1300 if (ret->datalen == 0) {
1303 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1304 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1305 for (size_t i = 0; i < ret->datalen; i++) {
1306 int64_t arr_elem = java_elems[i];
1307 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
1308 FREE((void*)arr_elem);
1309 ret->data[i] = arr_elem_conv;
1311 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1315 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1316 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1317 for (size_t i = 0; i < ret.datalen; i++) {
1318 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
1323 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1324 LDKThirtyTwoBytes a_ref;
1325 CHECK((*env)->GetArrayLength(env, a) == 32);
1326 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1328 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1329 b_constr.datalen = (*env)->GetArrayLength(env, b);
1330 if (b_constr.datalen > 0)
1331 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1333 b_constr.data = NULL;
1334 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
1335 for (size_t a = 0; a < b_constr.datalen; a++) {
1336 int64_t arr_conv_26 = b_vals[a];
1337 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
1338 FREE((void*)arr_conv_26);
1339 b_constr.data[a] = arr_conv_26_conv;
1341 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
1345 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1346 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1347 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1348 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1351 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1352 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
1353 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1354 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
1355 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
1356 for (size_t a = 0; a < b_var.datalen; a++) {
1357 long arr_conv_26_ref = (long)(&b_var.data[a]) | 1;
1358 b_arr_ptr[a] = arr_conv_26_ref;
1360 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
1363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1364 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1365 ret->datalen = (*env)->GetArrayLength(env, elems);
1366 if (ret->datalen == 0) {
1369 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1370 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1371 for (size_t i = 0; i < ret->datalen; i++) {
1372 int64_t arr_elem = java_elems[i];
1373 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
1374 FREE((void*)arr_elem);
1375 ret->data[i] = arr_elem_conv;
1377 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
1382 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1384 CHECK((*env)->GetArrayLength(env, a) == 64);
1385 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
1387 LDKCVec_SignatureZ b_constr;
1388 b_constr.datalen = (*env)->GetArrayLength(env, b);
1389 if (b_constr.datalen > 0)
1390 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1392 b_constr.data = NULL;
1393 for (size_t i = 0; i < b_constr.datalen; i++) {
1394 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
1395 LDKSignature arr_conv_8_ref;
1396 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
1397 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
1398 b_constr.data[i] = arr_conv_8_ref;
1403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1404 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1405 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
1406 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
1409 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1410 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
1411 LDKCVec_SignatureZ b_var = tuple->b;
1412 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
1414 for (size_t i = 0; i < b_var.datalen; i++) {
1415 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
1416 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
1417 (*env)->SetObjectArrayElement(env, b_arr, i, arr_conv_8_arr);
1421 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1422 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1425 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1426 CHECK(val->result_ok);
1427 long res_ref = (long)(&(*val->contents.result)) | 1;
1430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1431 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
1432 CHECK(!val->result_ok);
1433 return *val->contents.err;
1435 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1436 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1438 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1439 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1440 CHECK(val->result_ok);
1441 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
1442 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
1445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1446 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
1447 CHECK(!val->result_ok);
1448 return *val->contents.err;
1450 typedef struct LDKChannelKeys_JCalls {
1451 atomic_size_t refcnt;
1454 jmethodID get_per_commitment_point_meth;
1455 jmethodID release_commitment_secret_meth;
1456 jmethodID key_derivation_params_meth;
1457 jmethodID sign_counterparty_commitment_meth;
1458 jmethodID sign_holder_commitment_and_htlcs_meth;
1459 jmethodID sign_justice_transaction_meth;
1460 jmethodID sign_counterparty_htlc_transaction_meth;
1461 jmethodID sign_closing_transaction_meth;
1462 jmethodID sign_channel_announcement_meth;
1463 jmethodID ready_channel_meth;
1464 jmethodID write_meth;
1465 } LDKChannelKeys_JCalls;
1466 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1467 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1468 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1470 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1471 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1475 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1476 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1478 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1479 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1481 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1482 LDKPublicKey arg_ref;
1483 CHECK((*env)->GetArrayLength(env, arg) == 33);
1484 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
1487 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1488 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1490 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1491 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1493 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1494 LDKThirtyTwoBytes arg_ref;
1495 CHECK((*env)->GetArrayLength(env, arg) == 32);
1496 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
1499 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1500 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1502 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1503 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1505 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1506 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)ret) & ~1);
1507 ret_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)ret);
1510 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1511 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1513 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1514 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1515 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1516 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1517 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1518 long commitment_tx_ref = (long)commitment_tx_var.inner;
1519 if (commitment_tx_var.is_owned) {
1520 commitment_tx_ref |= 1;
1522 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1524 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1525 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1526 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1529 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1530 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1532 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1533 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1534 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1535 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1536 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1537 long commitment_tx_ref = (long)commitment_tx_var.inner;
1538 if (commitment_tx_var.is_owned) {
1539 commitment_tx_ref |= 1;
1541 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1543 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
1544 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
1545 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1548 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) {
1549 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1551 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1552 LDKTransaction justice_tx_var = justice_tx;
1553 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
1554 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1555 Transaction_free(justice_tx_var);
1556 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1557 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1558 LDKHTLCOutputInCommitment htlc_var = *htlc;
1559 htlc_var = HTLCOutputInCommitment_clone(htlc);
1560 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1561 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1562 long htlc_ref = (long)htlc_var.inner;
1563 if (htlc_var.is_owned) {
1566 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1568 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1569 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1570 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1573 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1574 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1576 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1577 LDKTransaction htlc_tx_var = htlc_tx;
1578 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
1579 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
1580 Transaction_free(htlc_tx_var);
1581 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1582 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1583 LDKHTLCOutputInCommitment htlc_var = *htlc;
1584 htlc_var = HTLCOutputInCommitment_clone(htlc);
1585 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1586 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1587 long htlc_ref = (long)htlc_var.inner;
1588 if (htlc_var.is_owned) {
1591 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1593 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref);
1594 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1595 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1598 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1599 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1601 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1602 LDKTransaction closing_tx_var = closing_tx;
1603 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
1604 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
1605 Transaction_free(closing_tx_var);
1606 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1608 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
1609 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1610 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1613 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1614 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1616 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1617 LDKUnsignedChannelAnnouncement msg_var = *msg;
1618 msg_var = UnsignedChannelAnnouncement_clone(msg);
1619 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1620 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1621 long msg_ref = (long)msg_var.inner;
1622 if (msg_var.is_owned) {
1625 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1627 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
1628 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
1629 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1632 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1633 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1635 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1636 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1637 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1638 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1639 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1640 long channel_parameters_ref = (long)channel_parameters_var.inner;
1641 if (channel_parameters_var.is_owned) {
1642 channel_parameters_ref |= 1;
1644 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1646 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
1648 LDKCVec_u8Z write_jcall(const void* this_arg) {
1649 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1651 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1652 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1654 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
1655 LDKCVec_u8Z arg_ref;
1656 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
1657 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1658 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
1661 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1662 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1663 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1664 return (void*) this_arg;
1666 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1667 jclass c = (*env)->GetObjectClass(env, o);
1669 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1670 atomic_init(&calls->refcnt, 1);
1671 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1672 calls->o = (*env)->NewWeakGlobalRef(env, o);
1673 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1674 CHECK(calls->get_per_commitment_point_meth != NULL);
1675 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1676 CHECK(calls->release_commitment_secret_meth != NULL);
1677 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1678 CHECK(calls->key_derivation_params_meth != NULL);
1679 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
1680 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1681 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
1682 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
1683 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
1684 CHECK(calls->sign_justice_transaction_meth != NULL);
1685 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
1686 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1687 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
1688 CHECK(calls->sign_closing_transaction_meth != NULL);
1689 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1690 CHECK(calls->sign_channel_announcement_meth != NULL);
1691 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
1692 CHECK(calls->ready_channel_meth != NULL);
1693 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
1694 CHECK(calls->write_meth != NULL);
1696 LDKChannelPublicKeys pubkeys_conv;
1697 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1698 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1699 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1701 LDKChannelKeys ret = {
1702 .this_arg = (void*) calls,
1703 .get_per_commitment_point = get_per_commitment_point_jcall,
1704 .release_commitment_secret = release_commitment_secret_jcall,
1705 .key_derivation_params = key_derivation_params_jcall,
1706 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1707 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_jcall,
1708 .sign_justice_transaction = sign_justice_transaction_jcall,
1709 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1710 .sign_closing_transaction = sign_closing_transaction_jcall,
1711 .sign_channel_announcement = sign_channel_announcement_jcall,
1712 .ready_channel = ready_channel_jcall,
1713 .clone = LDKChannelKeys_JCalls_clone,
1714 .write = write_jcall,
1715 .free = LDKChannelKeys_JCalls_free,
1716 .pubkeys = pubkeys_conv,
1717 .set_pubkeys = NULL,
1721 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1722 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1723 *res_ptr = LDKChannelKeys_init(env, clz, o, pubkeys);
1724 return (long)res_ptr;
1726 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
1727 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1728 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
1729 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1733 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
1734 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1735 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
1736 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv *env, jclass clz, int64_t this_arg) {
1741 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1742 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1743 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1744 return (long)ret_ref;
1747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
1748 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1749 LDKCommitmentTransaction commitment_tx_conv;
1750 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1751 commitment_tx_conv.is_owned = false;
1752 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1753 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1754 return (long)ret_conv;
1757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
1758 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1759 LDKHolderCommitmentTransaction commitment_tx_conv;
1760 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1761 commitment_tx_conv.is_owned = false;
1762 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1763 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
1764 return (long)ret_conv;
1767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
1768 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1769 LDKTransaction justice_tx_ref;
1770 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
1771 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1772 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
1773 justice_tx_ref.data_is_owned = true;
1774 unsigned char per_commitment_key_arr[32];
1775 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
1776 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
1777 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1778 LDKHTLCOutputInCommitment htlc_conv;
1779 htlc_conv.inner = (void*)(htlc & (~1));
1780 htlc_conv.is_owned = false;
1781 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1782 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1783 return (long)ret_conv;
1786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
1787 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1788 LDKTransaction htlc_tx_ref;
1789 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
1790 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1791 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
1792 htlc_tx_ref.data_is_owned = true;
1793 LDKPublicKey per_commitment_point_ref;
1794 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
1795 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1796 LDKHTLCOutputInCommitment htlc_conv;
1797 htlc_conv.inner = (void*)(htlc & (~1));
1798 htlc_conv.is_owned = false;
1799 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1800 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_ref, input, amount, per_commitment_point_ref, &htlc_conv);
1801 return (long)ret_conv;
1804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
1805 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1806 LDKTransaction closing_tx_ref;
1807 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
1808 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1809 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
1810 closing_tx_ref.data_is_owned = true;
1811 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1812 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1813 return (long)ret_conv;
1816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
1817 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1818 LDKUnsignedChannelAnnouncement msg_conv;
1819 msg_conv.inner = (void*)(msg & (~1));
1820 msg_conv.is_owned = false;
1821 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1822 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1823 return (long)ret_conv;
1826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
1827 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1828 LDKChannelTransactionParameters channel_parameters_conv;
1829 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1830 channel_parameters_conv.is_owned = false;
1831 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1834 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
1835 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1836 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1837 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
1838 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
1839 CVec_u8Z_free(arg_var);
1843 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1844 if (this_arg->set_pubkeys != NULL)
1845 this_arg->set_pubkeys(this_arg);
1846 return this_arg->pubkeys;
1848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
1849 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1850 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1851 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1852 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1853 long ret_ref = (long)ret_var.inner;
1854 if (ret_var.is_owned) {
1860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
1861 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1862 LDKThirtyTwoBytes a_ref;
1863 CHECK((*env)->GetArrayLength(env, a) == 32);
1864 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1866 LDKChannelMonitor b_conv;
1867 b_conv.inner = (void*)(b & (~1));
1868 b_conv.is_owned = (b & 1) || (b == 0);
1869 b_conv = ChannelMonitor_clone(&b_conv);
1873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1874 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1875 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1876 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1880 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
1881 LDKChannelMonitor b_var = tuple->b;
1882 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1883 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1884 long b_ref = (long)b_var.inner & ~1;
1887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1888 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1891 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1892 CHECK(val->result_ok);
1893 long res_ref = (long)(&(*val->contents.result)) | 1;
1896 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1897 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
1898 CHECK(!val->result_ok);
1899 LDKDecodeError err_var = (*val->contents.err);
1900 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1901 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1902 long err_ref = (long)err_var.inner & ~1;
1905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1906 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1909 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1910 CHECK(val->result_ok);
1911 long res_ref = ((long)&(*val->contents.result)) | 1;
1914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1915 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
1916 CHECK(!val->result_ok);
1917 LDKDecodeError err_var = (*val->contents.err);
1918 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1919 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1920 long err_ref = (long)err_var.inner & ~1;
1923 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1924 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
1926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1927 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)(arg & ~1);
1928 CHECK(val->result_ok);
1929 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1930 *ret = ChannelKeys_clone(&(*val->contents.result));
1933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1934 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)(arg & ~1);
1935 CHECK(!val->result_ok);
1936 LDKDecodeError err_var = (*val->contents.err);
1937 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1938 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1939 long err_ref = (long)err_var.inner & ~1;
1942 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1943 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
1945 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1946 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
1947 CHECK(val->result_ok);
1948 LDKInMemoryChannelKeys res_var = (*val->contents.result);
1949 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1950 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1951 long res_ref = (long)res_var.inner & ~1;
1954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1955 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(arg & ~1);
1956 CHECK(!val->result_ok);
1957 LDKDecodeError err_var = (*val->contents.err);
1958 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1959 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1960 long err_ref = (long)err_var.inner & ~1;
1963 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1964 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1967 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1968 CHECK(val->result_ok);
1969 long res_ref = ((long)&(*val->contents.result)) | 1;
1970 return (long)res_ref;
1972 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1973 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1974 CHECK(!val->result_ok);
1975 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1978 static jclass LDKAPIError_APIMisuseError_class = NULL;
1979 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
1980 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
1981 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
1982 static jclass LDKAPIError_RouteError_class = NULL;
1983 static jmethodID LDKAPIError_RouteError_meth = NULL;
1984 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
1985 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
1986 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
1987 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
1988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
1989 LDKAPIError_APIMisuseError_class =
1990 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
1991 CHECK(LDKAPIError_APIMisuseError_class != NULL);
1992 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
1993 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
1994 LDKAPIError_FeeRateTooHigh_class =
1995 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
1996 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
1997 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
1998 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
1999 LDKAPIError_RouteError_class =
2000 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2001 CHECK(LDKAPIError_RouteError_class != NULL);
2002 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2003 CHECK(LDKAPIError_RouteError_meth != NULL);
2004 LDKAPIError_ChannelUnavailable_class =
2005 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2006 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2007 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2008 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2009 LDKAPIError_MonitorUpdateFailed_class =
2010 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2011 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2012 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2013 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2015 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2016 LDKAPIError *obj = (LDKAPIError*)ptr;
2018 case LDKAPIError_APIMisuseError: {
2019 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2020 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2021 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2022 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2024 case LDKAPIError_FeeRateTooHigh: {
2025 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2026 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2027 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2028 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2030 case LDKAPIError_RouteError: {
2031 LDKStr err_str = obj->route_error.err;
2032 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2033 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2035 case LDKAPIError_ChannelUnavailable: {
2036 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2037 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2038 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2039 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2041 case LDKAPIError_MonitorUpdateFailed: {
2042 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2048 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2051 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2052 CHECK(val->result_ok);
2053 return *val->contents.result;
2055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2056 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
2057 CHECK(!val->result_ok);
2058 long err_ref = ((long)&(*val->contents.err)) | 1;
2061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2062 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2063 ret->datalen = (*env)->GetArrayLength(env, elems);
2064 if (ret->datalen == 0) {
2067 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2068 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2069 for (size_t i = 0; i < ret->datalen; i++) {
2070 int64_t arr_elem = java_elems[i];
2071 LDKChannelDetails arr_elem_conv;
2072 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2073 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2074 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2075 ret->data[i] = arr_elem_conv;
2077 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2081 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2082 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2083 for (size_t i = 0; i < ret.datalen; i++) {
2084 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2088 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2089 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2092 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2093 CHECK(val->result_ok);
2094 return *val->contents.result;
2096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2097 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
2098 CHECK(!val->result_ok);
2099 LDKPaymentSendFailure err_var = (*val->contents.err);
2100 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2101 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2102 long err_ref = (long)err_var.inner & ~1;
2105 static jclass LDKNetAddress_IPv4_class = NULL;
2106 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2107 static jclass LDKNetAddress_IPv6_class = NULL;
2108 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2109 static jclass LDKNetAddress_OnionV2_class = NULL;
2110 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2111 static jclass LDKNetAddress_OnionV3_class = NULL;
2112 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
2114 LDKNetAddress_IPv4_class =
2115 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2116 CHECK(LDKNetAddress_IPv4_class != NULL);
2117 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2118 CHECK(LDKNetAddress_IPv4_meth != NULL);
2119 LDKNetAddress_IPv6_class =
2120 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2121 CHECK(LDKNetAddress_IPv6_class != NULL);
2122 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2123 CHECK(LDKNetAddress_IPv6_meth != NULL);
2124 LDKNetAddress_OnionV2_class =
2125 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2126 CHECK(LDKNetAddress_OnionV2_class != NULL);
2127 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2128 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2129 LDKNetAddress_OnionV3_class =
2130 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2131 CHECK(LDKNetAddress_OnionV3_class != NULL);
2132 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2133 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2135 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2136 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2138 case LDKNetAddress_IPv4: {
2139 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
2140 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2141 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2143 case LDKNetAddress_IPv6: {
2144 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
2145 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2146 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2148 case LDKNetAddress_OnionV2: {
2149 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
2150 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2151 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2153 case LDKNetAddress_OnionV3: {
2154 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2155 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2156 return (*env)->NewObject(env, LDKNetAddress_OnionV3_class, LDKNetAddress_OnionV3_meth, ed25519_pubkey_arr, obj->onion_v3.checksum, obj->onion_v3.version, obj->onion_v3.port);
2161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2162 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2163 ret->datalen = (*env)->GetArrayLength(env, elems);
2164 if (ret->datalen == 0) {
2167 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2168 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2169 for (size_t i = 0; i < ret->datalen; i++) {
2170 int64_t arr_elem = java_elems[i];
2171 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
2172 FREE((void*)arr_elem);
2173 ret->data[i] = arr_elem_conv;
2175 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2179 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2180 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2181 for (size_t i = 0; i < ret.datalen; i++) {
2182 ret.data[i] = NetAddress_clone(&orig->data[i]);
2186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2187 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2188 ret->datalen = (*env)->GetArrayLength(env, elems);
2189 if (ret->datalen == 0) {
2192 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2193 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2194 for (size_t i = 0; i < ret->datalen; i++) {
2195 int64_t arr_elem = java_elems[i];
2196 LDKChannelMonitor arr_elem_conv;
2197 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2198 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2199 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
2200 ret->data[i] = arr_elem_conv;
2202 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2206 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
2207 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
2208 for (size_t i = 0; i < ret.datalen; i++) {
2209 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
2213 typedef struct LDKWatch_JCalls {
2214 atomic_size_t refcnt;
2217 jmethodID watch_channel_meth;
2218 jmethodID update_channel_meth;
2219 jmethodID release_pending_monitor_events_meth;
2221 static void LDKWatch_JCalls_free(void* this_arg) {
2222 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2223 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2225 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2226 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2230 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2231 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2233 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2234 LDKOutPoint funding_txo_var = funding_txo;
2235 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2236 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2237 long funding_txo_ref = (long)funding_txo_var.inner;
2238 if (funding_txo_var.is_owned) {
2239 funding_txo_ref |= 1;
2241 LDKChannelMonitor monitor_var = monitor;
2242 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2243 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2244 long monitor_ref = (long)monitor_var.inner;
2245 if (monitor_var.is_owned) {
2248 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2250 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2251 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2252 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2255 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2256 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2258 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2259 LDKOutPoint funding_txo_var = funding_txo;
2260 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2261 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2262 long funding_txo_ref = (long)funding_txo_var.inner;
2263 if (funding_txo_var.is_owned) {
2264 funding_txo_ref |= 1;
2266 LDKChannelMonitorUpdate update_var = update;
2267 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2268 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2269 long update_ref = (long)update_var.inner;
2270 if (update_var.is_owned) {
2273 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2275 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2276 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
2277 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2280 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2281 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2283 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2284 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2286 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2287 LDKCVec_MonitorEventZ arg_constr;
2288 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
2289 if (arg_constr.datalen > 0)
2290 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2292 arg_constr.data = NULL;
2293 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
2294 for (size_t o = 0; o < arg_constr.datalen; o++) {
2295 int64_t arr_conv_14 = arg_vals[o];
2296 LDKMonitorEvent arr_conv_14_conv;
2297 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2298 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2299 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2300 arg_constr.data[o] = arr_conv_14_conv;
2302 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
2305 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2306 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2307 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2308 return (void*) this_arg;
2310 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
2311 jclass c = (*env)->GetObjectClass(env, o);
2313 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2314 atomic_init(&calls->refcnt, 1);
2315 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2316 calls->o = (*env)->NewWeakGlobalRef(env, o);
2317 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2318 CHECK(calls->watch_channel_meth != NULL);
2319 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2320 CHECK(calls->update_channel_meth != NULL);
2321 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2322 CHECK(calls->release_pending_monitor_events_meth != NULL);
2325 .this_arg = (void*) calls,
2326 .watch_channel = watch_channel_jcall,
2327 .update_channel = update_channel_jcall,
2328 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2329 .free = LDKWatch_JCalls_free,
2333 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
2334 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2335 *res_ptr = LDKWatch_init(env, clz, o);
2336 return (long)res_ptr;
2338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t monitor) {
2339 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2340 LDKOutPoint funding_txo_conv;
2341 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2342 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2343 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2344 LDKChannelMonitor monitor_conv;
2345 monitor_conv.inner = (void*)(monitor & (~1));
2346 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2347 monitor_conv = ChannelMonitor_clone(&monitor_conv);
2348 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2349 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2350 return (long)ret_conv;
2353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t update) {
2354 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2355 LDKOutPoint funding_txo_conv;
2356 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2357 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2358 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2359 LDKChannelMonitorUpdate update_conv;
2360 update_conv.inner = (void*)(update & (~1));
2361 update_conv.is_owned = (update & 1) || (update == 0);
2362 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2363 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2364 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2365 return (long)ret_conv;
2368 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
2369 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2370 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2371 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
2372 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
2373 for (size_t o = 0; o < ret_var.datalen; o++) {
2374 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2375 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2376 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2377 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2378 if (arr_conv_14_var.is_owned) {
2379 arr_conv_14_ref |= 1;
2381 ret_arr_ptr[o] = arr_conv_14_ref;
2383 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
2388 typedef struct LDKBroadcasterInterface_JCalls {
2389 atomic_size_t refcnt;
2392 jmethodID broadcast_transaction_meth;
2393 } LDKBroadcasterInterface_JCalls;
2394 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2395 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2396 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2398 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2399 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2403 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2404 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2406 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2407 LDKTransaction tx_var = tx;
2408 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
2409 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
2410 Transaction_free(tx_var);
2411 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2413 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2415 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2416 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2417 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2418 return (void*) this_arg;
2420 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
2421 jclass c = (*env)->GetObjectClass(env, o);
2423 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2424 atomic_init(&calls->refcnt, 1);
2425 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2426 calls->o = (*env)->NewWeakGlobalRef(env, o);
2427 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2428 CHECK(calls->broadcast_transaction_meth != NULL);
2430 LDKBroadcasterInterface ret = {
2431 .this_arg = (void*) calls,
2432 .broadcast_transaction = broadcast_transaction_jcall,
2433 .free = LDKBroadcasterInterface_JCalls_free,
2437 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2438 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2439 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
2440 return (long)res_ptr;
2442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
2443 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2444 LDKTransaction tx_ref;
2445 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
2446 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2447 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
2448 tx_ref.data_is_owned = true;
2449 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2452 typedef struct LDKKeysInterface_JCalls {
2453 atomic_size_t refcnt;
2456 jmethodID get_node_secret_meth;
2457 jmethodID get_destination_script_meth;
2458 jmethodID get_shutdown_pubkey_meth;
2459 jmethodID get_channel_keys_meth;
2460 jmethodID get_secure_random_bytes_meth;
2461 jmethodID read_chan_signer_meth;
2462 } LDKKeysInterface_JCalls;
2463 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2464 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2465 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2467 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2468 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2472 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2473 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2475 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2476 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2478 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2479 LDKSecretKey arg_ref;
2480 CHECK((*env)->GetArrayLength(env, arg) == 32);
2481 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
2484 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2485 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2487 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2488 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2490 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
2491 LDKCVec_u8Z arg_ref;
2492 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
2493 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2494 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
2497 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2498 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2500 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2501 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2503 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2504 LDKPublicKey arg_ref;
2505 CHECK((*env)->GetArrayLength(env, arg) == 33);
2506 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
2509 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2510 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2512 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2513 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2515 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2516 LDKChannelKeys ret_conv = *(LDKChannelKeys*)(((uint64_t)ret) & ~1);
2517 ret_conv = ChannelKeys_clone(ret);
2520 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2521 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2523 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2524 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2526 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2527 LDKThirtyTwoBytes arg_ref;
2528 CHECK((*env)->GetArrayLength(env, arg) == 32);
2529 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
2532 LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
2533 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2535 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2536 LDKu8slice reader_var = reader;
2537 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
2538 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
2539 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2541 LDKCResult_ChanKeySignerDecodeErrorZ* ret = (LDKCResult_ChanKeySignerDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
2542 LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)(((uint64_t)ret) & ~1);
2543 ret_conv = CResult_ChanKeySignerDecodeErrorZ_clone((LDKCResult_ChanKeySignerDecodeErrorZ*)ret);
2546 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2547 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2548 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2549 return (void*) this_arg;
2551 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
2552 jclass c = (*env)->GetObjectClass(env, o);
2554 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2555 atomic_init(&calls->refcnt, 1);
2556 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2557 calls->o = (*env)->NewWeakGlobalRef(env, o);
2558 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2559 CHECK(calls->get_node_secret_meth != NULL);
2560 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2561 CHECK(calls->get_destination_script_meth != NULL);
2562 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2563 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2564 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2565 CHECK(calls->get_channel_keys_meth != NULL);
2566 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2567 CHECK(calls->get_secure_random_bytes_meth != NULL);
2568 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
2569 CHECK(calls->read_chan_signer_meth != NULL);
2571 LDKKeysInterface ret = {
2572 .this_arg = (void*) calls,
2573 .get_node_secret = get_node_secret_jcall,
2574 .get_destination_script = get_destination_script_jcall,
2575 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2576 .get_channel_keys = get_channel_keys_jcall,
2577 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2578 .read_chan_signer = read_chan_signer_jcall,
2579 .free = LDKKeysInterface_JCalls_free,
2583 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2584 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2585 *res_ptr = LDKKeysInterface_init(env, clz, o);
2586 return (long)res_ptr;
2588 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
2589 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2590 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2591 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
2596 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2597 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2598 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
2599 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
2600 CVec_u8Z_free(arg_var);
2604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
2605 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2606 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
2607 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2612 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2613 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2614 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
2619 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2620 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2621 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
2626 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2627 LDKu8slice reader_ref;
2628 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
2629 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
2630 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
2631 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2632 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
2633 return (long)ret_conv;
2636 typedef struct LDKFeeEstimator_JCalls {
2637 atomic_size_t refcnt;
2640 jmethodID get_est_sat_per_1000_weight_meth;
2641 } LDKFeeEstimator_JCalls;
2642 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2643 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2644 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2646 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2647 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2651 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2652 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2654 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2655 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2656 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2658 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2660 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2661 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2662 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2663 return (void*) this_arg;
2665 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
2666 jclass c = (*env)->GetObjectClass(env, o);
2668 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2669 atomic_init(&calls->refcnt, 1);
2670 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2671 calls->o = (*env)->NewWeakGlobalRef(env, o);
2672 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2673 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2675 LDKFeeEstimator ret = {
2676 .this_arg = (void*) calls,
2677 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2678 .free = LDKFeeEstimator_JCalls_free,
2682 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
2683 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2684 *res_ptr = LDKFeeEstimator_init(env, clz, o);
2685 return (long)res_ptr;
2687 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight(JNIEnv *env, jclass clz, int64_t this_arg, jclass confirmation_target) {
2688 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2689 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
2690 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2694 typedef struct LDKLogger_JCalls {
2695 atomic_size_t refcnt;
2700 static void LDKLogger_JCalls_free(void* this_arg) {
2701 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2702 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2704 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2705 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2709 void log_jcall(const void* this_arg, const char* record) {
2710 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2712 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2713 const char* record_str = record;
2714 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
2715 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2717 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
2719 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2720 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2721 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2722 return (void*) this_arg;
2724 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
2725 jclass c = (*env)->GetObjectClass(env, o);
2727 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2728 atomic_init(&calls->refcnt, 1);
2729 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2730 calls->o = (*env)->NewWeakGlobalRef(env, o);
2731 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
2732 CHECK(calls->log_meth != NULL);
2735 .this_arg = (void*) calls,
2737 .free = LDKLogger_JCalls_free,
2741 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
2742 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2743 *res_ptr = LDKLogger_init(env, clz, o);
2744 return (long)res_ptr;
2746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2747 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2748 LDKThirtyTwoBytes a_ref;
2749 CHECK((*env)->GetArrayLength(env, a) == 32);
2750 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2752 LDKChannelManager b_conv;
2753 b_conv.inner = (void*)(b & (~1));
2754 b_conv.is_owned = (b & 1) || (b == 0);
2755 // Warning: we need a move here but no clone is available for LDKChannelManager
2759 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2760 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2761 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2762 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2766 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
2767 LDKChannelManager b_var = tuple->b;
2768 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2769 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2770 long b_ref = (long)b_var.inner & ~1;
2773 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2774 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2777 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2778 CHECK(val->result_ok);
2779 long res_ref = (long)(&(*val->contents.result)) | 1;
2782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2783 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
2784 CHECK(!val->result_ok);
2785 LDKDecodeError err_var = (*val->contents.err);
2786 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2787 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2788 long err_ref = (long)err_var.inner & ~1;
2791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2792 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2794 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2795 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2796 CHECK(val->result_ok);
2797 long res_ref = ((long)&(*val->contents.result)) | 1;
2800 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2801 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
2802 CHECK(!val->result_ok);
2803 return *val->contents.err;
2805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2806 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2809 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2810 CHECK(val->result_ok);
2811 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2812 *res_conv = (*val->contents.result);
2813 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2814 return (long)res_conv;
2816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2817 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
2818 CHECK(!val->result_ok);
2819 LDKDecodeError err_var = (*val->contents.err);
2820 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2821 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2822 long err_ref = (long)err_var.inner & ~1;
2825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2826 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2827 ret->datalen = (*env)->GetArrayLength(env, elems);
2828 if (ret->datalen == 0) {
2831 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2832 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2833 for (size_t i = 0; i < ret->datalen; i++) {
2834 ret->data[i] = java_elems[i];
2836 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2840 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2841 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2842 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2846 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2847 ret->datalen = (*env)->GetArrayLength(env, elems);
2848 if (ret->datalen == 0) {
2851 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2852 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2853 for (size_t i = 0; i < ret->datalen; i++) {
2854 int64_t arr_elem = java_elems[i];
2855 LDKUpdateAddHTLC arr_elem_conv;
2856 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2857 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2858 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2859 ret->data[i] = arr_elem_conv;
2861 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2865 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2866 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2867 for (size_t i = 0; i < ret.datalen; i++) {
2868 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2873 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2874 ret->datalen = (*env)->GetArrayLength(env, elems);
2875 if (ret->datalen == 0) {
2878 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2879 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2880 for (size_t i = 0; i < ret->datalen; i++) {
2881 int64_t arr_elem = java_elems[i];
2882 LDKUpdateFulfillHTLC arr_elem_conv;
2883 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2884 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2885 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2886 ret->data[i] = arr_elem_conv;
2888 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2892 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2893 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2894 for (size_t i = 0; i < ret.datalen; i++) {
2895 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2900 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
2901 ret->datalen = (*env)->GetArrayLength(env, elems);
2902 if (ret->datalen == 0) {
2905 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
2906 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2907 for (size_t i = 0; i < ret->datalen; i++) {
2908 int64_t arr_elem = java_elems[i];
2909 LDKUpdateFailHTLC arr_elem_conv;
2910 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2911 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2912 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
2913 ret->data[i] = arr_elem_conv;
2915 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2919 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
2920 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
2921 for (size_t i = 0; i < ret.datalen; i++) {
2922 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
2926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2927 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
2928 ret->datalen = (*env)->GetArrayLength(env, elems);
2929 if (ret->datalen == 0) {
2932 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
2933 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2934 for (size_t i = 0; i < ret->datalen; i++) {
2935 int64_t arr_elem = java_elems[i];
2936 LDKUpdateFailMalformedHTLC arr_elem_conv;
2937 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2938 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2939 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
2940 ret->data[i] = arr_elem_conv;
2942 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2946 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
2947 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
2948 for (size_t i = 0; i < ret.datalen; i++) {
2949 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
2953 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2954 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
2956 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2957 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
2958 CHECK(val->result_ok);
2959 return *val->contents.result;
2961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2962 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
2963 CHECK(!val->result_ok);
2964 LDKLightningError err_var = (*val->contents.err);
2965 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2966 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2967 long err_ref = (long)err_var.inner & ~1;
2970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
2971 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
2972 LDKChannelAnnouncement a_conv;
2973 a_conv.inner = (void*)(a & (~1));
2974 a_conv.is_owned = (a & 1) || (a == 0);
2975 a_conv = ChannelAnnouncement_clone(&a_conv);
2977 LDKChannelUpdate b_conv;
2978 b_conv.inner = (void*)(b & (~1));
2979 b_conv.is_owned = (b & 1) || (b == 0);
2980 b_conv = ChannelUpdate_clone(&b_conv);
2982 LDKChannelUpdate c_conv;
2983 c_conv.inner = (void*)(c & (~1));
2984 c_conv.is_owned = (c & 1) || (c == 0);
2985 c_conv = ChannelUpdate_clone(&c_conv);
2989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2990 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
2991 LDKChannelAnnouncement a_var = tuple->a;
2992 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2993 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2994 long a_ref = (long)a_var.inner & ~1;
2997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2998 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
2999 LDKChannelUpdate b_var = tuple->b;
3000 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3001 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3002 long b_ref = (long)b_var.inner & ~1;
3005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
3006 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
3007 LDKChannelUpdate c_var = tuple->c;
3008 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3009 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3010 long c_ref = (long)c_var.inner & ~1;
3013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3014 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3015 ret->datalen = (*env)->GetArrayLength(env, elems);
3016 if (ret->datalen == 0) {
3019 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
3020 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3021 for (size_t i = 0; i < ret->datalen; i++) {
3022 int64_t arr_elem = java_elems[i];
3023 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
3024 FREE((void*)arr_elem);
3025 ret->data[i] = arr_elem_conv;
3027 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3032 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3033 ret->datalen = (*env)->GetArrayLength(env, elems);
3034 if (ret->datalen == 0) {
3037 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
3038 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3039 for (size_t i = 0; i < ret->datalen; i++) {
3040 int64_t arr_elem = java_elems[i];
3041 LDKNodeAnnouncement arr_elem_conv;
3042 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3043 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3044 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3045 ret->data[i] = arr_elem_conv;
3047 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3051 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3052 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3053 for (size_t i = 0; i < ret.datalen; i++) {
3054 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3059 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3062 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3063 CHECK(val->result_ok);
3064 return *val->contents.result;
3066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3067 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
3068 CHECK(!val->result_ok);
3069 LDKLightningError err_var = (*val->contents.err);
3070 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3071 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3072 long err_ref = (long)err_var.inner & ~1;
3075 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3076 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3079 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3080 CHECK(val->result_ok);
3081 LDKChannelReestablish res_var = (*val->contents.result);
3082 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3083 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3084 long res_ref = (long)res_var.inner & ~1;
3087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3088 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
3089 CHECK(!val->result_ok);
3090 LDKDecodeError err_var = (*val->contents.err);
3091 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3092 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3093 long err_ref = (long)err_var.inner & ~1;
3096 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3097 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3100 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3101 CHECK(val->result_ok);
3102 LDKInit res_var = (*val->contents.result);
3103 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3104 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3105 long res_ref = (long)res_var.inner & ~1;
3108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3109 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
3110 CHECK(!val->result_ok);
3111 LDKDecodeError err_var = (*val->contents.err);
3112 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3113 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3114 long err_ref = (long)err_var.inner & ~1;
3117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3118 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3121 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3122 CHECK(val->result_ok);
3123 LDKPing res_var = (*val->contents.result);
3124 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3125 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3126 long res_ref = (long)res_var.inner & ~1;
3129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3130 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
3131 CHECK(!val->result_ok);
3132 LDKDecodeError err_var = (*val->contents.err);
3133 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3134 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3135 long err_ref = (long)err_var.inner & ~1;
3138 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3139 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3142 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3143 CHECK(val->result_ok);
3144 LDKPong res_var = (*val->contents.result);
3145 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3146 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3147 long res_ref = (long)res_var.inner & ~1;
3150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3151 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
3152 CHECK(!val->result_ok);
3153 LDKDecodeError err_var = (*val->contents.err);
3154 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3155 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3156 long err_ref = (long)err_var.inner & ~1;
3159 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3160 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3163 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3164 CHECK(val->result_ok);
3165 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3166 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3167 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3168 long res_ref = (long)res_var.inner & ~1;
3171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3172 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
3173 CHECK(!val->result_ok);
3174 LDKDecodeError err_var = (*val->contents.err);
3175 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3176 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3177 long err_ref = (long)err_var.inner & ~1;
3180 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3181 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3184 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3185 CHECK(val->result_ok);
3186 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3187 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3188 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3189 long res_ref = (long)res_var.inner & ~1;
3192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3193 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
3194 CHECK(!val->result_ok);
3195 LDKDecodeError err_var = (*val->contents.err);
3196 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3197 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3198 long err_ref = (long)err_var.inner & ~1;
3201 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3202 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3205 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3206 CHECK(val->result_ok);
3207 LDKErrorMessage res_var = (*val->contents.result);
3208 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3209 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3210 long res_ref = (long)res_var.inner & ~1;
3213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3214 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
3215 CHECK(!val->result_ok);
3216 LDKDecodeError err_var = (*val->contents.err);
3217 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3218 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3219 long err_ref = (long)err_var.inner & ~1;
3222 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3223 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3226 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3227 CHECK(val->result_ok);
3228 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3229 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3230 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3231 long res_ref = (long)res_var.inner & ~1;
3234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3235 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
3236 CHECK(!val->result_ok);
3237 LDKDecodeError err_var = (*val->contents.err);
3238 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3239 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3240 long err_ref = (long)err_var.inner & ~1;
3243 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3244 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3247 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3248 CHECK(val->result_ok);
3249 LDKQueryShortChannelIds res_var = (*val->contents.result);
3250 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3251 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3252 long res_ref = (long)res_var.inner & ~1;
3255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3256 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
3257 CHECK(!val->result_ok);
3258 LDKDecodeError err_var = (*val->contents.err);
3259 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3260 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3261 long err_ref = (long)err_var.inner & ~1;
3264 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3265 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3268 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3269 CHECK(val->result_ok);
3270 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3271 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3272 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3273 long res_ref = (long)res_var.inner & ~1;
3276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3277 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
3278 CHECK(!val->result_ok);
3279 LDKDecodeError err_var = (*val->contents.err);
3280 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3281 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3282 long err_ref = (long)err_var.inner & ~1;
3285 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3286 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3289 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3290 CHECK(val->result_ok);
3291 LDKQueryChannelRange res_var = (*val->contents.result);
3292 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3293 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3294 long res_ref = (long)res_var.inner & ~1;
3297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3298 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
3299 CHECK(!val->result_ok);
3300 LDKDecodeError err_var = (*val->contents.err);
3301 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3302 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3303 long err_ref = (long)err_var.inner & ~1;
3306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3307 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3310 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3311 CHECK(val->result_ok);
3312 LDKReplyChannelRange res_var = (*val->contents.result);
3313 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3314 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3315 long res_ref = (long)res_var.inner & ~1;
3318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3319 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
3320 CHECK(!val->result_ok);
3321 LDKDecodeError err_var = (*val->contents.err);
3322 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3323 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3324 long err_ref = (long)err_var.inner & ~1;
3327 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3328 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3331 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3332 CHECK(val->result_ok);
3333 LDKGossipTimestampFilter res_var = (*val->contents.result);
3334 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3335 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3336 long res_ref = (long)res_var.inner & ~1;
3339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3340 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
3341 CHECK(!val->result_ok);
3342 LDKDecodeError err_var = (*val->contents.err);
3343 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3344 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3345 long err_ref = (long)err_var.inner & ~1;
3348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3349 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3352 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3353 CHECK(val->result_ok);
3354 LDKCVec_u8Z res_var = (*val->contents.result);
3355 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3356 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3360 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
3361 CHECK(!val->result_ok);
3362 LDKPeerHandleError err_var = (*val->contents.err);
3363 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3364 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3365 long err_ref = (long)err_var.inner & ~1;
3368 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3369 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3372 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3373 CHECK(val->result_ok);
3374 return *val->contents.result;
3376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3377 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
3378 CHECK(!val->result_ok);
3379 LDKPeerHandleError err_var = (*val->contents.err);
3380 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3381 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3382 long err_ref = (long)err_var.inner & ~1;
3385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3386 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3389 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3390 CHECK(val->result_ok);
3391 return *val->contents.result;
3393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3394 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
3395 CHECK(!val->result_ok);
3396 LDKPeerHandleError err_var = (*val->contents.err);
3397 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3398 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3399 long err_ref = (long)err_var.inner & ~1;
3402 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3403 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3406 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)(arg & ~1);
3407 CHECK(val->result_ok);
3408 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3409 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
3412 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3413 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)(arg & ~1);
3414 CHECK(!val->result_ok);
3415 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3419 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3422 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)(arg & ~1);
3423 CHECK(val->result_ok);
3424 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
3425 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
3428 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3429 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)(arg & ~1);
3430 CHECK(!val->result_ok);
3431 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3435 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3438 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)(arg & ~1);
3439 CHECK(val->result_ok);
3440 LDKTxCreationKeys res_var = (*val->contents.result);
3441 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3442 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3443 long res_ref = (long)res_var.inner & ~1;
3446 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3447 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)(arg & ~1);
3448 CHECK(!val->result_ok);
3449 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3452 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3453 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
3455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3456 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
3457 CHECK(val->result_ok);
3458 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
3459 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3460 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3461 long res_ref = (long)res_var.inner & ~1;
3464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3465 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
3466 CHECK(!val->result_ok);
3467 return *val->contents.err;
3469 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3470 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
3472 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3473 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
3474 CHECK(val->result_ok);
3475 LDKCVec_SignatureZ res_var = (*val->contents.result);
3476 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
3478 for (size_t i = 0; i < res_var.datalen; i++) {
3479 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
3480 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
3481 (*env)->SetObjectArrayElement(env, res_arr, i, arr_conv_8_arr);
3485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3486 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
3487 CHECK(!val->result_ok);
3488 return *val->contents.err;
3490 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3491 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3492 ret->datalen = (*env)->GetArrayLength(env, elems);
3493 if (ret->datalen == 0) {
3496 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3497 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3498 for (size_t i = 0; i < ret->datalen; i++) {
3499 int64_t arr_elem = java_elems[i];
3500 LDKRouteHop arr_elem_conv;
3501 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3502 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3503 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3504 ret->data[i] = arr_elem_conv;
3506 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3510 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3511 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3512 for (size_t i = 0; i < ret.datalen; i++) {
3513 ret.data[i] = RouteHop_clone(&orig->data[i]);
3517 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3518 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3519 for (size_t i = 0; i < ret.datalen; i++) {
3520 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3525 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3528 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3529 CHECK(val->result_ok);
3530 LDKRoute res_var = (*val->contents.result);
3531 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3532 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3533 long res_ref = (long)res_var.inner & ~1;
3536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3537 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
3538 CHECK(!val->result_ok);
3539 LDKDecodeError err_var = (*val->contents.err);
3540 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3541 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3542 long err_ref = (long)err_var.inner & ~1;
3545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3546 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3547 ret->datalen = (*env)->GetArrayLength(env, elems);
3548 if (ret->datalen == 0) {
3551 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3552 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3553 for (size_t i = 0; i < ret->datalen; i++) {
3554 int64_t arr_elem = java_elems[i];
3555 LDKRouteHint arr_elem_conv;
3556 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3557 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3558 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3559 ret->data[i] = arr_elem_conv;
3561 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3565 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3566 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3567 for (size_t i = 0; i < ret.datalen; i++) {
3568 ret.data[i] = RouteHint_clone(&orig->data[i]);
3572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3573 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3576 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3577 CHECK(val->result_ok);
3578 LDKRoute res_var = (*val->contents.result);
3579 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3580 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3581 long res_ref = (long)res_var.inner & ~1;
3584 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3585 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
3586 CHECK(!val->result_ok);
3587 LDKLightningError err_var = (*val->contents.err);
3588 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3589 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3590 long err_ref = (long)err_var.inner & ~1;
3593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3594 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3597 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3598 CHECK(val->result_ok);
3599 LDKRoutingFees res_var = (*val->contents.result);
3600 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3601 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3602 long res_ref = (long)res_var.inner & ~1;
3605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3606 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
3607 CHECK(!val->result_ok);
3608 LDKDecodeError err_var = (*val->contents.err);
3609 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3610 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3611 long err_ref = (long)err_var.inner & ~1;
3614 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3615 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3618 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3619 CHECK(val->result_ok);
3620 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3621 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3622 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3623 long res_ref = (long)res_var.inner & ~1;
3626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3627 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
3628 CHECK(!val->result_ok);
3629 LDKDecodeError err_var = (*val->contents.err);
3630 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3631 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3632 long err_ref = (long)err_var.inner & ~1;
3635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3636 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3639 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3640 CHECK(val->result_ok);
3641 LDKNodeInfo res_var = (*val->contents.result);
3642 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3643 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3644 long res_ref = (long)res_var.inner & ~1;
3647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3648 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
3649 CHECK(!val->result_ok);
3650 LDKDecodeError err_var = (*val->contents.err);
3651 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3652 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3653 long err_ref = (long)err_var.inner & ~1;
3656 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3657 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3660 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3661 CHECK(val->result_ok);
3662 LDKNetworkGraph res_var = (*val->contents.result);
3663 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3664 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3665 long res_ref = (long)res_var.inner & ~1;
3668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3669 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
3670 CHECK(!val->result_ok);
3671 LDKDecodeError err_var = (*val->contents.err);
3672 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3673 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3674 long err_ref = (long)err_var.inner & ~1;
3677 typedef struct LDKMessageSendEventsProvider_JCalls {
3678 atomic_size_t refcnt;
3681 jmethodID get_and_clear_pending_msg_events_meth;
3682 } LDKMessageSendEventsProvider_JCalls;
3683 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3684 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3685 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3687 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3688 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3692 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3693 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3695 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3696 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3698 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
3699 LDKCVec_MessageSendEventZ arg_constr;
3700 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3701 if (arg_constr.datalen > 0)
3702 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3704 arg_constr.data = NULL;
3705 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3706 for (size_t s = 0; s < arg_constr.datalen; s++) {
3707 int64_t arr_conv_18 = arg_vals[s];
3708 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
3709 FREE((void*)arr_conv_18);
3710 arg_constr.data[s] = arr_conv_18_conv;
3712 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3715 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3716 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3717 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3718 return (void*) this_arg;
3720 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3721 jclass c = (*env)->GetObjectClass(env, o);
3723 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3724 atomic_init(&calls->refcnt, 1);
3725 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3726 calls->o = (*env)->NewWeakGlobalRef(env, o);
3727 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
3728 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
3730 LDKMessageSendEventsProvider ret = {
3731 .this_arg = (void*) calls,
3732 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3733 .free = LDKMessageSendEventsProvider_JCalls_free,
3737 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3738 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3739 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
3740 return (long)res_ptr;
3742 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3743 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3744 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3745 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3746 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3747 for (size_t s = 0; s < ret_var.datalen; s++) {
3748 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3749 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3750 long arr_conv_18_ref = (long)arr_conv_18_copy;
3751 ret_arr_ptr[s] = arr_conv_18_ref;
3753 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3758 typedef struct LDKEventsProvider_JCalls {
3759 atomic_size_t refcnt;
3762 jmethodID get_and_clear_pending_events_meth;
3763 } LDKEventsProvider_JCalls;
3764 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3765 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3766 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3768 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3769 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3773 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3774 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3776 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3777 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3779 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
3780 LDKCVec_EventZ arg_constr;
3781 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3782 if (arg_constr.datalen > 0)
3783 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3785 arg_constr.data = NULL;
3786 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3787 for (size_t h = 0; h < arg_constr.datalen; h++) {
3788 int64_t arr_conv_7 = arg_vals[h];
3789 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
3790 FREE((void*)arr_conv_7);
3791 arg_constr.data[h] = arr_conv_7_conv;
3793 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3796 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3797 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3798 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3799 return (void*) this_arg;
3801 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3802 jclass c = (*env)->GetObjectClass(env, o);
3804 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3805 atomic_init(&calls->refcnt, 1);
3806 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3807 calls->o = (*env)->NewWeakGlobalRef(env, o);
3808 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
3809 CHECK(calls->get_and_clear_pending_events_meth != NULL);
3811 LDKEventsProvider ret = {
3812 .this_arg = (void*) calls,
3813 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3814 .free = LDKEventsProvider_JCalls_free,
3818 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3819 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3820 *res_ptr = LDKEventsProvider_init(env, clz, o);
3821 return (long)res_ptr;
3823 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3824 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3825 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3826 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3827 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3828 for (size_t h = 0; h < ret_var.datalen; h++) {
3829 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3830 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
3831 long arr_conv_7_ref = (long)arr_conv_7_copy;
3832 ret_arr_ptr[h] = arr_conv_7_ref;
3834 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3839 typedef struct LDKAccess_JCalls {
3840 atomic_size_t refcnt;
3843 jmethodID get_utxo_meth;
3845 static void LDKAccess_JCalls_free(void* this_arg) {
3846 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3847 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3849 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3850 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3854 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3855 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3857 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3858 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3859 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3860 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3862 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3863 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
3864 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
3867 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3868 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3869 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3870 return (void*) this_arg;
3872 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3873 jclass c = (*env)->GetObjectClass(env, o);
3875 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3876 atomic_init(&calls->refcnt, 1);
3877 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3878 calls->o = (*env)->NewWeakGlobalRef(env, o);
3879 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3880 CHECK(calls->get_utxo_meth != NULL);
3883 .this_arg = (void*) calls,
3884 .get_utxo = get_utxo_jcall,
3885 .free = LDKAccess_JCalls_free,
3889 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3890 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3891 *res_ptr = LDKAccess_init(env, clz, o);
3892 return (long)res_ptr;
3894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
3895 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3896 unsigned char genesis_hash_arr[32];
3897 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3898 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
3899 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
3900 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
3901 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
3902 return (long)ret_conv;
3905 typedef struct LDKFilter_JCalls {
3906 atomic_size_t refcnt;
3909 jmethodID register_tx_meth;
3910 jmethodID register_output_meth;
3912 static void LDKFilter_JCalls_free(void* this_arg) {
3913 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3914 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3916 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3917 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3921 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
3922 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3924 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3925 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
3926 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
3927 LDKu8slice script_pubkey_var = script_pubkey;
3928 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
3929 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
3930 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3932 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
3934 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
3935 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3937 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3938 LDKOutPoint outpoint_var = *outpoint;
3939 outpoint_var = OutPoint_clone(outpoint);
3940 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3941 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3942 long outpoint_ref = (long)outpoint_var.inner;
3943 if (outpoint_var.is_owned) {
3946 LDKu8slice script_pubkey_var = script_pubkey;
3947 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
3948 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
3949 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3951 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
3953 static void* LDKFilter_JCalls_clone(const void* this_arg) {
3954 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
3955 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3956 return (void*) this_arg;
3958 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
3959 jclass c = (*env)->GetObjectClass(env, o);
3961 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
3962 atomic_init(&calls->refcnt, 1);
3963 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3964 calls->o = (*env)->NewWeakGlobalRef(env, o);
3965 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
3966 CHECK(calls->register_tx_meth != NULL);
3967 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
3968 CHECK(calls->register_output_meth != NULL);
3971 .this_arg = (void*) calls,
3972 .register_tx = register_tx_jcall,
3973 .register_output = register_output_jcall,
3974 .free = LDKFilter_JCalls_free,
3978 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
3979 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
3980 *res_ptr = LDKFilter_init(env, clz, o);
3981 return (long)res_ptr;
3983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
3984 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3985 unsigned char txid_arr[32];
3986 CHECK((*env)->GetArrayLength(env, txid) == 32);
3987 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
3988 unsigned char (*txid_ref)[32] = &txid_arr;
3989 LDKu8slice script_pubkey_ref;
3990 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
3991 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
3992 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
3993 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
3996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t outpoint, int8_tArray script_pubkey) {
3997 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
3998 LDKOutPoint outpoint_conv;
3999 outpoint_conv.inner = (void*)(outpoint & (~1));
4000 outpoint_conv.is_owned = false;
4001 LDKu8slice script_pubkey_ref;
4002 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4003 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4004 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4005 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4008 typedef struct LDKPersist_JCalls {
4009 atomic_size_t refcnt;
4012 jmethodID persist_new_channel_meth;
4013 jmethodID update_persisted_channel_meth;
4014 } LDKPersist_JCalls;
4015 static void LDKPersist_JCalls_free(void* this_arg) {
4016 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4017 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4019 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4020 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4024 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4025 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4027 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4028 LDKOutPoint id_var = id;
4029 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4030 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4031 long id_ref = (long)id_var.inner;
4032 if (id_var.is_owned) {
4035 LDKChannelMonitor data_var = *data;
4036 data_var = ChannelMonitor_clone(data);
4037 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4038 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4039 long data_ref = (long)data_var.inner;
4040 if (data_var.is_owned) {
4043 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4045 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
4046 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4047 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4050 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4051 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4053 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4054 LDKOutPoint id_var = id;
4055 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4056 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4057 long id_ref = (long)id_var.inner;
4058 if (id_var.is_owned) {
4061 LDKChannelMonitorUpdate update_var = *update;
4062 update_var = ChannelMonitorUpdate_clone(update);
4063 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4064 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4065 long update_ref = (long)update_var.inner;
4066 if (update_var.is_owned) {
4069 LDKChannelMonitor data_var = *data;
4070 data_var = ChannelMonitor_clone(data);
4071 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4072 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4073 long data_ref = (long)data_var.inner;
4074 if (data_var.is_owned) {
4077 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4079 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4080 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
4081 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4084 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4085 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4086 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4087 return (void*) this_arg;
4089 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
4090 jclass c = (*env)->GetObjectClass(env, o);
4092 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4093 atomic_init(&calls->refcnt, 1);
4094 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4095 calls->o = (*env)->NewWeakGlobalRef(env, o);
4096 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
4097 CHECK(calls->persist_new_channel_meth != NULL);
4098 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
4099 CHECK(calls->update_persisted_channel_meth != NULL);
4102 .this_arg = (void*) calls,
4103 .persist_new_channel = persist_new_channel_jcall,
4104 .update_persisted_channel = update_persisted_channel_jcall,
4105 .free = LDKPersist_JCalls_free,
4109 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
4110 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4111 *res_ptr = LDKPersist_init(env, clz, o);
4112 return (long)res_ptr;
4114 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t data) {
4115 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4116 LDKOutPoint id_conv;
4117 id_conv.inner = (void*)(id & (~1));
4118 id_conv.is_owned = (id & 1) || (id == 0);
4119 id_conv = OutPoint_clone(&id_conv);
4120 LDKChannelMonitor data_conv;
4121 data_conv.inner = (void*)(data & (~1));
4122 data_conv.is_owned = false;
4123 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4124 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4125 return (long)ret_conv;
4128 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t id, int64_t update, int64_t data) {
4129 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4130 LDKOutPoint id_conv;
4131 id_conv.inner = (void*)(id & (~1));
4132 id_conv.is_owned = (id & 1) || (id == 0);
4133 id_conv = OutPoint_clone(&id_conv);
4134 LDKChannelMonitorUpdate update_conv;
4135 update_conv.inner = (void*)(update & (~1));
4136 update_conv.is_owned = false;
4137 LDKChannelMonitor data_conv;
4138 data_conv.inner = (void*)(data & (~1));
4139 data_conv.is_owned = false;
4140 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4141 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4142 return (long)ret_conv;
4145 typedef struct LDKChannelMessageHandler_JCalls {
4146 atomic_size_t refcnt;
4149 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4150 jmethodID handle_open_channel_meth;
4151 jmethodID handle_accept_channel_meth;
4152 jmethodID handle_funding_created_meth;
4153 jmethodID handle_funding_signed_meth;
4154 jmethodID handle_funding_locked_meth;
4155 jmethodID handle_shutdown_meth;
4156 jmethodID handle_closing_signed_meth;
4157 jmethodID handle_update_add_htlc_meth;
4158 jmethodID handle_update_fulfill_htlc_meth;
4159 jmethodID handle_update_fail_htlc_meth;
4160 jmethodID handle_update_fail_malformed_htlc_meth;
4161 jmethodID handle_commitment_signed_meth;
4162 jmethodID handle_revoke_and_ack_meth;
4163 jmethodID handle_update_fee_meth;
4164 jmethodID handle_announcement_signatures_meth;
4165 jmethodID peer_disconnected_meth;
4166 jmethodID peer_connected_meth;
4167 jmethodID handle_channel_reestablish_meth;
4168 jmethodID handle_error_meth;
4169 } LDKChannelMessageHandler_JCalls;
4170 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4171 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4172 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4174 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4175 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4179 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4180 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4182 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4183 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4184 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4185 LDKInitFeatures their_features_var = their_features;
4186 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4187 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4188 long their_features_ref = (long)their_features_var.inner;
4189 if (their_features_var.is_owned) {
4190 their_features_ref |= 1;
4192 LDKOpenChannel msg_var = *msg;
4193 msg_var = OpenChannel_clone(msg);
4194 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4195 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4196 long msg_ref = (long)msg_var.inner;
4197 if (msg_var.is_owned) {
4200 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4202 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4204 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4205 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4207 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4208 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4209 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4210 LDKInitFeatures their_features_var = their_features;
4211 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4212 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4213 long their_features_ref = (long)their_features_var.inner;
4214 if (their_features_var.is_owned) {
4215 their_features_ref |= 1;
4217 LDKAcceptChannel msg_var = *msg;
4218 msg_var = AcceptChannel_clone(msg);
4219 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4220 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4221 long msg_ref = (long)msg_var.inner;
4222 if (msg_var.is_owned) {
4225 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4227 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4229 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4230 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4232 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4233 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4234 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4235 LDKFundingCreated msg_var = *msg;
4236 msg_var = FundingCreated_clone(msg);
4237 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4238 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4239 long msg_ref = (long)msg_var.inner;
4240 if (msg_var.is_owned) {
4243 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4245 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4247 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4248 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4250 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4251 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4252 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4253 LDKFundingSigned msg_var = *msg;
4254 msg_var = FundingSigned_clone(msg);
4255 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4256 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4257 long msg_ref = (long)msg_var.inner;
4258 if (msg_var.is_owned) {
4261 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4263 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4265 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4266 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4268 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4269 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4270 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4271 LDKFundingLocked msg_var = *msg;
4272 msg_var = FundingLocked_clone(msg);
4273 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4274 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4275 long msg_ref = (long)msg_var.inner;
4276 if (msg_var.is_owned) {
4279 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4281 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4283 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
4284 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4286 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4287 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4288 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4289 LDKShutdown msg_var = *msg;
4290 msg_var = Shutdown_clone(msg);
4291 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4292 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4293 long msg_ref = (long)msg_var.inner;
4294 if (msg_var.is_owned) {
4297 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4299 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
4301 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4302 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4304 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4305 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4306 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4307 LDKClosingSigned msg_var = *msg;
4308 msg_var = ClosingSigned_clone(msg);
4309 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4310 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4311 long msg_ref = (long)msg_var.inner;
4312 if (msg_var.is_owned) {
4315 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4317 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4319 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4320 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4322 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4323 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4324 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4325 LDKUpdateAddHTLC msg_var = *msg;
4326 msg_var = UpdateAddHTLC_clone(msg);
4327 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4328 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4329 long msg_ref = (long)msg_var.inner;
4330 if (msg_var.is_owned) {
4333 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4335 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4337 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4338 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4340 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4341 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4342 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4343 LDKUpdateFulfillHTLC msg_var = *msg;
4344 msg_var = UpdateFulfillHTLC_clone(msg);
4345 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4346 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4347 long msg_ref = (long)msg_var.inner;
4348 if (msg_var.is_owned) {
4351 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4353 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4355 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4356 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4358 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4359 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4360 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4361 LDKUpdateFailHTLC msg_var = *msg;
4362 msg_var = UpdateFailHTLC_clone(msg);
4363 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4364 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4365 long msg_ref = (long)msg_var.inner;
4366 if (msg_var.is_owned) {
4369 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4371 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4373 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4374 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4376 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4377 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4378 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4379 LDKUpdateFailMalformedHTLC msg_var = *msg;
4380 msg_var = UpdateFailMalformedHTLC_clone(msg);
4381 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4382 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4383 long msg_ref = (long)msg_var.inner;
4384 if (msg_var.is_owned) {
4387 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4389 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4391 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4392 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4394 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4395 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4396 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4397 LDKCommitmentSigned msg_var = *msg;
4398 msg_var = CommitmentSigned_clone(msg);
4399 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4400 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4401 long msg_ref = (long)msg_var.inner;
4402 if (msg_var.is_owned) {
4405 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4407 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4409 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4410 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4412 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4413 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4414 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4415 LDKRevokeAndACK msg_var = *msg;
4416 msg_var = RevokeAndACK_clone(msg);
4417 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4418 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4419 long msg_ref = (long)msg_var.inner;
4420 if (msg_var.is_owned) {
4423 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4425 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4427 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4428 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4430 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4431 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4432 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4433 LDKUpdateFee msg_var = *msg;
4434 msg_var = UpdateFee_clone(msg);
4435 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4436 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4437 long msg_ref = (long)msg_var.inner;
4438 if (msg_var.is_owned) {
4441 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4443 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4445 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4446 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4448 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4449 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4450 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4451 LDKAnnouncementSignatures msg_var = *msg;
4452 msg_var = AnnouncementSignatures_clone(msg);
4453 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4454 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4455 long msg_ref = (long)msg_var.inner;
4456 if (msg_var.is_owned) {
4459 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4461 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4463 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4464 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4466 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4467 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4468 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4469 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4471 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4473 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4474 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4476 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4477 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4478 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4479 LDKInit msg_var = *msg;
4480 msg_var = Init_clone(msg);
4481 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 long msg_ref = (long)msg_var.inner;
4484 if (msg_var.is_owned) {
4487 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4489 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4491 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4492 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4494 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4495 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4496 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4497 LDKChannelReestablish msg_var = *msg;
4498 msg_var = ChannelReestablish_clone(msg);
4499 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4500 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4501 long msg_ref = (long)msg_var.inner;
4502 if (msg_var.is_owned) {
4505 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4507 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4509 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4510 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4512 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4513 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4514 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4515 LDKErrorMessage msg_var = *msg;
4516 msg_var = ErrorMessage_clone(msg);
4517 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4518 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4519 long msg_ref = (long)msg_var.inner;
4520 if (msg_var.is_owned) {
4523 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4525 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4527 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4528 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4529 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4530 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4531 return (void*) this_arg;
4533 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4534 jclass c = (*env)->GetObjectClass(env, o);
4536 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4537 atomic_init(&calls->refcnt, 1);
4538 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4539 calls->o = (*env)->NewWeakGlobalRef(env, o);
4540 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
4541 CHECK(calls->handle_open_channel_meth != NULL);
4542 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
4543 CHECK(calls->handle_accept_channel_meth != NULL);
4544 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
4545 CHECK(calls->handle_funding_created_meth != NULL);
4546 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
4547 CHECK(calls->handle_funding_signed_meth != NULL);
4548 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
4549 CHECK(calls->handle_funding_locked_meth != NULL);
4550 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
4551 CHECK(calls->handle_shutdown_meth != NULL);
4552 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
4553 CHECK(calls->handle_closing_signed_meth != NULL);
4554 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
4555 CHECK(calls->handle_update_add_htlc_meth != NULL);
4556 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
4557 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
4558 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
4559 CHECK(calls->handle_update_fail_htlc_meth != NULL);
4560 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
4561 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
4562 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
4563 CHECK(calls->handle_commitment_signed_meth != NULL);
4564 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
4565 CHECK(calls->handle_revoke_and_ack_meth != NULL);
4566 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
4567 CHECK(calls->handle_update_fee_meth != NULL);
4568 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
4569 CHECK(calls->handle_announcement_signatures_meth != NULL);
4570 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
4571 CHECK(calls->peer_disconnected_meth != NULL);
4572 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
4573 CHECK(calls->peer_connected_meth != NULL);
4574 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
4575 CHECK(calls->handle_channel_reestablish_meth != NULL);
4576 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
4577 CHECK(calls->handle_error_meth != NULL);
4579 LDKChannelMessageHandler ret = {
4580 .this_arg = (void*) calls,
4581 .handle_open_channel = handle_open_channel_jcall,
4582 .handle_accept_channel = handle_accept_channel_jcall,
4583 .handle_funding_created = handle_funding_created_jcall,
4584 .handle_funding_signed = handle_funding_signed_jcall,
4585 .handle_funding_locked = handle_funding_locked_jcall,
4586 .handle_shutdown = handle_shutdown_jcall,
4587 .handle_closing_signed = handle_closing_signed_jcall,
4588 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4589 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4590 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4591 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4592 .handle_commitment_signed = handle_commitment_signed_jcall,
4593 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4594 .handle_update_fee = handle_update_fee_jcall,
4595 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4596 .peer_disconnected = peer_disconnected_jcall,
4597 .peer_connected = peer_connected_jcall,
4598 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4599 .handle_error = handle_error_jcall,
4600 .free = LDKChannelMessageHandler_JCalls_free,
4601 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
4603 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4606 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4607 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4608 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
4609 return (long)res_ptr;
4611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
4612 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4613 LDKPublicKey their_node_id_ref;
4614 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4615 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4616 LDKInitFeatures their_features_conv;
4617 their_features_conv.inner = (void*)(their_features & (~1));
4618 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4619 // Warning: we need a move here but no clone is available for LDKInitFeatures
4620 LDKOpenChannel msg_conv;
4621 msg_conv.inner = (void*)(msg & (~1));
4622 msg_conv.is_owned = false;
4623 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t their_features, int64_t msg) {
4627 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4628 LDKPublicKey their_node_id_ref;
4629 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4630 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4631 LDKInitFeatures their_features_conv;
4632 their_features_conv.inner = (void*)(their_features & (~1));
4633 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4634 // Warning: we need a move here but no clone is available for LDKInitFeatures
4635 LDKAcceptChannel msg_conv;
4636 msg_conv.inner = (void*)(msg & (~1));
4637 msg_conv.is_owned = false;
4638 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4642 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4643 LDKPublicKey their_node_id_ref;
4644 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4645 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4646 LDKFundingCreated msg_conv;
4647 msg_conv.inner = (void*)(msg & (~1));
4648 msg_conv.is_owned = false;
4649 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4653 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4654 LDKPublicKey their_node_id_ref;
4655 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4656 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4657 LDKFundingSigned msg_conv;
4658 msg_conv.inner = (void*)(msg & (~1));
4659 msg_conv.is_owned = false;
4660 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4664 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4665 LDKPublicKey their_node_id_ref;
4666 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4667 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4668 LDKFundingLocked msg_conv;
4669 msg_conv.inner = (void*)(msg & (~1));
4670 msg_conv.is_owned = false;
4671 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4675 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4676 LDKPublicKey their_node_id_ref;
4677 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4678 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4679 LDKShutdown msg_conv;
4680 msg_conv.inner = (void*)(msg & (~1));
4681 msg_conv.is_owned = false;
4682 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4686 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4687 LDKPublicKey their_node_id_ref;
4688 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4689 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4690 LDKClosingSigned msg_conv;
4691 msg_conv.inner = (void*)(msg & (~1));
4692 msg_conv.is_owned = false;
4693 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1add_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4697 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4698 LDKPublicKey their_node_id_ref;
4699 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4700 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4701 LDKUpdateAddHTLC msg_conv;
4702 msg_conv.inner = (void*)(msg & (~1));
4703 msg_conv.is_owned = false;
4704 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fulfill_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4708 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4709 LDKPublicKey their_node_id_ref;
4710 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4711 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4712 LDKUpdateFulfillHTLC msg_conv;
4713 msg_conv.inner = (void*)(msg & (~1));
4714 msg_conv.is_owned = false;
4715 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4719 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4720 LDKPublicKey their_node_id_ref;
4721 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4722 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4723 LDKUpdateFailHTLC msg_conv;
4724 msg_conv.inner = (void*)(msg & (~1));
4725 msg_conv.is_owned = false;
4726 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4730 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4731 LDKPublicKey their_node_id_ref;
4732 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4733 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4734 LDKUpdateFailMalformedHTLC msg_conv;
4735 msg_conv.inner = (void*)(msg & (~1));
4736 msg_conv.is_owned = false;
4737 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4741 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4742 LDKPublicKey their_node_id_ref;
4743 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4744 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4745 LDKCommitmentSigned msg_conv;
4746 msg_conv.inner = (void*)(msg & (~1));
4747 msg_conv.is_owned = false;
4748 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1revoke_1and_1ack(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4752 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4753 LDKPublicKey their_node_id_ref;
4754 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4755 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4756 LDKRevokeAndACK msg_conv;
4757 msg_conv.inner = (void*)(msg & (~1));
4758 msg_conv.is_owned = false;
4759 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fee(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4763 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4764 LDKPublicKey their_node_id_ref;
4765 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4766 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4767 LDKUpdateFee msg_conv;
4768 msg_conv.inner = (void*)(msg & (~1));
4769 msg_conv.is_owned = false;
4770 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1announcement_1signatures(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4774 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4775 LDKPublicKey their_node_id_ref;
4776 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4777 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4778 LDKAnnouncementSignatures msg_conv;
4779 msg_conv.inner = (void*)(msg & (~1));
4780 msg_conv.is_owned = false;
4781 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, jboolean no_connection_possible) {
4785 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4786 LDKPublicKey their_node_id_ref;
4787 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4788 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4789 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4793 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4794 LDKPublicKey their_node_id_ref;
4795 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4796 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4798 msg_conv.inner = (void*)(msg & (~1));
4799 msg_conv.is_owned = false;
4800 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4804 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4805 LDKPublicKey their_node_id_ref;
4806 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4807 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4808 LDKChannelReestablish msg_conv;
4809 msg_conv.inner = (void*)(msg & (~1));
4810 msg_conv.is_owned = false;
4811 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4815 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4816 LDKPublicKey their_node_id_ref;
4817 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4818 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4819 LDKErrorMessage msg_conv;
4820 msg_conv.inner = (void*)(msg & (~1));
4821 msg_conv.is_owned = false;
4822 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4825 typedef struct LDKRoutingMessageHandler_JCalls {
4826 atomic_size_t refcnt;
4829 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4830 jmethodID handle_node_announcement_meth;
4831 jmethodID handle_channel_announcement_meth;
4832 jmethodID handle_channel_update_meth;
4833 jmethodID handle_htlc_fail_channel_update_meth;
4834 jmethodID get_next_channel_announcements_meth;
4835 jmethodID get_next_node_announcements_meth;
4836 jmethodID sync_routing_table_meth;
4837 jmethodID handle_reply_channel_range_meth;
4838 jmethodID handle_reply_short_channel_ids_end_meth;
4839 jmethodID handle_query_channel_range_meth;
4840 jmethodID handle_query_short_channel_ids_meth;
4841 } LDKRoutingMessageHandler_JCalls;
4842 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4843 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4844 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4846 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4847 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4851 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4852 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4854 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4855 LDKNodeAnnouncement msg_var = *msg;
4856 msg_var = NodeAnnouncement_clone(msg);
4857 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4858 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4859 long msg_ref = (long)msg_var.inner;
4860 if (msg_var.is_owned) {
4863 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4865 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
4866 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4867 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4870 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4871 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4873 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4874 LDKChannelAnnouncement msg_var = *msg;
4875 msg_var = ChannelAnnouncement_clone(msg);
4876 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4877 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4878 long msg_ref = (long)msg_var.inner;
4879 if (msg_var.is_owned) {
4882 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4884 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
4885 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4886 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4889 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
4890 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4892 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4893 LDKChannelUpdate msg_var = *msg;
4894 msg_var = ChannelUpdate_clone(msg);
4895 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4896 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4897 long msg_ref = (long)msg_var.inner;
4898 if (msg_var.is_owned) {
4901 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4903 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
4904 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
4905 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)ret);
4908 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
4909 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4911 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4912 long ret_update = (long)update;
4913 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4915 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4917 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4918 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4920 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4921 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4923 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4924 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4925 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
4926 if (arg_constr.datalen > 0)
4927 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4929 arg_constr.data = NULL;
4930 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
4931 for (size_t l = 0; l < arg_constr.datalen; l++) {
4932 int64_t arr_conv_63 = arg_vals[l];
4933 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
4934 FREE((void*)arr_conv_63);
4935 arg_constr.data[l] = arr_conv_63_conv;
4937 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
4940 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4941 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4943 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4944 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
4945 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
4946 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4948 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4949 LDKCVec_NodeAnnouncementZ arg_constr;
4950 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
4951 if (arg_constr.datalen > 0)
4952 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4954 arg_constr.data = NULL;
4955 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
4956 for (size_t s = 0; s < arg_constr.datalen; s++) {
4957 int64_t arr_conv_18 = arg_vals[s];
4958 LDKNodeAnnouncement arr_conv_18_conv;
4959 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4960 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4961 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4962 arg_constr.data[s] = arr_conv_18_conv;
4964 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
4967 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
4968 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4970 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4971 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4972 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4973 LDKInit init_var = *init;
4974 init_var = Init_clone(init);
4975 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4976 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4977 long init_ref = (long)init_var.inner;
4978 if (init_var.is_owned) {
4981 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4983 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
4985 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
4986 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4988 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4989 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4990 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4991 LDKReplyChannelRange msg_var = msg;
4992 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4993 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4994 long msg_ref = (long)msg_var.inner;
4995 if (msg_var.is_owned) {
4998 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5000 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5001 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5002 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5005 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5006 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5008 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5009 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5010 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5011 LDKReplyShortChannelIdsEnd msg_var = msg;
5012 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5013 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5014 long msg_ref = (long)msg_var.inner;
5015 if (msg_var.is_owned) {
5018 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5020 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5021 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5022 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5025 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5026 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5028 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5029 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5030 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5031 LDKQueryChannelRange msg_var = msg;
5032 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5033 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5034 long msg_ref = (long)msg_var.inner;
5035 if (msg_var.is_owned) {
5038 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5040 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5041 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5042 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5045 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5046 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5048 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5049 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5050 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5051 LDKQueryShortChannelIds msg_var = msg;
5052 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5053 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5054 long msg_ref = (long)msg_var.inner;
5055 if (msg_var.is_owned) {
5058 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5060 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5061 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
5062 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)ret);
5065 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5066 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5067 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5068 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5069 return (void*) this_arg;
5071 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5072 jclass c = (*env)->GetObjectClass(env, o);
5074 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5075 atomic_init(&calls->refcnt, 1);
5076 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5077 calls->o = (*env)->NewWeakGlobalRef(env, o);
5078 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
5079 CHECK(calls->handle_node_announcement_meth != NULL);
5080 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
5081 CHECK(calls->handle_channel_announcement_meth != NULL);
5082 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
5083 CHECK(calls->handle_channel_update_meth != NULL);
5084 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
5085 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
5086 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
5087 CHECK(calls->get_next_channel_announcements_meth != NULL);
5088 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
5089 CHECK(calls->get_next_node_announcements_meth != NULL);
5090 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
5091 CHECK(calls->sync_routing_table_meth != NULL);
5092 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
5093 CHECK(calls->handle_reply_channel_range_meth != NULL);
5094 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
5095 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
5096 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
5097 CHECK(calls->handle_query_channel_range_meth != NULL);
5098 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
5099 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
5101 LDKRoutingMessageHandler ret = {
5102 .this_arg = (void*) calls,
5103 .handle_node_announcement = handle_node_announcement_jcall,
5104 .handle_channel_announcement = handle_channel_announcement_jcall,
5105 .handle_channel_update = handle_channel_update_jcall,
5106 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
5107 .get_next_channel_announcements = get_next_channel_announcements_jcall,
5108 .get_next_node_announcements = get_next_node_announcements_jcall,
5109 .sync_routing_table = sync_routing_table_jcall,
5110 .handle_reply_channel_range = handle_reply_channel_range_jcall,
5111 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
5112 .handle_query_channel_range = handle_query_channel_range_jcall,
5113 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5114 .free = LDKRoutingMessageHandler_JCalls_free,
5115 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5117 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5120 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5121 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5122 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5123 return (long)res_ptr;
5125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5126 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5127 LDKNodeAnnouncement msg_conv;
5128 msg_conv.inner = (void*)(msg & (~1));
5129 msg_conv.is_owned = false;
5130 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5131 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5132 return (long)ret_conv;
5135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5136 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5137 LDKChannelAnnouncement msg_conv;
5138 msg_conv.inner = (void*)(msg & (~1));
5139 msg_conv.is_owned = false;
5140 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5141 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5142 return (long)ret_conv;
5145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5146 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5147 LDKChannelUpdate msg_conv;
5148 msg_conv.inner = (void*)(msg & (~1));
5149 msg_conv.is_owned = false;
5150 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5151 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5152 return (long)ret_conv;
5155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
5156 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5157 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5158 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5161 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
5162 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5163 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5164 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5165 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5166 for (size_t l = 0; l < ret_var.datalen; l++) {
5167 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5168 *arr_conv_63_ref = ret_var.data[l];
5169 ret_arr_ptr[l] = (long)arr_conv_63_ref;
5171 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5176 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
5177 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5178 LDKPublicKey starting_point_ref;
5179 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
5180 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
5181 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5182 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5183 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5184 for (size_t s = 0; s < ret_var.datalen; s++) {
5185 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
5186 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5187 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5188 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
5189 if (arr_conv_18_var.is_owned) {
5190 arr_conv_18_ref |= 1;
5192 ret_arr_ptr[s] = arr_conv_18_ref;
5194 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
5200 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5201 LDKPublicKey their_node_id_ref;
5202 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5203 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5205 init_conv.inner = (void*)(init & (~1));
5206 init_conv.is_owned = false;
5207 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5211 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5212 LDKPublicKey their_node_id_ref;
5213 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5214 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5215 LDKReplyChannelRange msg_conv;
5216 msg_conv.inner = (void*)(msg & (~1));
5217 msg_conv.is_owned = (msg & 1) || (msg == 0);
5218 msg_conv = ReplyChannelRange_clone(&msg_conv);
5219 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5220 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5221 return (long)ret_conv;
5224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5225 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5226 LDKPublicKey their_node_id_ref;
5227 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5228 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5229 LDKReplyShortChannelIdsEnd msg_conv;
5230 msg_conv.inner = (void*)(msg & (~1));
5231 msg_conv.is_owned = (msg & 1) || (msg == 0);
5232 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5233 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5234 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5235 return (long)ret_conv;
5238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5239 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5240 LDKPublicKey their_node_id_ref;
5241 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5242 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5243 LDKQueryChannelRange msg_conv;
5244 msg_conv.inner = (void*)(msg & (~1));
5245 msg_conv.is_owned = (msg & 1) || (msg == 0);
5246 msg_conv = QueryChannelRange_clone(&msg_conv);
5247 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5248 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5249 return (long)ret_conv;
5252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
5253 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5254 LDKPublicKey their_node_id_ref;
5255 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5256 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5257 LDKQueryShortChannelIds msg_conv;
5258 msg_conv.inner = (void*)(msg & (~1));
5259 msg_conv.is_owned = (msg & 1) || (msg == 0);
5260 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5261 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5262 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5263 return (long)ret_conv;
5266 typedef struct LDKSocketDescriptor_JCalls {
5267 atomic_size_t refcnt;
5270 jmethodID send_data_meth;
5271 jmethodID disconnect_socket_meth;
5273 jmethodID hash_meth;
5274 } LDKSocketDescriptor_JCalls;
5275 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5276 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5277 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5279 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5280 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5284 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5285 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5287 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5288 LDKu8slice data_var = data;
5289 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
5290 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
5291 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5293 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
5295 void disconnect_socket_jcall(void* this_arg) {
5296 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5298 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5299 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5301 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
5303 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5304 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5306 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5307 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5308 *other_arg_clone = SocketDescriptor_clone(other_arg);
5309 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5311 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
5313 uint64_t hash_jcall(const void* this_arg) {
5314 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5316 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5317 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5319 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
5321 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5322 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5323 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5324 return (void*) this_arg;
5326 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
5327 jclass c = (*env)->GetObjectClass(env, o);
5329 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5330 atomic_init(&calls->refcnt, 1);
5331 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5332 calls->o = (*env)->NewWeakGlobalRef(env, o);
5333 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
5334 CHECK(calls->send_data_meth != NULL);
5335 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
5336 CHECK(calls->disconnect_socket_meth != NULL);
5337 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
5338 CHECK(calls->eq_meth != NULL);
5339 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
5340 CHECK(calls->hash_meth != NULL);
5342 LDKSocketDescriptor ret = {
5343 .this_arg = (void*) calls,
5344 .send_data = send_data_jcall,
5345 .disconnect_socket = disconnect_socket_jcall,
5348 .clone = LDKSocketDescriptor_JCalls_clone,
5349 .free = LDKSocketDescriptor_JCalls_free,
5353 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
5354 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5355 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
5356 return (long)res_ptr;
5358 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
5359 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5360 LDKu8slice data_ref;
5361 data_ref.datalen = (*env)->GetArrayLength(env, data);
5362 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
5363 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5364 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
5368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
5369 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5370 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
5374 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5375 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
5380 LDKTransaction _res_ref;
5381 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
5382 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5383 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
5384 _res_ref.data_is_owned = true;
5385 Transaction_free(_res_ref);
5388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
5389 if ((_res & 1) != 0) return;
5390 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
5392 TxOut_free(_res_conv);
5395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5396 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
5397 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5398 *ret_ref = TxOut_clone(orig_conv);
5399 return (long)ret_ref;
5402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5403 LDKCVec_SpendableOutputDescriptorZ _res_constr;
5404 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5405 if (_res_constr.datalen > 0)
5406 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5408 _res_constr.data = NULL;
5409 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5410 for (size_t b = 0; b < _res_constr.datalen; b++) {
5411 int64_t arr_conv_27 = _res_vals[b];
5412 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_conv_27) & ~1);
5413 FREE((void*)arr_conv_27);
5414 _res_constr.data[b] = arr_conv_27_conv;
5416 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5417 CVec_SpendableOutputDescriptorZ_free(_res_constr);
5420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5421 LDKCVec_MessageSendEventZ _res_constr;
5422 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5423 if (_res_constr.datalen > 0)
5424 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5426 _res_constr.data = NULL;
5427 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5428 for (size_t s = 0; s < _res_constr.datalen; s++) {
5429 int64_t arr_conv_18 = _res_vals[s];
5430 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_conv_18) & ~1);
5431 FREE((void*)arr_conv_18);
5432 _res_constr.data[s] = arr_conv_18_conv;
5434 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5435 CVec_MessageSendEventZ_free(_res_constr);
5438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5439 LDKCVec_EventZ _res_constr;
5440 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5441 if (_res_constr.datalen > 0)
5442 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5444 _res_constr.data = NULL;
5445 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5446 for (size_t h = 0; h < _res_constr.datalen; h++) {
5447 int64_t arr_conv_7 = _res_vals[h];
5448 LDKEvent arr_conv_7_conv = *(LDKEvent*)(((uint64_t)arr_conv_7) & ~1);
5449 FREE((void*)arr_conv_7);
5450 _res_constr.data[h] = arr_conv_7_conv;
5452 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5453 CVec_EventZ_free(_res_constr);
5456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5457 if ((_res & 1) != 0) return;
5458 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
5460 C2Tuple_usizeTransactionZ_free(_res_conv);
5463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, intptr_t a, int8_tArray b) {
5464 LDKTransaction b_ref;
5465 b_ref.datalen = (*env)->GetArrayLength(env, b);
5466 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5467 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5468 b_ref.data_is_owned = true;
5469 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5470 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5471 return (long)ret_ref;
5474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5475 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
5476 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5477 if (_res_constr.datalen > 0)
5478 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5480 _res_constr.data = NULL;
5481 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5482 for (size_t y = 0; y < _res_constr.datalen; y++) {
5483 int64_t arr_conv_24 = _res_vals[y];
5484 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
5485 FREE((void*)arr_conv_24);
5486 _res_constr.data[y] = arr_conv_24_conv;
5488 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5489 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
5492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
5493 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5494 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5495 return (long)ret_conv;
5498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
5499 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
5500 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5501 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
5502 return (long)ret_conv;
5505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5506 if ((_res & 1) != 0) return;
5507 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
5509 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
5512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5513 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
5514 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5515 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
5516 return (long)ret_conv;
5519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5520 LDKCVec_MonitorEventZ _res_constr;
5521 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5522 if (_res_constr.datalen > 0)
5523 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5525 _res_constr.data = NULL;
5526 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5527 for (size_t o = 0; o < _res_constr.datalen; o++) {
5528 int64_t arr_conv_14 = _res_vals[o];
5529 LDKMonitorEvent arr_conv_14_conv;
5530 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5531 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5532 _res_constr.data[o] = arr_conv_14_conv;
5534 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5535 CVec_MonitorEventZ_free(_res_constr);
5538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5539 LDKChannelMonitorUpdate o_conv;
5540 o_conv.inner = (void*)(o & (~1));
5541 o_conv.is_owned = (o & 1) || (o == 0);
5542 o_conv = ChannelMonitorUpdate_clone(&o_conv);
5543 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5544 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
5545 return (long)ret_conv;
5548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5549 LDKDecodeError e_conv;
5550 e_conv.inner = (void*)(e & (~1));
5551 e_conv.is_owned = (e & 1) || (e == 0);
5552 e_conv = DecodeError_clone(&e_conv);
5553 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5554 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
5555 return (long)ret_conv;
5558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5559 if ((_res & 1) != 0) return;
5560 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
5562 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
5565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
5566 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5567 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5568 return (long)ret_conv;
5571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5572 LDKMonitorUpdateError e_conv;
5573 e_conv.inner = (void*)(e & (~1));
5574 e_conv.is_owned = (e & 1) || (e == 0);
5575 e_conv = MonitorUpdateError_clone(&e_conv);
5576 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5577 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
5578 return (long)ret_conv;
5581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5582 if ((_res & 1) != 0) return;
5583 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
5585 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
5588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5589 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
5590 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5591 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
5592 return (long)ret_conv;
5595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5596 if ((_res & 1) != 0) return;
5597 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
5599 C2Tuple_OutPointScriptZ_free(_res_conv);
5602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
5604 a_conv.inner = (void*)(a & (~1));
5605 a_conv.is_owned = (a & 1) || (a == 0);
5606 a_conv = OutPoint_clone(&a_conv);
5608 b_ref.datalen = (*env)->GetArrayLength(env, b);
5609 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5610 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5611 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5612 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5613 return (long)ret_ref;
5616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5617 LDKCVec_TransactionZ _res_constr;
5618 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5619 if (_res_constr.datalen > 0)
5620 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5622 _res_constr.data = NULL;
5623 for (size_t i = 0; i < _res_constr.datalen; i++) {
5624 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5625 LDKTransaction arr_conv_8_ref;
5626 arr_conv_8_ref.datalen = (*env)->GetArrayLength(env, arr_conv_8);
5627 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5628 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5629 arr_conv_8_ref.data_is_owned = true;
5630 _res_constr.data[i] = arr_conv_8_ref;
5632 CVec_TransactionZ_free(_res_constr);
5635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5636 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
5637 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5638 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
5639 return (long)ret_ref;
5642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5643 if ((_res & 1) != 0) return;
5644 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
5646 C2Tuple_u32TxOutZ_free(_res_conv);
5649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5650 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
5652 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5653 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
5654 return (long)ret_ref;
5657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5658 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
5659 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5660 if (_res_constr.datalen > 0)
5661 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5663 _res_constr.data = NULL;
5664 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5665 for (size_t a = 0; a < _res_constr.datalen; a++) {
5666 int64_t arr_conv_26 = _res_vals[a];
5667 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
5668 FREE((void*)arr_conv_26);
5669 _res_constr.data[a] = arr_conv_26_conv;
5671 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5672 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
5675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5676 if ((_res & 1) != 0) return;
5677 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
5679 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
5682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5683 LDKThirtyTwoBytes a_ref;
5684 CHECK((*env)->GetArrayLength(env, a) == 32);
5685 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5686 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5687 b_constr.datalen = (*env)->GetArrayLength(env, b);
5688 if (b_constr.datalen > 0)
5689 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5691 b_constr.data = NULL;
5692 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5693 for (size_t a = 0; a < b_constr.datalen; a++) {
5694 int64_t arr_conv_26 = b_vals[a];
5695 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_conv_26) & ~1);
5696 FREE((void*)arr_conv_26);
5697 b_constr.data[a] = arr_conv_26_conv;
5699 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5700 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5701 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
5702 return (long)ret_ref;
5705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5706 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
5707 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5708 if (_res_constr.datalen > 0)
5709 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
5711 _res_constr.data = NULL;
5712 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5713 for (size_t u = 0; u < _res_constr.datalen; u++) {
5714 int64_t arr_conv_46 = _res_vals[u];
5715 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_conv_46) & ~1);
5716 FREE((void*)arr_conv_46);
5717 _res_constr.data[u] = arr_conv_46_conv;
5719 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5720 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
5723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5724 if ((_res & 1) != 0) return;
5725 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
5727 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
5730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5731 LDKThirtyTwoBytes a_ref;
5732 CHECK((*env)->GetArrayLength(env, a) == 32);
5733 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5734 LDKChannelMonitor b_conv;
5735 b_conv.inner = (void*)(b & (~1));
5736 b_conv.is_owned = (b & 1) || (b == 0);
5737 b_conv = ChannelMonitor_clone(&b_conv);
5738 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5739 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
5740 return (long)ret_ref;
5743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5744 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
5746 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5747 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
5748 return (long)ret_conv;
5751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5752 LDKDecodeError e_conv;
5753 e_conv.inner = (void*)(e & (~1));
5754 e_conv.is_owned = (e & 1) || (e == 0);
5755 e_conv = DecodeError_clone(&e_conv);
5756 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5757 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
5758 return (long)ret_conv;
5761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5762 if ((_res & 1) != 0) return;
5763 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
5765 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
5768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5769 LDKC2Tuple_u64u64Z* orig_conv = (LDKC2Tuple_u64u64Z*)(orig & ~1);
5770 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5771 *ret_ref = C2Tuple_u64u64Z_clone(orig_conv);
5772 return (long)ret_ref;
5775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
5776 if ((_res & 1) != 0) return;
5777 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)_res) & ~1);
5779 C2Tuple_u64u64Z_free(_res_conv);
5782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
5783 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5784 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5785 return (long)ret_ref;
5788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5789 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
5791 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5792 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
5793 return (long)ret_conv;
5796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5797 LDKDecodeError e_conv;
5798 e_conv.inner = (void*)(e & (~1));
5799 e_conv.is_owned = (e & 1) || (e == 0);
5800 e_conv = DecodeError_clone(&e_conv);
5801 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5802 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
5803 return (long)ret_conv;
5806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5807 if ((_res & 1) != 0) return;
5808 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
5810 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
5813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5814 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
5815 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5816 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
5817 return (long)ret_conv;
5820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5821 LDKCVec_SignatureZ _res_constr;
5822 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5823 if (_res_constr.datalen > 0)
5824 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5826 _res_constr.data = NULL;
5827 for (size_t i = 0; i < _res_constr.datalen; i++) {
5828 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5829 LDKSignature arr_conv_8_ref;
5830 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5831 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5832 _res_constr.data[i] = arr_conv_8_ref;
5834 CVec_SignatureZ_free(_res_constr);
5837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5838 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
5839 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5840 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
5841 return (long)ret_ref;
5844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5845 if ((_res & 1) != 0) return;
5846 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
5848 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
5851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
5853 CHECK((*env)->GetArrayLength(env, a) == 64);
5854 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
5855 LDKCVec_SignatureZ b_constr;
5856 b_constr.datalen = (*env)->GetArrayLength(env, b);
5857 if (b_constr.datalen > 0)
5858 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5860 b_constr.data = NULL;
5861 for (size_t i = 0; i < b_constr.datalen; i++) {
5862 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
5863 LDKSignature arr_conv_8_ref;
5864 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5865 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5866 b_constr.data[i] = arr_conv_8_ref;
5868 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5869 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5870 return (long)ret_ref;
5873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5874 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
5876 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5877 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
5878 return (long)ret_conv;
5881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
5882 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5883 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5884 return (long)ret_conv;
5887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5888 if ((_res & 1) != 0) return;
5889 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
5891 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
5894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5895 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
5896 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5897 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
5898 return (long)ret_conv;
5901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
5903 CHECK((*env)->GetArrayLength(env, o) == 64);
5904 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
5905 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5906 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
5907 return (long)ret_conv;
5910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
5911 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5912 *ret_conv = CResult_SignatureNoneZ_err();
5913 return (long)ret_conv;
5916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5917 if ((_res & 1) != 0) return;
5918 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
5920 CResult_SignatureNoneZ_free(_res_conv);
5923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5924 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
5925 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5926 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
5927 return (long)ret_conv;
5930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5931 LDKChannelKeys o_conv = *(LDKChannelKeys*)(((uint64_t)o) & ~1);
5932 if (o_conv.free == LDKChannelKeys_JCalls_free) {
5933 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5934 LDKChannelKeys_JCalls_clone(o_conv.this_arg);
5936 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5937 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
5938 return (long)ret_conv;
5941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5942 LDKDecodeError e_conv;
5943 e_conv.inner = (void*)(e & (~1));
5944 e_conv.is_owned = (e & 1) || (e == 0);
5945 e_conv = DecodeError_clone(&e_conv);
5946 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5947 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
5948 return (long)ret_conv;
5951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5952 if ((_res & 1) != 0) return;
5953 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
5955 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
5958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5959 LDKCResult_ChanKeySignerDecodeErrorZ* orig_conv = (LDKCResult_ChanKeySignerDecodeErrorZ*)(orig & ~1);
5960 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
5961 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_clone(orig_conv);
5962 return (long)ret_conv;
5965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5966 LDKInMemoryChannelKeys o_conv;
5967 o_conv.inner = (void*)(o & (~1));
5968 o_conv.is_owned = (o & 1) || (o == 0);
5969 o_conv = InMemoryChannelKeys_clone(&o_conv);
5970 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5971 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
5972 return (long)ret_conv;
5975 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5976 LDKDecodeError e_conv;
5977 e_conv.inner = (void*)(e & (~1));
5978 e_conv.is_owned = (e & 1) || (e == 0);
5979 e_conv = DecodeError_clone(&e_conv);
5980 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
5981 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
5982 return (long)ret_conv;
5985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5986 if ((_res & 1) != 0) return;
5987 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
5989 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
5992 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5993 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
5995 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
5996 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
5997 return (long)ret_conv;
6000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6001 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
6002 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6003 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6004 return (long)ret_conv;
6007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6008 if ((_res & 1) != 0) return;
6009 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
6011 CResult_TxOutAccessErrorZ_free(_res_conv);
6014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6015 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
6016 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6017 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
6018 return (long)ret_conv;
6021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
6022 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6023 *ret_conv = CResult_NoneAPIErrorZ_ok();
6024 return (long)ret_conv;
6027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6028 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
6030 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6031 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6032 return (long)ret_conv;
6035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6036 if ((_res & 1) != 0) return;
6037 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
6039 CResult_NoneAPIErrorZ_free(_res_conv);
6042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6043 LDKCVec_ChannelDetailsZ _res_constr;
6044 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6045 if (_res_constr.datalen > 0)
6046 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6048 _res_constr.data = NULL;
6049 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6050 for (size_t q = 0; q < _res_constr.datalen; q++) {
6051 int64_t arr_conv_16 = _res_vals[q];
6052 LDKChannelDetails arr_conv_16_conv;
6053 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6054 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6055 _res_constr.data[q] = arr_conv_16_conv;
6057 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6058 CVec_ChannelDetailsZ_free(_res_constr);
6061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
6062 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6063 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
6064 return (long)ret_conv;
6067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6068 LDKPaymentSendFailure e_conv;
6069 e_conv.inner = (void*)(e & (~1));
6070 e_conv.is_owned = (e & 1) || (e == 0);
6071 e_conv = PaymentSendFailure_clone(&e_conv);
6072 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6073 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
6074 return (long)ret_conv;
6077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6078 if ((_res & 1) != 0) return;
6079 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
6081 CResult_NonePaymentSendFailureZ_free(_res_conv);
6084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6085 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
6086 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6087 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
6088 return (long)ret_conv;
6091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6092 LDKCVec_NetAddressZ _res_constr;
6093 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6094 if (_res_constr.datalen > 0)
6095 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6097 _res_constr.data = NULL;
6098 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6099 for (size_t m = 0; m < _res_constr.datalen; m++) {
6100 int64_t arr_conv_12 = _res_vals[m];
6101 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
6102 FREE((void*)arr_conv_12);
6103 _res_constr.data[m] = arr_conv_12_conv;
6105 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6106 CVec_NetAddressZ_free(_res_constr);
6109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6110 LDKCVec_ChannelMonitorZ _res_constr;
6111 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6112 if (_res_constr.datalen > 0)
6113 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6115 _res_constr.data = NULL;
6116 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6117 for (size_t q = 0; q < _res_constr.datalen; q++) {
6118 int64_t arr_conv_16 = _res_vals[q];
6119 LDKChannelMonitor arr_conv_16_conv;
6120 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6121 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6122 _res_constr.data[q] = arr_conv_16_conv;
6124 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6125 CVec_ChannelMonitorZ_free(_res_constr);
6128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6129 if ((_res & 1) != 0) return;
6130 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
6132 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
6136 LDKThirtyTwoBytes a_ref;
6137 CHECK((*env)->GetArrayLength(env, a) == 32);
6138 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
6139 LDKChannelManager b_conv;
6140 b_conv.inner = (void*)(b & (~1));
6141 b_conv.is_owned = (b & 1) || (b == 0);
6142 // Warning: we need a move here but no clone is available for LDKChannelManager
6143 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6144 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6145 return (long)ret_ref;
6148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6149 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
6151 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6152 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6153 return (long)ret_conv;
6156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6157 LDKDecodeError e_conv;
6158 e_conv.inner = (void*)(e & (~1));
6159 e_conv.is_owned = (e & 1) || (e == 0);
6160 e_conv = DecodeError_clone(&e_conv);
6161 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6162 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6163 return (long)ret_conv;
6166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6167 if ((_res & 1) != 0) return;
6168 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6170 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
6174 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
6176 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6177 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
6178 return (long)ret_conv;
6181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
6182 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6183 *ret_conv = CResult_NetAddressu8Z_err(e);
6184 return (long)ret_conv;
6187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
6188 if ((_res & 1) != 0) return;
6189 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
6191 CResult_NetAddressu8Z_free(_res_conv);
6194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6195 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
6196 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6197 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
6198 return (long)ret_conv;
6201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6202 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
6204 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6205 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
6206 return (long)ret_conv;
6209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6210 LDKDecodeError e_conv;
6211 e_conv.inner = (void*)(e & (~1));
6212 e_conv.is_owned = (e & 1) || (e == 0);
6213 e_conv = DecodeError_clone(&e_conv);
6214 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6215 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
6216 return (long)ret_conv;
6219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6220 if ((_res & 1) != 0) return;
6221 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
6223 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
6226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6227 LDKCVec_u64Z _res_constr;
6228 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6229 if (_res_constr.datalen > 0)
6230 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6232 _res_constr.data = NULL;
6233 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6234 for (size_t g = 0; g < _res_constr.datalen; g++) {
6235 int64_t arr_conv_6 = _res_vals[g];
6236 _res_constr.data[g] = arr_conv_6;
6238 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6239 CVec_u64Z_free(_res_constr);
6242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6243 LDKCVec_UpdateAddHTLCZ _res_constr;
6244 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6245 if (_res_constr.datalen > 0)
6246 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
6248 _res_constr.data = NULL;
6249 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6250 for (size_t p = 0; p < _res_constr.datalen; p++) {
6251 int64_t arr_conv_15 = _res_vals[p];
6252 LDKUpdateAddHTLC arr_conv_15_conv;
6253 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
6254 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
6255 _res_constr.data[p] = arr_conv_15_conv;
6257 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6258 CVec_UpdateAddHTLCZ_free(_res_constr);
6261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6262 LDKCVec_UpdateFulfillHTLCZ _res_constr;
6263 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6264 if (_res_constr.datalen > 0)
6265 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
6267 _res_constr.data = NULL;
6268 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6269 for (size_t t = 0; t < _res_constr.datalen; t++) {
6270 int64_t arr_conv_19 = _res_vals[t];
6271 LDKUpdateFulfillHTLC arr_conv_19_conv;
6272 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
6273 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
6274 _res_constr.data[t] = arr_conv_19_conv;
6276 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6277 CVec_UpdateFulfillHTLCZ_free(_res_constr);
6280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6281 LDKCVec_UpdateFailHTLCZ _res_constr;
6282 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6283 if (_res_constr.datalen > 0)
6284 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
6286 _res_constr.data = NULL;
6287 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6288 for (size_t q = 0; q < _res_constr.datalen; q++) {
6289 int64_t arr_conv_16 = _res_vals[q];
6290 LDKUpdateFailHTLC arr_conv_16_conv;
6291 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6292 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6293 _res_constr.data[q] = arr_conv_16_conv;
6295 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6296 CVec_UpdateFailHTLCZ_free(_res_constr);
6299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6300 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
6301 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6302 if (_res_constr.datalen > 0)
6303 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
6305 _res_constr.data = NULL;
6306 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6307 for (size_t z = 0; z < _res_constr.datalen; z++) {
6308 int64_t arr_conv_25 = _res_vals[z];
6309 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
6310 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
6311 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
6312 _res_constr.data[z] = arr_conv_25_conv;
6314 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6315 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
6318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6319 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6320 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6321 return (long)ret_conv;
6324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6325 LDKLightningError e_conv;
6326 e_conv.inner = (void*)(e & (~1));
6327 e_conv.is_owned = (e & 1) || (e == 0);
6328 e_conv = LightningError_clone(&e_conv);
6329 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6330 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6331 return (long)ret_conv;
6334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6335 if ((_res & 1) != 0) return;
6336 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
6338 CResult_boolLightningErrorZ_free(_res_conv);
6341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6342 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
6343 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6344 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
6345 return (long)ret_conv;
6348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6349 if ((_res & 1) != 0) return;
6350 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
6352 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b, int64_t c) {
6356 LDKChannelAnnouncement a_conv;
6357 a_conv.inner = (void*)(a & (~1));
6358 a_conv.is_owned = (a & 1) || (a == 0);
6359 a_conv = ChannelAnnouncement_clone(&a_conv);
6360 LDKChannelUpdate b_conv;
6361 b_conv.inner = (void*)(b & (~1));
6362 b_conv.is_owned = (b & 1) || (b == 0);
6363 b_conv = ChannelUpdate_clone(&b_conv);
6364 LDKChannelUpdate c_conv;
6365 c_conv.inner = (void*)(c & (~1));
6366 c_conv.is_owned = (c & 1) || (c == 0);
6367 c_conv = ChannelUpdate_clone(&c_conv);
6368 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6369 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6370 return (long)ret_ref;
6373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6374 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6375 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6376 if (_res_constr.datalen > 0)
6377 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6379 _res_constr.data = NULL;
6380 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6381 for (size_t l = 0; l < _res_constr.datalen; l++) {
6382 int64_t arr_conv_63 = _res_vals[l];
6383 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_conv_63) & ~1);
6384 FREE((void*)arr_conv_63);
6385 _res_constr.data[l] = arr_conv_63_conv;
6387 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6388 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6392 LDKCVec_NodeAnnouncementZ _res_constr;
6393 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6394 if (_res_constr.datalen > 0)
6395 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6397 _res_constr.data = NULL;
6398 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6399 for (size_t s = 0; s < _res_constr.datalen; s++) {
6400 int64_t arr_conv_18 = _res_vals[s];
6401 LDKNodeAnnouncement arr_conv_18_conv;
6402 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
6403 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
6404 _res_constr.data[s] = arr_conv_18_conv;
6406 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6407 CVec_NodeAnnouncementZ_free(_res_constr);
6410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6411 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6412 *ret_conv = CResult_NoneLightningErrorZ_ok();
6413 return (long)ret_conv;
6416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6417 LDKLightningError e_conv;
6418 e_conv.inner = (void*)(e & (~1));
6419 e_conv.is_owned = (e & 1) || (e == 0);
6420 e_conv = LightningError_clone(&e_conv);
6421 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6422 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6423 return (long)ret_conv;
6426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6427 if ((_res & 1) != 0) return;
6428 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
6430 CResult_NoneLightningErrorZ_free(_res_conv);
6433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6434 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
6435 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6436 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
6437 return (long)ret_conv;
6440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6441 LDKChannelReestablish o_conv;
6442 o_conv.inner = (void*)(o & (~1));
6443 o_conv.is_owned = (o & 1) || (o == 0);
6444 o_conv = ChannelReestablish_clone(&o_conv);
6445 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6446 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
6447 return (long)ret_conv;
6450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6451 LDKDecodeError e_conv;
6452 e_conv.inner = (void*)(e & (~1));
6453 e_conv.is_owned = (e & 1) || (e == 0);
6454 e_conv = DecodeError_clone(&e_conv);
6455 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6456 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
6457 return (long)ret_conv;
6460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6461 if ((_res & 1) != 0) return;
6462 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
6464 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
6467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6469 o_conv.inner = (void*)(o & (~1));
6470 o_conv.is_owned = (o & 1) || (o == 0);
6471 o_conv = Init_clone(&o_conv);
6472 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6473 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
6474 return (long)ret_conv;
6477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6478 LDKDecodeError e_conv;
6479 e_conv.inner = (void*)(e & (~1));
6480 e_conv.is_owned = (e & 1) || (e == 0);
6481 e_conv = DecodeError_clone(&e_conv);
6482 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6483 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
6484 return (long)ret_conv;
6487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6488 if ((_res & 1) != 0) return;
6489 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
6491 CResult_InitDecodeErrorZ_free(_res_conv);
6494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6496 o_conv.inner = (void*)(o & (~1));
6497 o_conv.is_owned = (o & 1) || (o == 0);
6498 o_conv = Ping_clone(&o_conv);
6499 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6500 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
6501 return (long)ret_conv;
6504 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6505 LDKDecodeError e_conv;
6506 e_conv.inner = (void*)(e & (~1));
6507 e_conv.is_owned = (e & 1) || (e == 0);
6508 e_conv = DecodeError_clone(&e_conv);
6509 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6510 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
6511 return (long)ret_conv;
6514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6515 if ((_res & 1) != 0) return;
6516 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
6518 CResult_PingDecodeErrorZ_free(_res_conv);
6521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6523 o_conv.inner = (void*)(o & (~1));
6524 o_conv.is_owned = (o & 1) || (o == 0);
6525 o_conv = Pong_clone(&o_conv);
6526 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6527 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
6528 return (long)ret_conv;
6531 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6532 LDKDecodeError e_conv;
6533 e_conv.inner = (void*)(e & (~1));
6534 e_conv.is_owned = (e & 1) || (e == 0);
6535 e_conv = DecodeError_clone(&e_conv);
6536 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6537 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
6538 return (long)ret_conv;
6541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6542 if ((_res & 1) != 0) return;
6543 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
6545 CResult_PongDecodeErrorZ_free(_res_conv);
6548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6549 LDKUnsignedChannelAnnouncement o_conv;
6550 o_conv.inner = (void*)(o & (~1));
6551 o_conv.is_owned = (o & 1) || (o == 0);
6552 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
6553 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6554 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
6555 return (long)ret_conv;
6558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6559 LDKDecodeError e_conv;
6560 e_conv.inner = (void*)(e & (~1));
6561 e_conv.is_owned = (e & 1) || (e == 0);
6562 e_conv = DecodeError_clone(&e_conv);
6563 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6564 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
6565 return (long)ret_conv;
6568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6569 if ((_res & 1) != 0) return;
6570 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
6572 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
6575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6576 LDKUnsignedChannelUpdate o_conv;
6577 o_conv.inner = (void*)(o & (~1));
6578 o_conv.is_owned = (o & 1) || (o == 0);
6579 o_conv = UnsignedChannelUpdate_clone(&o_conv);
6580 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6581 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
6582 return (long)ret_conv;
6585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6586 LDKDecodeError e_conv;
6587 e_conv.inner = (void*)(e & (~1));
6588 e_conv.is_owned = (e & 1) || (e == 0);
6589 e_conv = DecodeError_clone(&e_conv);
6590 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6591 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
6592 return (long)ret_conv;
6595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6596 if ((_res & 1) != 0) return;
6597 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
6599 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
6602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6603 LDKErrorMessage o_conv;
6604 o_conv.inner = (void*)(o & (~1));
6605 o_conv.is_owned = (o & 1) || (o == 0);
6606 o_conv = ErrorMessage_clone(&o_conv);
6607 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6608 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
6609 return (long)ret_conv;
6612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6613 LDKDecodeError e_conv;
6614 e_conv.inner = (void*)(e & (~1));
6615 e_conv.is_owned = (e & 1) || (e == 0);
6616 e_conv = DecodeError_clone(&e_conv);
6617 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6618 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
6619 return (long)ret_conv;
6622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6623 if ((_res & 1) != 0) return;
6624 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
6626 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
6629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6630 LDKUnsignedNodeAnnouncement o_conv;
6631 o_conv.inner = (void*)(o & (~1));
6632 o_conv.is_owned = (o & 1) || (o == 0);
6633 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
6634 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6635 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
6636 return (long)ret_conv;
6639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6640 LDKDecodeError e_conv;
6641 e_conv.inner = (void*)(e & (~1));
6642 e_conv.is_owned = (e & 1) || (e == 0);
6643 e_conv = DecodeError_clone(&e_conv);
6644 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6645 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
6646 return (long)ret_conv;
6649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6650 if ((_res & 1) != 0) return;
6651 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
6653 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
6656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6657 LDKQueryShortChannelIds o_conv;
6658 o_conv.inner = (void*)(o & (~1));
6659 o_conv.is_owned = (o & 1) || (o == 0);
6660 o_conv = QueryShortChannelIds_clone(&o_conv);
6661 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6662 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
6663 return (long)ret_conv;
6666 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6667 LDKDecodeError e_conv;
6668 e_conv.inner = (void*)(e & (~1));
6669 e_conv.is_owned = (e & 1) || (e == 0);
6670 e_conv = DecodeError_clone(&e_conv);
6671 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6672 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
6673 return (long)ret_conv;
6676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6677 if ((_res & 1) != 0) return;
6678 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
6680 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
6683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6684 LDKReplyShortChannelIdsEnd o_conv;
6685 o_conv.inner = (void*)(o & (~1));
6686 o_conv.is_owned = (o & 1) || (o == 0);
6687 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
6688 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6689 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
6690 return (long)ret_conv;
6693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6694 LDKDecodeError e_conv;
6695 e_conv.inner = (void*)(e & (~1));
6696 e_conv.is_owned = (e & 1) || (e == 0);
6697 e_conv = DecodeError_clone(&e_conv);
6698 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6699 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
6700 return (long)ret_conv;
6703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6704 if ((_res & 1) != 0) return;
6705 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
6707 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
6710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6711 LDKQueryChannelRange o_conv;
6712 o_conv.inner = (void*)(o & (~1));
6713 o_conv.is_owned = (o & 1) || (o == 0);
6714 o_conv = QueryChannelRange_clone(&o_conv);
6715 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6716 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
6717 return (long)ret_conv;
6720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6721 LDKDecodeError e_conv;
6722 e_conv.inner = (void*)(e & (~1));
6723 e_conv.is_owned = (e & 1) || (e == 0);
6724 e_conv = DecodeError_clone(&e_conv);
6725 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6726 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
6727 return (long)ret_conv;
6730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6731 if ((_res & 1) != 0) return;
6732 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
6734 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
6737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6738 LDKReplyChannelRange o_conv;
6739 o_conv.inner = (void*)(o & (~1));
6740 o_conv.is_owned = (o & 1) || (o == 0);
6741 o_conv = ReplyChannelRange_clone(&o_conv);
6742 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6743 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
6744 return (long)ret_conv;
6747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6748 LDKDecodeError e_conv;
6749 e_conv.inner = (void*)(e & (~1));
6750 e_conv.is_owned = (e & 1) || (e == 0);
6751 e_conv = DecodeError_clone(&e_conv);
6752 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6753 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
6754 return (long)ret_conv;
6757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6758 if ((_res & 1) != 0) return;
6759 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
6761 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
6764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6765 LDKGossipTimestampFilter o_conv;
6766 o_conv.inner = (void*)(o & (~1));
6767 o_conv.is_owned = (o & 1) || (o == 0);
6768 o_conv = GossipTimestampFilter_clone(&o_conv);
6769 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6770 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
6771 return (long)ret_conv;
6774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6775 LDKDecodeError e_conv;
6776 e_conv.inner = (void*)(e & (~1));
6777 e_conv.is_owned = (e & 1) || (e == 0);
6778 e_conv = DecodeError_clone(&e_conv);
6779 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6780 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
6781 return (long)ret_conv;
6784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6785 if ((_res & 1) != 0) return;
6786 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
6788 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
6791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6792 LDKCVec_PublicKeyZ _res_constr;
6793 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6794 if (_res_constr.datalen > 0)
6795 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6797 _res_constr.data = NULL;
6798 for (size_t i = 0; i < _res_constr.datalen; i++) {
6799 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6800 LDKPublicKey arr_conv_8_ref;
6801 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 33);
6802 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
6803 _res_constr.data[i] = arr_conv_8_ref;
6805 CVec_PublicKeyZ_free(_res_constr);
6808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6809 LDKCVec_u8Z _res_ref;
6810 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6811 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6812 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6813 CVec_u8Z_free(_res_ref);
6816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6818 o_ref.datalen = (*env)->GetArrayLength(env, o);
6819 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6820 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
6821 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6822 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6823 return (long)ret_conv;
6826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6827 LDKPeerHandleError e_conv;
6828 e_conv.inner = (void*)(e & (~1));
6829 e_conv.is_owned = (e & 1) || (e == 0);
6830 e_conv = PeerHandleError_clone(&e_conv);
6831 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6832 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6833 return (long)ret_conv;
6836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6837 if ((_res & 1) != 0) return;
6838 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6840 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6844 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
6845 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6846 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
6847 return (long)ret_conv;
6850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
6851 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6852 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6853 return (long)ret_conv;
6856 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6857 LDKPeerHandleError e_conv;
6858 e_conv.inner = (void*)(e & (~1));
6859 e_conv.is_owned = (e & 1) || (e == 0);
6860 e_conv = PeerHandleError_clone(&e_conv);
6861 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6862 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6863 return (long)ret_conv;
6866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6867 if ((_res & 1) != 0) return;
6868 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6870 CResult_NonePeerHandleErrorZ_free(_res_conv);
6873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6874 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
6875 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6876 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
6877 return (long)ret_conv;
6880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6881 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6882 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6883 return (long)ret_conv;
6886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6887 LDKPeerHandleError e_conv;
6888 e_conv.inner = (void*)(e & (~1));
6889 e_conv.is_owned = (e & 1) || (e == 0);
6890 e_conv = PeerHandleError_clone(&e_conv);
6891 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6892 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6893 return (long)ret_conv;
6896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6897 if ((_res & 1) != 0) return;
6898 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
6900 CResult_boolPeerHandleErrorZ_free(_res_conv);
6903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6904 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
6905 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6906 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
6907 return (long)ret_conv;
6910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6912 CHECK((*env)->GetArrayLength(env, o) == 32);
6913 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6914 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6915 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
6916 return (long)ret_conv;
6919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6920 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6921 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6922 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
6923 return (long)ret_conv;
6926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6927 if ((_res & 1) != 0) return;
6928 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)(((uint64_t)_res) & ~1);
6930 CResult_SecretKeySecpErrorZ_free(_res_conv);
6933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6935 CHECK((*env)->GetArrayLength(env, o) == 33);
6936 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6937 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
6938 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
6939 return (long)ret_conv;
6942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6943 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6944 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
6945 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
6946 return (long)ret_conv;
6949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6950 if ((_res & 1) != 0) return;
6951 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)(((uint64_t)_res) & ~1);
6953 CResult_PublicKeySecpErrorZ_free(_res_conv);
6956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6957 LDKTxCreationKeys o_conv;
6958 o_conv.inner = (void*)(o & (~1));
6959 o_conv.is_owned = (o & 1) || (o == 0);
6960 o_conv = TxCreationKeys_clone(&o_conv);
6961 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
6962 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
6963 return (long)ret_conv;
6966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6967 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6968 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
6969 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
6970 return (long)ret_conv;
6973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6974 if ((_res & 1) != 0) return;
6975 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)(((uint64_t)_res) & ~1);
6977 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
6980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6981 LDKTrustedCommitmentTransaction o_conv;
6982 o_conv.inner = (void*)(o & (~1));
6983 o_conv.is_owned = (o & 1) || (o == 0);
6984 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
6985 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6986 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
6987 return (long)ret_conv;
6990 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
6991 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
6992 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
6993 return (long)ret_conv;
6996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6997 if ((_res & 1) != 0) return;
6998 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
7000 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
7004 LDKCVec_SignatureZ o_constr;
7005 o_constr.datalen = (*env)->GetArrayLength(env, o);
7006 if (o_constr.datalen > 0)
7007 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
7009 o_constr.data = NULL;
7010 for (size_t i = 0; i < o_constr.datalen; i++) {
7011 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
7012 LDKSignature arr_conv_8_ref;
7013 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
7014 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
7015 o_constr.data[i] = arr_conv_8_ref;
7017 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7018 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
7019 return (long)ret_conv;
7022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
7023 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7024 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
7025 return (long)ret_conv;
7028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7029 if ((_res & 1) != 0) return;
7030 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
7032 CResult_CVec_SignatureZNoneZ_free(_res_conv);
7035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7036 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
7037 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
7038 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
7039 return (long)ret_conv;
7042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7043 LDKCVec_RouteHopZ _res_constr;
7044 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7045 if (_res_constr.datalen > 0)
7046 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7048 _res_constr.data = NULL;
7049 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7050 for (size_t k = 0; k < _res_constr.datalen; k++) {
7051 int64_t arr_conv_10 = _res_vals[k];
7052 LDKRouteHop arr_conv_10_conv;
7053 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7054 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7055 _res_constr.data[k] = arr_conv_10_conv;
7057 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7058 CVec_RouteHopZ_free(_res_constr);
7061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7062 LDKCVec_CVec_RouteHopZZ _res_constr;
7063 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7064 if (_res_constr.datalen > 0)
7065 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7067 _res_constr.data = NULL;
7068 for (size_t m = 0; m < _res_constr.datalen; m++) {
7069 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
7070 LDKCVec_RouteHopZ arr_conv_12_constr;
7071 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
7072 if (arr_conv_12_constr.datalen > 0)
7073 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7075 arr_conv_12_constr.data = NULL;
7076 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
7077 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
7078 int64_t arr_conv_10 = arr_conv_12_vals[k];
7079 LDKRouteHop arr_conv_10_conv;
7080 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7081 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7082 arr_conv_12_constr.data[k] = arr_conv_10_conv;
7084 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
7085 _res_constr.data[m] = arr_conv_12_constr;
7087 CVec_CVec_RouteHopZZ_free(_res_constr);
7090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7092 o_conv.inner = (void*)(o & (~1));
7093 o_conv.is_owned = (o & 1) || (o == 0);
7094 o_conv = Route_clone(&o_conv);
7095 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7096 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7097 return (long)ret_conv;
7100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7101 LDKDecodeError e_conv;
7102 e_conv.inner = (void*)(e & (~1));
7103 e_conv.is_owned = (e & 1) || (e == 0);
7104 e_conv = DecodeError_clone(&e_conv);
7105 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7106 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7107 return (long)ret_conv;
7110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7111 if ((_res & 1) != 0) return;
7112 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
7114 CResult_RouteDecodeErrorZ_free(_res_conv);
7117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7118 LDKCVec_RouteHintZ _res_constr;
7119 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7120 if (_res_constr.datalen > 0)
7121 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7123 _res_constr.data = NULL;
7124 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7125 for (size_t l = 0; l < _res_constr.datalen; l++) {
7126 int64_t arr_conv_11 = _res_vals[l];
7127 LDKRouteHint arr_conv_11_conv;
7128 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
7129 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
7130 _res_constr.data[l] = arr_conv_11_conv;
7132 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7133 CVec_RouteHintZ_free(_res_constr);
7136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7138 o_conv.inner = (void*)(o & (~1));
7139 o_conv.is_owned = (o & 1) || (o == 0);
7140 o_conv = Route_clone(&o_conv);
7141 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7142 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7143 return (long)ret_conv;
7146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7147 LDKLightningError e_conv;
7148 e_conv.inner = (void*)(e & (~1));
7149 e_conv.is_owned = (e & 1) || (e == 0);
7150 e_conv = LightningError_clone(&e_conv);
7151 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7152 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7153 return (long)ret_conv;
7156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7157 if ((_res & 1) != 0) return;
7158 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
7160 CResult_RouteLightningErrorZ_free(_res_conv);
7163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7164 LDKRoutingFees o_conv;
7165 o_conv.inner = (void*)(o & (~1));
7166 o_conv.is_owned = (o & 1) || (o == 0);
7167 o_conv = RoutingFees_clone(&o_conv);
7168 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7169 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7170 return (long)ret_conv;
7173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7174 LDKDecodeError e_conv;
7175 e_conv.inner = (void*)(e & (~1));
7176 e_conv.is_owned = (e & 1) || (e == 0);
7177 e_conv = DecodeError_clone(&e_conv);
7178 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7179 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7180 return (long)ret_conv;
7183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7184 if ((_res & 1) != 0) return;
7185 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
7187 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7191 LDKNodeAnnouncementInfo o_conv;
7192 o_conv.inner = (void*)(o & (~1));
7193 o_conv.is_owned = (o & 1) || (o == 0);
7194 o_conv = NodeAnnouncementInfo_clone(&o_conv);
7195 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7196 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7197 return (long)ret_conv;
7200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7201 LDKDecodeError e_conv;
7202 e_conv.inner = (void*)(e & (~1));
7203 e_conv.is_owned = (e & 1) || (e == 0);
7204 e_conv = DecodeError_clone(&e_conv);
7205 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7206 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7207 return (long)ret_conv;
7210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7211 if ((_res & 1) != 0) return;
7212 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7214 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7218 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
7219 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7220 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
7221 return (long)ret_conv;
7224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7226 o_conv.inner = (void*)(o & (~1));
7227 o_conv.is_owned = (o & 1) || (o == 0);
7228 o_conv = NodeInfo_clone(&o_conv);
7229 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7230 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7231 return (long)ret_conv;
7234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7235 LDKDecodeError e_conv;
7236 e_conv.inner = (void*)(e & (~1));
7237 e_conv.is_owned = (e & 1) || (e == 0);
7238 e_conv = DecodeError_clone(&e_conv);
7239 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7240 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7241 return (long)ret_conv;
7244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7245 if ((_res & 1) != 0) return;
7246 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
7248 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7252 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
7253 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7254 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
7255 return (long)ret_conv;
7258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7259 LDKNetworkGraph o_conv;
7260 o_conv.inner = (void*)(o & (~1));
7261 o_conv.is_owned = (o & 1) || (o == 0);
7262 // Warning: we need a move here but no clone is available for LDKNetworkGraph
7263 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7264 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7265 return (long)ret_conv;
7268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7269 LDKDecodeError e_conv;
7270 e_conv.inner = (void*)(e & (~1));
7271 e_conv.is_owned = (e & 1) || (e == 0);
7272 e_conv = DecodeError_clone(&e_conv);
7273 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7274 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7275 return (long)ret_conv;
7278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7279 if ((_res & 1) != 0) return;
7280 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
7282 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7286 if ((this_ptr & 1) != 0) return;
7287 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
7288 FREE((void*)this_ptr);
7289 Event_free(this_ptr_conv);
7292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7293 LDKEvent* orig_conv = (LDKEvent*)orig;
7294 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
7295 *ret_copy = Event_clone(orig_conv);
7296 long ret_ref = (long)ret_copy;
7300 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
7301 LDKEvent* obj_conv = (LDKEvent*)obj;
7302 LDKCVec_u8Z arg_var = Event_write(obj_conv);
7303 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7304 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7305 CVec_u8Z_free(arg_var);
7309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7310 if ((this_ptr & 1) != 0) return;
7311 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
7312 FREE((void*)this_ptr);
7313 MessageSendEvent_free(this_ptr_conv);
7316 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7317 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
7318 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7319 *ret_copy = MessageSendEvent_clone(orig_conv);
7320 long ret_ref = (long)ret_copy;
7324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7325 if ((this_ptr & 1) != 0) return;
7326 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
7327 FREE((void*)this_ptr);
7328 MessageSendEventsProvider_free(this_ptr_conv);
7331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7332 if ((this_ptr & 1) != 0) return;
7333 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
7334 FREE((void*)this_ptr);
7335 EventsProvider_free(this_ptr_conv);
7338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7339 if ((this_ptr & 1) != 0) return;
7340 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
7341 FREE((void*)this_ptr);
7342 APIError_free(this_ptr_conv);
7345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7346 LDKAPIError* orig_conv = (LDKAPIError*)orig;
7347 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7348 *ret_copy = APIError_clone(orig_conv);
7349 long ret_ref = (long)ret_copy;
7353 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7354 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
7355 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
7359 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
7360 jclass ret_conv = LDKLevel_to_java(env, Level_max());
7364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7365 if ((this_ptr & 1) != 0) return;
7366 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
7367 FREE((void*)this_ptr);
7368 Logger_free(this_ptr_conv);
7371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7372 LDKChannelHandshakeConfig this_ptr_conv;
7373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7375 ChannelHandshakeConfig_free(this_ptr_conv);
7378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7379 LDKChannelHandshakeConfig orig_conv;
7380 orig_conv.inner = (void*)(orig & (~1));
7381 orig_conv.is_owned = false;
7382 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
7383 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7384 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7385 long ret_ref = (long)ret_var.inner;
7386 if (ret_var.is_owned) {
7392 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7393 LDKChannelHandshakeConfig this_ptr_conv;
7394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7395 this_ptr_conv.is_owned = false;
7396 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
7400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7401 LDKChannelHandshakeConfig this_ptr_conv;
7402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7403 this_ptr_conv.is_owned = false;
7404 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
7407 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7408 LDKChannelHandshakeConfig this_ptr_conv;
7409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7410 this_ptr_conv.is_owned = false;
7411 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
7415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
7416 LDKChannelHandshakeConfig this_ptr_conv;
7417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7418 this_ptr_conv.is_owned = false;
7419 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
7422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7423 LDKChannelHandshakeConfig this_ptr_conv;
7424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7425 this_ptr_conv.is_owned = false;
7426 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
7430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7431 LDKChannelHandshakeConfig this_ptr_conv;
7432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7433 this_ptr_conv.is_owned = false;
7434 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
7437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv *env, jclass clz, int32_t minimum_depth_arg, int16_t our_to_self_delay_arg, int64_t our_htlc_minimum_msat_arg) {
7438 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
7439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7441 long ret_ref = (long)ret_var.inner;
7442 if (ret_var.is_owned) {
7448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
7449 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
7450 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7451 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7452 long ret_ref = (long)ret_var.inner;
7453 if (ret_var.is_owned) {
7459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7460 LDKChannelHandshakeLimits this_ptr_conv;
7461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7462 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7463 ChannelHandshakeLimits_free(this_ptr_conv);
7466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7467 LDKChannelHandshakeLimits orig_conv;
7468 orig_conv.inner = (void*)(orig & (~1));
7469 orig_conv.is_owned = false;
7470 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
7471 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7472 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7473 long ret_ref = (long)ret_var.inner;
7474 if (ret_var.is_owned) {
7480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7481 LDKChannelHandshakeLimits this_ptr_conv;
7482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7483 this_ptr_conv.is_owned = false;
7484 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
7488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7489 LDKChannelHandshakeLimits this_ptr_conv;
7490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7491 this_ptr_conv.is_owned = false;
7492 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
7495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7496 LDKChannelHandshakeLimits this_ptr_conv;
7497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7498 this_ptr_conv.is_owned = false;
7499 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
7503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7504 LDKChannelHandshakeLimits this_ptr_conv;
7505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7506 this_ptr_conv.is_owned = false;
7507 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
7510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7511 LDKChannelHandshakeLimits this_ptr_conv;
7512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7513 this_ptr_conv.is_owned = false;
7514 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
7518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7519 LDKChannelHandshakeLimits this_ptr_conv;
7520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7521 this_ptr_conv.is_owned = false;
7522 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7525 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7526 LDKChannelHandshakeLimits this_ptr_conv;
7527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7528 this_ptr_conv.is_owned = false;
7529 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
7533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7534 LDKChannelHandshakeLimits this_ptr_conv;
7535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7536 this_ptr_conv.is_owned = false;
7537 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
7540 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
7541 LDKChannelHandshakeLimits this_ptr_conv;
7542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7543 this_ptr_conv.is_owned = false;
7544 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
7548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
7549 LDKChannelHandshakeLimits this_ptr_conv;
7550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7551 this_ptr_conv.is_owned = false;
7552 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
7555 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7556 LDKChannelHandshakeLimits this_ptr_conv;
7557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7558 this_ptr_conv.is_owned = false;
7559 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
7563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7564 LDKChannelHandshakeLimits this_ptr_conv;
7565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7566 this_ptr_conv.is_owned = false;
7567 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
7570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7571 LDKChannelHandshakeLimits this_ptr_conv;
7572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7573 this_ptr_conv.is_owned = false;
7574 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
7578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7579 LDKChannelHandshakeLimits this_ptr_conv;
7580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7581 this_ptr_conv.is_owned = false;
7582 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
7585 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7586 LDKChannelHandshakeLimits this_ptr_conv;
7587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7588 this_ptr_conv.is_owned = false;
7589 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
7593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7594 LDKChannelHandshakeLimits this_ptr_conv;
7595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7596 this_ptr_conv.is_owned = false;
7597 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
7600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
7601 LDKChannelHandshakeLimits this_ptr_conv;
7602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7603 this_ptr_conv.is_owned = false;
7604 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
7608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7609 LDKChannelHandshakeLimits this_ptr_conv;
7610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7611 this_ptr_conv.is_owned = false;
7612 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
7615 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7616 LDKChannelHandshakeLimits this_ptr_conv;
7617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7618 this_ptr_conv.is_owned = false;
7619 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
7623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
7624 LDKChannelHandshakeLimits this_ptr_conv;
7625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7626 this_ptr_conv.is_owned = false;
7627 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
7630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
7631 LDKChannelHandshakeLimits ret_var = 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);
7632 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7633 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7634 long ret_ref = (long)ret_var.inner;
7635 if (ret_var.is_owned) {
7641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
7642 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
7643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7645 long ret_ref = (long)ret_var.inner;
7646 if (ret_var.is_owned) {
7652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7653 LDKChannelConfig this_ptr_conv;
7654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7656 ChannelConfig_free(this_ptr_conv);
7659 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7660 LDKChannelConfig orig_conv;
7661 orig_conv.inner = (void*)(orig & (~1));
7662 orig_conv.is_owned = false;
7663 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
7664 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7665 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7666 long ret_ref = (long)ret_var.inner;
7667 if (ret_var.is_owned) {
7673 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
7674 LDKChannelConfig this_ptr_conv;
7675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7676 this_ptr_conv.is_owned = false;
7677 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
7681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7682 LDKChannelConfig this_ptr_conv;
7683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7684 this_ptr_conv.is_owned = false;
7685 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
7688 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
7689 LDKChannelConfig this_ptr_conv;
7690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7691 this_ptr_conv.is_owned = false;
7692 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
7696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7697 LDKChannelConfig this_ptr_conv;
7698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7699 this_ptr_conv.is_owned = false;
7700 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
7703 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
7704 LDKChannelConfig this_ptr_conv;
7705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7706 this_ptr_conv.is_owned = false;
7707 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
7711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7712 LDKChannelConfig this_ptr_conv;
7713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7714 this_ptr_conv.is_owned = false;
7715 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
7718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
7719 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
7720 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7721 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7722 long ret_ref = (long)ret_var.inner;
7723 if (ret_var.is_owned) {
7729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
7730 LDKChannelConfig ret_var = ChannelConfig_default();
7731 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7732 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7733 long ret_ref = (long)ret_var.inner;
7734 if (ret_var.is_owned) {
7740 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
7741 LDKChannelConfig obj_conv;
7742 obj_conv.inner = (void*)(obj & (~1));
7743 obj_conv.is_owned = false;
7744 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
7745 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7746 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7747 CVec_u8Z_free(arg_var);
7751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
7753 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
7754 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
7755 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
7756 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7757 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7758 long ret_ref = (long)ret_var.inner;
7759 if (ret_var.is_owned) {
7762 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
7766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7767 LDKUserConfig this_ptr_conv;
7768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7769 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7770 UserConfig_free(this_ptr_conv);
7773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7774 LDKUserConfig orig_conv;
7775 orig_conv.inner = (void*)(orig & (~1));
7776 orig_conv.is_owned = false;
7777 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
7778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7780 long ret_ref = (long)ret_var.inner;
7781 if (ret_var.is_owned) {
7787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
7788 LDKUserConfig this_ptr_conv;
7789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7790 this_ptr_conv.is_owned = false;
7791 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
7792 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7793 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7794 long ret_ref = (long)ret_var.inner;
7795 if (ret_var.is_owned) {
7801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7802 LDKUserConfig this_ptr_conv;
7803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7804 this_ptr_conv.is_owned = false;
7805 LDKChannelHandshakeConfig val_conv;
7806 val_conv.inner = (void*)(val & (~1));
7807 val_conv.is_owned = (val & 1) || (val == 0);
7808 val_conv = ChannelHandshakeConfig_clone(&val_conv);
7809 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
7812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
7813 LDKUserConfig this_ptr_conv;
7814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7815 this_ptr_conv.is_owned = false;
7816 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
7817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7819 long ret_ref = (long)ret_var.inner;
7820 if (ret_var.is_owned) {
7826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7827 LDKUserConfig this_ptr_conv;
7828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7829 this_ptr_conv.is_owned = false;
7830 LDKChannelHandshakeLimits val_conv;
7831 val_conv.inner = (void*)(val & (~1));
7832 val_conv.is_owned = (val & 1) || (val == 0);
7833 val_conv = ChannelHandshakeLimits_clone(&val_conv);
7834 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
7837 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
7838 LDKUserConfig this_ptr_conv;
7839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7840 this_ptr_conv.is_owned = false;
7841 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
7842 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7843 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7844 long ret_ref = (long)ret_var.inner;
7845 if (ret_var.is_owned) {
7851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7852 LDKUserConfig this_ptr_conv;
7853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7854 this_ptr_conv.is_owned = false;
7855 LDKChannelConfig val_conv;
7856 val_conv.inner = (void*)(val & (~1));
7857 val_conv.is_owned = (val & 1) || (val == 0);
7858 val_conv = ChannelConfig_clone(&val_conv);
7859 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
7862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg) {
7863 LDKChannelHandshakeConfig own_channel_config_arg_conv;
7864 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
7865 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
7866 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
7867 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
7868 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
7869 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
7870 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
7871 LDKChannelConfig channel_options_arg_conv;
7872 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
7873 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
7874 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
7875 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
7876 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7877 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7878 long ret_ref = (long)ret_var.inner;
7879 if (ret_var.is_owned) {
7885 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
7886 LDKUserConfig ret_var = UserConfig_default();
7887 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7888 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7889 long ret_ref = (long)ret_var.inner;
7890 if (ret_var.is_owned) {
7896 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7897 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
7898 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
7902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7903 if ((this_ptr & 1) != 0) return;
7904 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
7905 FREE((void*)this_ptr);
7906 Access_free(this_ptr_conv);
7909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7910 if ((this_ptr & 1) != 0) return;
7911 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
7912 FREE((void*)this_ptr);
7913 Watch_free(this_ptr_conv);
7916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7917 if ((this_ptr & 1) != 0) return;
7918 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
7919 FREE((void*)this_ptr);
7920 Filter_free(this_ptr_conv);
7923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7924 if ((this_ptr & 1) != 0) return;
7925 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
7926 FREE((void*)this_ptr);
7927 BroadcasterInterface_free(this_ptr_conv);
7930 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7931 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
7932 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
7936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7937 if ((this_ptr & 1) != 0) return;
7938 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
7939 FREE((void*)this_ptr);
7940 FeeEstimator_free(this_ptr_conv);
7943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7944 LDKChainMonitor this_ptr_conv;
7945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7947 ChainMonitor_free(this_ptr_conv);
7950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
7951 LDKChainMonitor this_arg_conv;
7952 this_arg_conv.inner = (void*)(this_arg & (~1));
7953 this_arg_conv.is_owned = false;
7954 unsigned char header_arr[80];
7955 CHECK((*env)->GetArrayLength(env, header) == 80);
7956 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7957 unsigned char (*header_ref)[80] = &header_arr;
7958 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7959 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7960 if (txdata_constr.datalen > 0)
7961 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7963 txdata_constr.data = NULL;
7964 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
7965 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7966 int64_t arr_conv_24 = txdata_vals[y];
7967 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
7968 FREE((void*)arr_conv_24);
7969 txdata_constr.data[y] = arr_conv_24_conv;
7971 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
7972 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t disconnected_height) {
7976 LDKChainMonitor this_arg_conv;
7977 this_arg_conv.inner = (void*)(this_arg & (~1));
7978 this_arg_conv.is_owned = false;
7979 unsigned char header_arr[80];
7980 CHECK((*env)->GetArrayLength(env, header) == 80);
7981 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7982 unsigned char (*header_ref)[80] = &header_arr;
7983 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
7986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *env, jclass clz, int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
7987 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
7988 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
7989 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7990 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7991 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
7993 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
7994 if (logger_conv.free == LDKLogger_JCalls_free) {
7995 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7996 LDKLogger_JCalls_clone(logger_conv.this_arg);
7998 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
7999 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
8000 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8001 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
8003 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
8004 if (persister_conv.free == LDKPersist_JCalls_free) {
8005 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8006 LDKPersist_JCalls_clone(persister_conv.this_arg);
8008 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
8009 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8010 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8011 long ret_ref = (long)ret_var.inner;
8012 if (ret_var.is_owned) {
8018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
8019 LDKChainMonitor this_arg_conv;
8020 this_arg_conv.inner = (void*)(this_arg & (~1));
8021 this_arg_conv.is_owned = false;
8022 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
8023 *ret = ChainMonitor_as_Watch(&this_arg_conv);
8027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
8028 LDKChainMonitor this_arg_conv;
8029 this_arg_conv.inner = (void*)(this_arg & (~1));
8030 this_arg_conv.is_owned = false;
8031 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8032 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
8036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8037 LDKChannelMonitorUpdate this_ptr_conv;
8038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8040 ChannelMonitorUpdate_free(this_ptr_conv);
8043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8044 LDKChannelMonitorUpdate orig_conv;
8045 orig_conv.inner = (void*)(orig & (~1));
8046 orig_conv.is_owned = false;
8047 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
8048 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8049 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8050 long ret_ref = (long)ret_var.inner;
8051 if (ret_var.is_owned) {
8057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8058 LDKChannelMonitorUpdate this_ptr_conv;
8059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8060 this_ptr_conv.is_owned = false;
8061 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
8065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8066 LDKChannelMonitorUpdate this_ptr_conv;
8067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8068 this_ptr_conv.is_owned = false;
8069 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
8072 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
8073 LDKChannelMonitorUpdate obj_conv;
8074 obj_conv.inner = (void*)(obj & (~1));
8075 obj_conv.is_owned = false;
8076 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
8077 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8078 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8079 CVec_u8Z_free(arg_var);
8083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8085 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8086 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8087 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8088 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
8089 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8090 return (long)ret_conv;
8093 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8094 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
8095 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
8099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8100 LDKMonitorUpdateError this_ptr_conv;
8101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8103 MonitorUpdateError_free(this_ptr_conv);
8106 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8107 LDKMonitorUpdateError orig_conv;
8108 orig_conv.inner = (void*)(orig & (~1));
8109 orig_conv.is_owned = false;
8110 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
8111 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8112 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8113 long ret_ref = (long)ret_var.inner;
8114 if (ret_var.is_owned) {
8120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8121 LDKMonitorEvent this_ptr_conv;
8122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8124 MonitorEvent_free(this_ptr_conv);
8127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8128 LDKMonitorEvent orig_conv;
8129 orig_conv.inner = (void*)(orig & (~1));
8130 orig_conv.is_owned = false;
8131 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
8132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8134 long ret_ref = (long)ret_var.inner;
8135 if (ret_var.is_owned) {
8141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8142 LDKHTLCUpdate this_ptr_conv;
8143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8145 HTLCUpdate_free(this_ptr_conv);
8148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8149 LDKHTLCUpdate orig_conv;
8150 orig_conv.inner = (void*)(orig & (~1));
8151 orig_conv.is_owned = false;
8152 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
8153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8155 long ret_ref = (long)ret_var.inner;
8156 if (ret_var.is_owned) {
8162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
8163 LDKHTLCUpdate obj_conv;
8164 obj_conv.inner = (void*)(obj & (~1));
8165 obj_conv.is_owned = false;
8166 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
8167 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8168 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8169 CVec_u8Z_free(arg_var);
8173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8175 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8176 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8177 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
8178 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8179 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8180 long ret_ref = (long)ret_var.inner;
8181 if (ret_var.is_owned) {
8184 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8189 LDKChannelMonitor this_ptr_conv;
8190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8192 ChannelMonitor_free(this_ptr_conv);
8195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8196 LDKChannelMonitor orig_conv;
8197 orig_conv.inner = (void*)(orig & (~1));
8198 orig_conv.is_owned = false;
8199 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
8200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8202 long ret_ref = (long)ret_var.inner;
8203 if (ret_var.is_owned) {
8209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8210 LDKChannelMonitor obj_conv;
8211 obj_conv.inner = (void*)(obj & (~1));
8212 obj_conv.is_owned = false;
8213 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
8214 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8215 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8216 CVec_u8Z_free(arg_var);
8220 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv *env, jclass clz, int64_t this_arg, int64_t updates, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
8221 LDKChannelMonitor this_arg_conv;
8222 this_arg_conv.inner = (void*)(this_arg & (~1));
8223 this_arg_conv.is_owned = false;
8224 LDKChannelMonitorUpdate updates_conv;
8225 updates_conv.inner = (void*)(updates & (~1));
8226 updates_conv.is_owned = false;
8227 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
8228 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
8229 LDKLogger* logger_conv = (LDKLogger*)logger;
8230 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8231 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
8232 return (long)ret_conv;
8235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8236 LDKChannelMonitor this_arg_conv;
8237 this_arg_conv.inner = (void*)(this_arg & (~1));
8238 this_arg_conv.is_owned = false;
8239 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
8243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
8244 LDKChannelMonitor this_arg_conv;
8245 this_arg_conv.inner = (void*)(this_arg & (~1));
8246 this_arg_conv.is_owned = false;
8247 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8248 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
8249 return (long)ret_ref;
8252 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8253 LDKChannelMonitor this_arg_conv;
8254 this_arg_conv.inner = (void*)(this_arg & (~1));
8255 this_arg_conv.is_owned = false;
8256 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
8257 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8258 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8259 for (size_t o = 0; o < ret_var.datalen; o++) {
8260 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
8261 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8262 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8263 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
8264 if (arr_conv_14_var.is_owned) {
8265 arr_conv_14_ref |= 1;
8267 ret_arr_ptr[o] = arr_conv_14_ref;
8269 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8274 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8275 LDKChannelMonitor this_arg_conv;
8276 this_arg_conv.inner = (void*)(this_arg & (~1));
8277 this_arg_conv.is_owned = false;
8278 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
8279 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8280 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8281 for (size_t h = 0; h < ret_var.datalen; h++) {
8282 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8283 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
8284 long arr_conv_7_ref = (long)arr_conv_7_copy;
8285 ret_arr_ptr[h] = arr_conv_7_ref;
8287 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8292 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv *env, jclass clz, int64_t this_arg, int64_t logger) {
8293 LDKChannelMonitor this_arg_conv;
8294 this_arg_conv.inner = (void*)(this_arg & (~1));
8295 this_arg_conv.is_owned = false;
8296 LDKLogger* logger_conv = (LDKLogger*)logger;
8297 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
8298 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8300 for (size_t i = 0; i < ret_var.datalen; i++) {
8301 LDKTransaction arr_conv_8_var = ret_var.data[i];
8302 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, arr_conv_8_var.datalen);
8303 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
8304 Transaction_free(arr_conv_8_var);
8305 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
8311 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
8312 LDKChannelMonitor this_arg_conv;
8313 this_arg_conv.inner = (void*)(this_arg & (~1));
8314 this_arg_conv.is_owned = false;
8315 unsigned char header_arr[80];
8316 CHECK((*env)->GetArrayLength(env, header) == 80);
8317 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8318 unsigned char (*header_ref)[80] = &header_arr;
8319 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8320 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
8321 if (txdata_constr.datalen > 0)
8322 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8324 txdata_constr.data = NULL;
8325 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8326 for (size_t y = 0; y < txdata_constr.datalen; y++) {
8327 int64_t arr_conv_24 = txdata_vals[y];
8328 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
8329 FREE((void*)arr_conv_24);
8330 txdata_constr.data[y] = arr_conv_24_conv;
8332 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8333 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
8334 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8335 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8336 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8338 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
8339 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8340 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8341 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8343 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
8344 if (logger_conv.free == LDKLogger_JCalls_free) {
8345 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8346 LDKLogger_JCalls_clone(logger_conv.this_arg);
8348 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
8349 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8350 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8351 for (size_t u = 0; u < ret_var.datalen; u++) {
8352 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8353 *arr_conv_46_ref = ret_var.data[u];
8354 ret_arr_ptr[u] = (long)arr_conv_46_ref;
8356 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
8362 LDKChannelMonitor this_arg_conv;
8363 this_arg_conv.inner = (void*)(this_arg & (~1));
8364 this_arg_conv.is_owned = false;
8365 unsigned char header_arr[80];
8366 CHECK((*env)->GetArrayLength(env, header) == 80);
8367 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8368 unsigned char (*header_ref)[80] = &header_arr;
8369 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
8370 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8371 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8372 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8374 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
8375 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8376 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8377 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8379 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
8380 if (logger_conv.free == LDKLogger_JCalls_free) {
8381 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8382 LDKLogger_JCalls_clone(logger_conv.this_arg);
8384 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
8387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8388 if ((this_ptr & 1) != 0) return;
8389 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
8390 FREE((void*)this_ptr);
8391 Persist_free(this_ptr_conv);
8394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
8396 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8397 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8398 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
8399 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8400 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
8401 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8402 return (long)ret_conv;
8405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8406 LDKOutPoint this_ptr_conv;
8407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8409 OutPoint_free(this_ptr_conv);
8412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8413 LDKOutPoint orig_conv;
8414 orig_conv.inner = (void*)(orig & (~1));
8415 orig_conv.is_owned = false;
8416 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
8417 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8418 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8419 long ret_ref = (long)ret_var.inner;
8420 if (ret_var.is_owned) {
8426 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
8427 LDKOutPoint this_ptr_conv;
8428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8429 this_ptr_conv.is_owned = false;
8430 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8431 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
8435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8436 LDKOutPoint this_ptr_conv;
8437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8438 this_ptr_conv.is_owned = false;
8439 LDKThirtyTwoBytes val_ref;
8440 CHECK((*env)->GetArrayLength(env, val) == 32);
8441 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8442 OutPoint_set_txid(&this_ptr_conv, val_ref);
8445 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
8446 LDKOutPoint this_ptr_conv;
8447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8448 this_ptr_conv.is_owned = false;
8449 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
8453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
8454 LDKOutPoint this_ptr_conv;
8455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8456 this_ptr_conv.is_owned = false;
8457 OutPoint_set_index(&this_ptr_conv, val);
8460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
8461 LDKThirtyTwoBytes txid_arg_ref;
8462 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
8463 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
8464 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
8465 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8466 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8467 long ret_ref = (long)ret_var.inner;
8468 if (ret_var.is_owned) {
8474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8475 LDKOutPoint this_arg_conv;
8476 this_arg_conv.inner = (void*)(this_arg & (~1));
8477 this_arg_conv.is_owned = false;
8478 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
8479 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
8483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
8484 LDKOutPoint obj_conv;
8485 obj_conv.inner = (void*)(obj & (~1));
8486 obj_conv.is_owned = false;
8487 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
8488 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8489 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8490 CVec_u8Z_free(arg_var);
8494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8496 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8497 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8498 LDKOutPoint ret_var = OutPoint_read(ser_ref);
8499 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8500 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8501 long ret_ref = (long)ret_var.inner;
8502 if (ret_var.is_owned) {
8505 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8510 if ((this_ptr & 1) != 0) return;
8511 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
8512 FREE((void*)this_ptr);
8513 SpendableOutputDescriptor_free(this_ptr_conv);
8516 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8517 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
8518 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
8519 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
8520 long ret_ref = (long)ret_copy;
8524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8525 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
8526 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
8527 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8528 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8529 CVec_u8Z_free(arg_var);
8533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8535 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8536 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8537 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8538 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
8539 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8540 return (long)ret_conv;
8543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8544 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
8545 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8546 *ret = ChannelKeys_clone(orig_conv);
8550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8551 if ((this_ptr & 1) != 0) return;
8552 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)(((uint64_t)this_ptr) & ~1);
8553 FREE((void*)this_ptr);
8554 ChannelKeys_free(this_ptr_conv);
8557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8558 if ((this_ptr & 1) != 0) return;
8559 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
8560 FREE((void*)this_ptr);
8561 KeysInterface_free(this_ptr_conv);
8564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8565 LDKInMemoryChannelKeys this_ptr_conv;
8566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8568 InMemoryChannelKeys_free(this_ptr_conv);
8571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8572 LDKInMemoryChannelKeys orig_conv;
8573 orig_conv.inner = (void*)(orig & (~1));
8574 orig_conv.is_owned = false;
8575 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
8576 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8577 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8578 long ret_ref = (long)ret_var.inner;
8579 if (ret_var.is_owned) {
8585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8586 LDKInMemoryChannelKeys this_ptr_conv;
8587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8588 this_ptr_conv.is_owned = false;
8589 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8590 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
8594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8595 LDKInMemoryChannelKeys this_ptr_conv;
8596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8597 this_ptr_conv.is_owned = false;
8598 LDKSecretKey val_ref;
8599 CHECK((*env)->GetArrayLength(env, val) == 32);
8600 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8601 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
8604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8605 LDKInMemoryChannelKeys this_ptr_conv;
8606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8607 this_ptr_conv.is_owned = false;
8608 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8609 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
8613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8614 LDKInMemoryChannelKeys this_ptr_conv;
8615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8616 this_ptr_conv.is_owned = false;
8617 LDKSecretKey val_ref;
8618 CHECK((*env)->GetArrayLength(env, val) == 32);
8619 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8620 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
8623 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8624 LDKInMemoryChannelKeys this_ptr_conv;
8625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8626 this_ptr_conv.is_owned = false;
8627 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8628 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
8632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8633 LDKInMemoryChannelKeys this_ptr_conv;
8634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8635 this_ptr_conv.is_owned = false;
8636 LDKSecretKey val_ref;
8637 CHECK((*env)->GetArrayLength(env, val) == 32);
8638 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8639 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
8642 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8643 LDKInMemoryChannelKeys this_ptr_conv;
8644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8645 this_ptr_conv.is_owned = false;
8646 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8647 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
8651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8652 LDKInMemoryChannelKeys this_ptr_conv;
8653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8654 this_ptr_conv.is_owned = false;
8655 LDKSecretKey val_ref;
8656 CHECK((*env)->GetArrayLength(env, val) == 32);
8657 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8658 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
8661 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8662 LDKInMemoryChannelKeys this_ptr_conv;
8663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8664 this_ptr_conv.is_owned = false;
8665 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8666 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
8670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8671 LDKInMemoryChannelKeys this_ptr_conv;
8672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8673 this_ptr_conv.is_owned = false;
8674 LDKSecretKey val_ref;
8675 CHECK((*env)->GetArrayLength(env, val) == 32);
8676 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8677 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
8680 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
8681 LDKInMemoryChannelKeys this_ptr_conv;
8682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8683 this_ptr_conv.is_owned = false;
8684 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8685 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
8689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8690 LDKInMemoryChannelKeys this_ptr_conv;
8691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8692 this_ptr_conv.is_owned = false;
8693 LDKThirtyTwoBytes val_ref;
8694 CHECK((*env)->GetArrayLength(env, val) == 32);
8695 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8696 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
8699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int64_t key_derivation_params) {
8700 LDKSecretKey funding_key_ref;
8701 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
8702 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
8703 LDKSecretKey revocation_base_key_ref;
8704 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
8705 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
8706 LDKSecretKey payment_key_ref;
8707 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
8708 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
8709 LDKSecretKey delayed_payment_base_key_ref;
8710 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
8711 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
8712 LDKSecretKey htlc_base_key_ref;
8713 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
8714 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
8715 LDKThirtyTwoBytes commitment_seed_ref;
8716 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
8717 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
8718 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)(((uint64_t)key_derivation_params) & ~1);
8719 FREE((void*)key_derivation_params);
8720 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
8721 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8722 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8723 long ret_ref = (long)ret_var.inner;
8724 if (ret_var.is_owned) {
8730 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8731 LDKInMemoryChannelKeys this_arg_conv;
8732 this_arg_conv.inner = (void*)(this_arg & (~1));
8733 this_arg_conv.is_owned = false;
8734 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
8735 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8736 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8737 long ret_ref = (long)ret_var.inner;
8738 if (ret_var.is_owned) {
8744 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8745 LDKInMemoryChannelKeys this_arg_conv;
8746 this_arg_conv.inner = (void*)(this_arg & (~1));
8747 this_arg_conv.is_owned = false;
8748 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
8752 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8753 LDKInMemoryChannelKeys this_arg_conv;
8754 this_arg_conv.inner = (void*)(this_arg & (~1));
8755 this_arg_conv.is_owned = false;
8756 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
8760 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
8761 LDKInMemoryChannelKeys this_arg_conv;
8762 this_arg_conv.inner = (void*)(this_arg & (~1));
8763 this_arg_conv.is_owned = false;
8764 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
8768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
8769 LDKInMemoryChannelKeys this_arg_conv;
8770 this_arg_conv.inner = (void*)(this_arg & (~1));
8771 this_arg_conv.is_owned = false;
8772 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
8773 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8774 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8775 long ret_ref = (long)ret_var.inner;
8776 if (ret_var.is_owned) {
8782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
8783 LDKInMemoryChannelKeys this_arg_conv;
8784 this_arg_conv.inner = (void*)(this_arg & (~1));
8785 this_arg_conv.is_owned = false;
8786 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
8787 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8788 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8789 long ret_ref = (long)ret_var.inner;
8790 if (ret_var.is_owned) {
8796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8797 LDKInMemoryChannelKeys this_arg_conv;
8798 this_arg_conv.inner = (void*)(this_arg & (~1));
8799 this_arg_conv.is_owned = false;
8800 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8801 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
8805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
8806 LDKInMemoryChannelKeys obj_conv;
8807 obj_conv.inner = (void*)(obj & (~1));
8808 obj_conv.is_owned = false;
8809 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
8810 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8811 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8812 CVec_u8Z_free(arg_var);
8816 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8818 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8819 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8820 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
8821 *ret_conv = InMemoryChannelKeys_read(ser_ref);
8822 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8823 return (long)ret_conv;
8826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8827 LDKKeysManager this_ptr_conv;
8828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8830 KeysManager_free(this_ptr_conv);
8833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, jclass network, int64_t starting_time_secs, int32_t starting_time_nanos) {
8834 unsigned char seed_arr[32];
8835 CHECK((*env)->GetArrayLength(env, seed) == 32);
8836 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
8837 unsigned char (*seed_ref)[32] = &seed_arr;
8838 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
8839 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
8840 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8841 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8842 long ret_ref = (long)ret_var.inner;
8843 if (ret_var.is_owned) {
8849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int64_t params_1, int64_t params_2) {
8850 LDKKeysManager this_arg_conv;
8851 this_arg_conv.inner = (void*)(this_arg & (~1));
8852 this_arg_conv.is_owned = false;
8853 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
8854 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8855 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8856 long ret_ref = (long)ret_var.inner;
8857 if (ret_var.is_owned) {
8863 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
8864 LDKKeysManager this_arg_conv;
8865 this_arg_conv.inner = (void*)(this_arg & (~1));
8866 this_arg_conv.is_owned = false;
8867 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
8868 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
8872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8873 LDKChannelManager this_ptr_conv;
8874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8875 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8876 ChannelManager_free(this_ptr_conv);
8879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8880 LDKChannelDetails this_ptr_conv;
8881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8883 ChannelDetails_free(this_ptr_conv);
8886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8887 LDKChannelDetails orig_conv;
8888 orig_conv.inner = (void*)(orig & (~1));
8889 orig_conv.is_owned = false;
8890 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
8891 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8892 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8893 long ret_ref = (long)ret_var.inner;
8894 if (ret_var.is_owned) {
8900 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8901 LDKChannelDetails this_ptr_conv;
8902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8903 this_ptr_conv.is_owned = false;
8904 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8905 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
8909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8910 LDKChannelDetails this_ptr_conv;
8911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8912 this_ptr_conv.is_owned = false;
8913 LDKThirtyTwoBytes val_ref;
8914 CHECK((*env)->GetArrayLength(env, val) == 32);
8915 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8916 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
8919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8920 LDKChannelDetails this_ptr_conv;
8921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8922 this_ptr_conv.is_owned = false;
8923 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
8924 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
8928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8929 LDKChannelDetails this_ptr_conv;
8930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8931 this_ptr_conv.is_owned = false;
8932 LDKPublicKey val_ref;
8933 CHECK((*env)->GetArrayLength(env, val) == 33);
8934 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
8935 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
8938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
8939 LDKChannelDetails this_ptr_conv;
8940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8941 this_ptr_conv.is_owned = false;
8942 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
8943 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8944 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8945 long ret_ref = (long)ret_var.inner;
8946 if (ret_var.is_owned) {
8952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8953 LDKChannelDetails this_ptr_conv;
8954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8955 this_ptr_conv.is_owned = false;
8956 LDKInitFeatures val_conv;
8957 val_conv.inner = (void*)(val & (~1));
8958 val_conv.is_owned = (val & 1) || (val == 0);
8959 // Warning: we need a move here but no clone is available for LDKInitFeatures
8960 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
8963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
8964 LDKChannelDetails this_ptr_conv;
8965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8966 this_ptr_conv.is_owned = false;
8967 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
8971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8972 LDKChannelDetails this_ptr_conv;
8973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8974 this_ptr_conv.is_owned = false;
8975 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
8978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8979 LDKChannelDetails this_ptr_conv;
8980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8981 this_ptr_conv.is_owned = false;
8982 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
8986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8987 LDKChannelDetails this_ptr_conv;
8988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8989 this_ptr_conv.is_owned = false;
8990 ChannelDetails_set_user_id(&this_ptr_conv, val);
8993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
8994 LDKChannelDetails this_ptr_conv;
8995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8996 this_ptr_conv.is_owned = false;
8997 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
9001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9002 LDKChannelDetails this_ptr_conv;
9003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9004 this_ptr_conv.is_owned = false;
9005 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
9008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9009 LDKChannelDetails this_ptr_conv;
9010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9011 this_ptr_conv.is_owned = false;
9012 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
9016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9017 LDKChannelDetails this_ptr_conv;
9018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9019 this_ptr_conv.is_owned = false;
9020 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
9023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
9024 LDKChannelDetails this_ptr_conv;
9025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9026 this_ptr_conv.is_owned = false;
9027 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
9031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9032 LDKChannelDetails this_ptr_conv;
9033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9034 this_ptr_conv.is_owned = false;
9035 ChannelDetails_set_is_live(&this_ptr_conv, val);
9038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9039 LDKPaymentSendFailure this_ptr_conv;
9040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9042 PaymentSendFailure_free(this_ptr_conv);
9045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9046 LDKPaymentSendFailure orig_conv;
9047 orig_conv.inner = (void*)(orig & (~1));
9048 orig_conv.is_owned = false;
9049 LDKPaymentSendFailure ret_var = PaymentSendFailure_clone(&orig_conv);
9050 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9051 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9052 long ret_ref = (long)ret_var.inner;
9053 if (ret_var.is_owned) {
9059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, jclass network, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, intptr_t current_blockchain_height) {
9060 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
9061 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
9062 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
9063 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9064 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
9066 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
9067 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9068 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9069 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9071 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
9072 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9073 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9074 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9076 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9077 if (logger_conv.free == LDKLogger_JCalls_free) {
9078 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9079 LDKLogger_JCalls_clone(logger_conv.this_arg);
9081 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
9082 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9083 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9084 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9086 LDKUserConfig config_conv;
9087 config_conv.inner = (void*)(config & (~1));
9088 config_conv.is_owned = (config & 1) || (config == 0);
9089 config_conv = UserConfig_clone(&config_conv);
9090 LDKChannelManager ret_var = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
9091 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9092 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9093 long ret_ref = (long)ret_var.inner;
9094 if (ret_var.is_owned) {
9100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_network_key, int64_t channel_value_satoshis, int64_t push_msat, int64_t user_id, int64_t override_config) {
9101 LDKChannelManager this_arg_conv;
9102 this_arg_conv.inner = (void*)(this_arg & (~1));
9103 this_arg_conv.is_owned = false;
9104 LDKPublicKey their_network_key_ref;
9105 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
9106 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
9107 LDKUserConfig override_config_conv;
9108 override_config_conv.inner = (void*)(override_config & (~1));
9109 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
9110 override_config_conv = UserConfig_clone(&override_config_conv);
9111 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9112 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
9113 return (long)ret_conv;
9116 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9117 LDKChannelManager this_arg_conv;
9118 this_arg_conv.inner = (void*)(this_arg & (~1));
9119 this_arg_conv.is_owned = false;
9120 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
9121 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9122 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9123 for (size_t q = 0; q < ret_var.datalen; q++) {
9124 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9125 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9126 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9127 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9128 if (arr_conv_16_var.is_owned) {
9129 arr_conv_16_ref |= 1;
9131 ret_arr_ptr[q] = arr_conv_16_ref;
9133 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9138 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9139 LDKChannelManager this_arg_conv;
9140 this_arg_conv.inner = (void*)(this_arg & (~1));
9141 this_arg_conv.is_owned = false;
9142 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
9143 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9144 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9145 for (size_t q = 0; q < ret_var.datalen; q++) {
9146 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9147 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9148 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9149 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9150 if (arr_conv_16_var.is_owned) {
9151 arr_conv_16_ref |= 1;
9153 ret_arr_ptr[q] = arr_conv_16_ref;
9155 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
9161 LDKChannelManager this_arg_conv;
9162 this_arg_conv.inner = (void*)(this_arg & (~1));
9163 this_arg_conv.is_owned = false;
9164 unsigned char channel_id_arr[32];
9165 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9166 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9167 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9168 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9169 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
9170 return (long)ret_conv;
9173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
9174 LDKChannelManager this_arg_conv;
9175 this_arg_conv.inner = (void*)(this_arg & (~1));
9176 this_arg_conv.is_owned = false;
9177 unsigned char channel_id_arr[32];
9178 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9179 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9180 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9181 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9182 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
9183 return (long)ret_conv;
9186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9187 LDKChannelManager this_arg_conv;
9188 this_arg_conv.inner = (void*)(this_arg & (~1));
9189 this_arg_conv.is_owned = false;
9190 ChannelManager_force_close_all_channels(&this_arg_conv);
9193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_hash, int8_tArray payment_secret) {
9194 LDKChannelManager this_arg_conv;
9195 this_arg_conv.inner = (void*)(this_arg & (~1));
9196 this_arg_conv.is_owned = false;
9197 LDKRoute route_conv;
9198 route_conv.inner = (void*)(route & (~1));
9199 route_conv.is_owned = false;
9200 LDKThirtyTwoBytes payment_hash_ref;
9201 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9202 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
9203 LDKThirtyTwoBytes payment_secret_ref;
9204 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9205 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9206 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9207 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
9208 return (long)ret_conv;
9211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t funding_txo) {
9212 LDKChannelManager this_arg_conv;
9213 this_arg_conv.inner = (void*)(this_arg & (~1));
9214 this_arg_conv.is_owned = false;
9215 unsigned char temporary_channel_id_arr[32];
9216 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
9217 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
9218 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
9219 LDKOutPoint funding_txo_conv;
9220 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9221 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
9222 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9223 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
9226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray rgb, int8_tArray alias, int64_tArray addresses) {
9227 LDKChannelManager this_arg_conv;
9228 this_arg_conv.inner = (void*)(this_arg & (~1));
9229 this_arg_conv.is_owned = false;
9230 LDKThreeBytes rgb_ref;
9231 CHECK((*env)->GetArrayLength(env, rgb) == 3);
9232 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
9233 LDKThirtyTwoBytes alias_ref;
9234 CHECK((*env)->GetArrayLength(env, alias) == 32);
9235 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
9236 LDKCVec_NetAddressZ addresses_constr;
9237 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
9238 if (addresses_constr.datalen > 0)
9239 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9241 addresses_constr.data = NULL;
9242 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
9243 for (size_t m = 0; m < addresses_constr.datalen; m++) {
9244 int64_t arr_conv_12 = addresses_vals[m];
9245 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
9246 FREE((void*)arr_conv_12);
9247 addresses_constr.data[m] = arr_conv_12_conv;
9249 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
9250 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
9253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
9254 LDKChannelManager this_arg_conv;
9255 this_arg_conv.inner = (void*)(this_arg & (~1));
9256 this_arg_conv.is_owned = false;
9257 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
9260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
9261 LDKChannelManager this_arg_conv;
9262 this_arg_conv.inner = (void*)(this_arg & (~1));
9263 this_arg_conv.is_owned = false;
9264 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
9267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
9268 LDKChannelManager this_arg_conv;
9269 this_arg_conv.inner = (void*)(this_arg & (~1));
9270 this_arg_conv.is_owned = false;
9271 unsigned char payment_hash_arr[32];
9272 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9273 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
9274 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
9275 LDKThirtyTwoBytes payment_secret_ref;
9276 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9277 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9278 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
9282 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
9283 LDKChannelManager this_arg_conv;
9284 this_arg_conv.inner = (void*)(this_arg & (~1));
9285 this_arg_conv.is_owned = false;
9286 LDKThirtyTwoBytes payment_preimage_ref;
9287 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
9288 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
9289 LDKThirtyTwoBytes payment_secret_ref;
9290 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9291 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9292 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
9296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9297 LDKChannelManager this_arg_conv;
9298 this_arg_conv.inner = (void*)(this_arg & (~1));
9299 this_arg_conv.is_owned = false;
9300 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9301 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
9305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_txo, int64_t highest_applied_update_id) {
9306 LDKChannelManager this_arg_conv;
9307 this_arg_conv.inner = (void*)(this_arg & (~1));
9308 this_arg_conv.is_owned = false;
9309 LDKOutPoint funding_txo_conv;
9310 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9311 funding_txo_conv.is_owned = false;
9312 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
9315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9316 LDKChannelManager this_arg_conv;
9317 this_arg_conv.inner = (void*)(this_arg & (~1));
9318 this_arg_conv.is_owned = false;
9319 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9320 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
9324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9325 LDKChannelManager this_arg_conv;
9326 this_arg_conv.inner = (void*)(this_arg & (~1));
9327 this_arg_conv.is_owned = false;
9328 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9329 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
9333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
9334 LDKChannelManager this_arg_conv;
9335 this_arg_conv.inner = (void*)(this_arg & (~1));
9336 this_arg_conv.is_owned = false;
9337 unsigned char header_arr[80];
9338 CHECK((*env)->GetArrayLength(env, header) == 80);
9339 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9340 unsigned char (*header_ref)[80] = &header_arr;
9341 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9342 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
9343 if (txdata_constr.datalen > 0)
9344 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9346 txdata_constr.data = NULL;
9347 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
9348 for (size_t y = 0; y < txdata_constr.datalen; y++) {
9349 int64_t arr_conv_24 = txdata_vals[y];
9350 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_conv_24) & ~1);
9351 FREE((void*)arr_conv_24);
9352 txdata_constr.data[y] = arr_conv_24_conv;
9354 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
9355 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
9359 LDKChannelManager this_arg_conv;
9360 this_arg_conv.inner = (void*)(this_arg & (~1));
9361 this_arg_conv.is_owned = false;
9362 unsigned char header_arr[80];
9363 CHECK((*env)->GetArrayLength(env, header) == 80);
9364 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9365 unsigned char (*header_ref)[80] = &header_arr;
9366 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
9369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
9370 LDKChannelManager this_arg_conv;
9371 this_arg_conv.inner = (void*)(this_arg & (~1));
9372 this_arg_conv.is_owned = false;
9373 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9374 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
9378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
9379 LDKChannelManager obj_conv;
9380 obj_conv.inner = (void*)(obj & (~1));
9381 obj_conv.is_owned = false;
9382 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
9383 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
9384 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
9385 CVec_u8Z_free(arg_var);
9389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9390 LDKChannelManagerReadArgs this_ptr_conv;
9391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9393 ChannelManagerReadArgs_free(this_ptr_conv);
9396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
9397 LDKChannelManagerReadArgs this_ptr_conv;
9398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9399 this_ptr_conv.is_owned = false;
9400 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
9404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9405 LDKChannelManagerReadArgs this_ptr_conv;
9406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9407 this_ptr_conv.is_owned = false;
9408 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
9409 if (val_conv.free == LDKKeysInterface_JCalls_free) {
9410 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9411 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
9413 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
9416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
9417 LDKChannelManagerReadArgs this_ptr_conv;
9418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9419 this_ptr_conv.is_owned = false;
9420 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
9424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9425 LDKChannelManagerReadArgs this_ptr_conv;
9426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9427 this_ptr_conv.is_owned = false;
9428 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
9429 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
9430 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9431 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
9433 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
9436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
9437 LDKChannelManagerReadArgs this_ptr_conv;
9438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9439 this_ptr_conv.is_owned = false;
9440 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
9444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9445 LDKChannelManagerReadArgs this_ptr_conv;
9446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9447 this_ptr_conv.is_owned = false;
9448 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
9449 if (val_conv.free == LDKWatch_JCalls_free) {
9450 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9451 LDKWatch_JCalls_clone(val_conv.this_arg);
9453 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
9456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
9457 LDKChannelManagerReadArgs this_ptr_conv;
9458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9459 this_ptr_conv.is_owned = false;
9460 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
9464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9465 LDKChannelManagerReadArgs this_ptr_conv;
9466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9467 this_ptr_conv.is_owned = false;
9468 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
9469 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
9470 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9471 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
9473 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
9476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
9477 LDKChannelManagerReadArgs this_ptr_conv;
9478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9479 this_ptr_conv.is_owned = false;
9480 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
9484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9485 LDKChannelManagerReadArgs this_ptr_conv;
9486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9487 this_ptr_conv.is_owned = false;
9488 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
9489 if (val_conv.free == LDKLogger_JCalls_free) {
9490 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9491 LDKLogger_JCalls_clone(val_conv.this_arg);
9493 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
9496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
9497 LDKChannelManagerReadArgs this_ptr_conv;
9498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9499 this_ptr_conv.is_owned = false;
9500 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
9501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9503 long ret_ref = (long)ret_var.inner;
9504 if (ret_var.is_owned) {
9510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9511 LDKChannelManagerReadArgs this_ptr_conv;
9512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9513 this_ptr_conv.is_owned = false;
9514 LDKUserConfig val_conv;
9515 val_conv.inner = (void*)(val & (~1));
9516 val_conv.is_owned = (val & 1) || (val == 0);
9517 val_conv = UserConfig_clone(&val_conv);
9518 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
9521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv *env, jclass clz, int64_t keys_manager, int64_t fee_estimator, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t default_config, int64_tArray channel_monitors) {
9522 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
9523 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9524 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9525 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9527 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
9528 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
9529 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9530 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
9532 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
9533 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9534 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9535 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9537 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
9538 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9539 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9540 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9542 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
9543 if (logger_conv.free == LDKLogger_JCalls_free) {
9544 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9545 LDKLogger_JCalls_clone(logger_conv.this_arg);
9547 LDKUserConfig default_config_conv;
9548 default_config_conv.inner = (void*)(default_config & (~1));
9549 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
9550 default_config_conv = UserConfig_clone(&default_config_conv);
9551 LDKCVec_ChannelMonitorZ channel_monitors_constr;
9552 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
9553 if (channel_monitors_constr.datalen > 0)
9554 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9556 channel_monitors_constr.data = NULL;
9557 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
9558 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
9559 int64_t arr_conv_16 = channel_monitors_vals[q];
9560 LDKChannelMonitor arr_conv_16_conv;
9561 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
9562 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
9563 channel_monitors_constr.data[q] = arr_conv_16_conv;
9565 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
9566 LDKChannelManagerReadArgs ret_var = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
9567 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9568 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9569 long ret_ref = (long)ret_var.inner;
9570 if (ret_var.is_owned) {
9576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
9578 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
9579 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
9580 LDKChannelManagerReadArgs arg_conv;
9581 arg_conv.inner = (void*)(arg & (~1));
9582 arg_conv.is_owned = (arg & 1) || (arg == 0);
9583 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
9584 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9585 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
9586 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
9587 return (long)ret_conv;
9590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9591 LDKDecodeError this_ptr_conv;
9592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9594 DecodeError_free(this_ptr_conv);
9597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9598 LDKDecodeError orig_conv;
9599 orig_conv.inner = (void*)(orig & (~1));
9600 orig_conv.is_owned = false;
9601 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
9602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9604 long ret_ref = (long)ret_var.inner;
9605 if (ret_var.is_owned) {
9611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9612 LDKInit this_ptr_conv;
9613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9615 Init_free(this_ptr_conv);
9618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9620 orig_conv.inner = (void*)(orig & (~1));
9621 orig_conv.is_owned = false;
9622 LDKInit ret_var = Init_clone(&orig_conv);
9623 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9624 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9625 long ret_ref = (long)ret_var.inner;
9626 if (ret_var.is_owned) {
9632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9633 LDKErrorMessage this_ptr_conv;
9634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9636 ErrorMessage_free(this_ptr_conv);
9639 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9640 LDKErrorMessage orig_conv;
9641 orig_conv.inner = (void*)(orig & (~1));
9642 orig_conv.is_owned = false;
9643 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
9644 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9645 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9646 long ret_ref = (long)ret_var.inner;
9647 if (ret_var.is_owned) {
9653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9654 LDKErrorMessage this_ptr_conv;
9655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9656 this_ptr_conv.is_owned = false;
9657 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9658 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
9662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9663 LDKErrorMessage this_ptr_conv;
9664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9665 this_ptr_conv.is_owned = false;
9666 LDKThirtyTwoBytes val_ref;
9667 CHECK((*env)->GetArrayLength(env, val) == 32);
9668 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9669 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
9672 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
9673 LDKErrorMessage this_ptr_conv;
9674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9675 this_ptr_conv.is_owned = false;
9676 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
9677 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
9681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9682 LDKErrorMessage this_ptr_conv;
9683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9684 this_ptr_conv.is_owned = false;
9685 LDKCVec_u8Z val_ref;
9686 val_ref.datalen = (*env)->GetArrayLength(env, val);
9687 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9688 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
9689 ErrorMessage_set_data(&this_ptr_conv, val_ref);
9692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
9693 LDKThirtyTwoBytes channel_id_arg_ref;
9694 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
9695 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9696 LDKCVec_u8Z data_arg_ref;
9697 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
9698 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9699 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
9700 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
9701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9703 long ret_ref = (long)ret_var.inner;
9704 if (ret_var.is_owned) {
9710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9711 LDKPing this_ptr_conv;
9712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9714 Ping_free(this_ptr_conv);
9717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9719 orig_conv.inner = (void*)(orig & (~1));
9720 orig_conv.is_owned = false;
9721 LDKPing ret_var = Ping_clone(&orig_conv);
9722 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9723 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9724 long ret_ref = (long)ret_var.inner;
9725 if (ret_var.is_owned) {
9731 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9732 LDKPing this_ptr_conv;
9733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9734 this_ptr_conv.is_owned = false;
9735 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
9739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9740 LDKPing this_ptr_conv;
9741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9742 this_ptr_conv.is_owned = false;
9743 Ping_set_ponglen(&this_ptr_conv, val);
9746 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9747 LDKPing this_ptr_conv;
9748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9749 this_ptr_conv.is_owned = false;
9750 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
9754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9755 LDKPing this_ptr_conv;
9756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9757 this_ptr_conv.is_owned = false;
9758 Ping_set_byteslen(&this_ptr_conv, val);
9761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
9762 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
9763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9765 long ret_ref = (long)ret_var.inner;
9766 if (ret_var.is_owned) {
9772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9773 LDKPong this_ptr_conv;
9774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9776 Pong_free(this_ptr_conv);
9779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9781 orig_conv.inner = (void*)(orig & (~1));
9782 orig_conv.is_owned = false;
9783 LDKPong ret_var = Pong_clone(&orig_conv);
9784 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9785 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9786 long ret_ref = (long)ret_var.inner;
9787 if (ret_var.is_owned) {
9793 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9794 LDKPong this_ptr_conv;
9795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9796 this_ptr_conv.is_owned = false;
9797 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
9801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9802 LDKPong this_ptr_conv;
9803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9804 this_ptr_conv.is_owned = false;
9805 Pong_set_byteslen(&this_ptr_conv, val);
9808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
9809 LDKPong ret_var = Pong_new(byteslen_arg);
9810 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9811 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9812 long ret_ref = (long)ret_var.inner;
9813 if (ret_var.is_owned) {
9819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9820 LDKOpenChannel this_ptr_conv;
9821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9823 OpenChannel_free(this_ptr_conv);
9826 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9827 LDKOpenChannel orig_conv;
9828 orig_conv.inner = (void*)(orig & (~1));
9829 orig_conv.is_owned = false;
9830 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
9831 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9832 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9833 long ret_ref = (long)ret_var.inner;
9834 if (ret_var.is_owned) {
9840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
9841 LDKOpenChannel this_ptr_conv;
9842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9843 this_ptr_conv.is_owned = false;
9844 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9845 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
9849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9850 LDKOpenChannel this_ptr_conv;
9851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9852 this_ptr_conv.is_owned = false;
9853 LDKThirtyTwoBytes val_ref;
9854 CHECK((*env)->GetArrayLength(env, val) == 32);
9855 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9856 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
9859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9860 LDKOpenChannel this_ptr_conv;
9861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9862 this_ptr_conv.is_owned = false;
9863 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9864 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
9868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9869 LDKOpenChannel this_ptr_conv;
9870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9871 this_ptr_conv.is_owned = false;
9872 LDKThirtyTwoBytes val_ref;
9873 CHECK((*env)->GetArrayLength(env, val) == 32);
9874 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9875 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
9878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9879 LDKOpenChannel this_ptr_conv;
9880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9881 this_ptr_conv.is_owned = false;
9882 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
9886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9887 LDKOpenChannel this_ptr_conv;
9888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9889 this_ptr_conv.is_owned = false;
9890 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
9893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9894 LDKOpenChannel this_ptr_conv;
9895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9896 this_ptr_conv.is_owned = false;
9897 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
9901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9902 LDKOpenChannel this_ptr_conv;
9903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9904 this_ptr_conv.is_owned = false;
9905 OpenChannel_set_push_msat(&this_ptr_conv, val);
9908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9909 LDKOpenChannel this_ptr_conv;
9910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9911 this_ptr_conv.is_owned = false;
9912 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
9916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9917 LDKOpenChannel this_ptr_conv;
9918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9919 this_ptr_conv.is_owned = false;
9920 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
9923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9924 LDKOpenChannel this_ptr_conv;
9925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9926 this_ptr_conv.is_owned = false;
9927 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
9931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9932 LDKOpenChannel this_ptr_conv;
9933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9934 this_ptr_conv.is_owned = false;
9935 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9939 LDKOpenChannel this_ptr_conv;
9940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9941 this_ptr_conv.is_owned = false;
9942 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
9946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9947 LDKOpenChannel this_ptr_conv;
9948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9949 this_ptr_conv.is_owned = false;
9950 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
9953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9954 LDKOpenChannel this_ptr_conv;
9955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9956 this_ptr_conv.is_owned = false;
9957 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
9961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9962 LDKOpenChannel this_ptr_conv;
9963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9964 this_ptr_conv.is_owned = false;
9965 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
9968 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
9969 LDKOpenChannel this_ptr_conv;
9970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9971 this_ptr_conv.is_owned = false;
9972 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
9976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9977 LDKOpenChannel this_ptr_conv;
9978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9979 this_ptr_conv.is_owned = false;
9980 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
9983 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9984 LDKOpenChannel this_ptr_conv;
9985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9986 this_ptr_conv.is_owned = false;
9987 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
9991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9992 LDKOpenChannel this_ptr_conv;
9993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9994 this_ptr_conv.is_owned = false;
9995 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
9998 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
9999 LDKOpenChannel this_ptr_conv;
10000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10001 this_ptr_conv.is_owned = false;
10002 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
10006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10007 LDKOpenChannel this_ptr_conv;
10008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10009 this_ptr_conv.is_owned = false;
10010 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
10013 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10014 LDKOpenChannel this_ptr_conv;
10015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10016 this_ptr_conv.is_owned = false;
10017 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10018 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
10022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10023 LDKOpenChannel this_ptr_conv;
10024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10025 this_ptr_conv.is_owned = false;
10026 LDKPublicKey val_ref;
10027 CHECK((*env)->GetArrayLength(env, val) == 33);
10028 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10029 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10032 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10033 LDKOpenChannel this_ptr_conv;
10034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10035 this_ptr_conv.is_owned = false;
10036 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10037 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10042 LDKOpenChannel this_ptr_conv;
10043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10044 this_ptr_conv.is_owned = false;
10045 LDKPublicKey val_ref;
10046 CHECK((*env)->GetArrayLength(env, val) == 33);
10047 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10048 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10051 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10052 LDKOpenChannel this_ptr_conv;
10053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10054 this_ptr_conv.is_owned = false;
10055 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10056 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
10060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10061 LDKOpenChannel this_ptr_conv;
10062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10063 this_ptr_conv.is_owned = false;
10064 LDKPublicKey val_ref;
10065 CHECK((*env)->GetArrayLength(env, val) == 33);
10066 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10067 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
10070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10071 LDKOpenChannel this_ptr_conv;
10072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10073 this_ptr_conv.is_owned = false;
10074 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10075 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10080 LDKOpenChannel this_ptr_conv;
10081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10082 this_ptr_conv.is_owned = false;
10083 LDKPublicKey val_ref;
10084 CHECK((*env)->GetArrayLength(env, val) == 33);
10085 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10086 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10089 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10090 LDKOpenChannel this_ptr_conv;
10091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10092 this_ptr_conv.is_owned = false;
10093 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10094 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10099 LDKOpenChannel this_ptr_conv;
10100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10101 this_ptr_conv.is_owned = false;
10102 LDKPublicKey val_ref;
10103 CHECK((*env)->GetArrayLength(env, val) == 33);
10104 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10105 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10109 LDKOpenChannel this_ptr_conv;
10110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10111 this_ptr_conv.is_owned = false;
10112 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10113 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10118 LDKOpenChannel this_ptr_conv;
10119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10120 this_ptr_conv.is_owned = false;
10121 LDKPublicKey val_ref;
10122 CHECK((*env)->GetArrayLength(env, val) == 33);
10123 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10124 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10127 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
10128 LDKOpenChannel this_ptr_conv;
10129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10130 this_ptr_conv.is_owned = false;
10131 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
10135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
10136 LDKOpenChannel this_ptr_conv;
10137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10138 this_ptr_conv.is_owned = false;
10139 OpenChannel_set_channel_flags(&this_ptr_conv, val);
10142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10143 LDKAcceptChannel this_ptr_conv;
10144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10146 AcceptChannel_free(this_ptr_conv);
10149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10150 LDKAcceptChannel orig_conv;
10151 orig_conv.inner = (void*)(orig & (~1));
10152 orig_conv.is_owned = false;
10153 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
10154 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10155 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10156 long ret_ref = (long)ret_var.inner;
10157 if (ret_var.is_owned) {
10163 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10164 LDKAcceptChannel this_ptr_conv;
10165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10166 this_ptr_conv.is_owned = false;
10167 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10168 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
10172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10173 LDKAcceptChannel this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = false;
10176 LDKThirtyTwoBytes val_ref;
10177 CHECK((*env)->GetArrayLength(env, val) == 32);
10178 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10179 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
10182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10183 LDKAcceptChannel this_ptr_conv;
10184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10185 this_ptr_conv.is_owned = false;
10186 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
10190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10191 LDKAcceptChannel this_ptr_conv;
10192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10193 this_ptr_conv.is_owned = false;
10194 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
10197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10198 LDKAcceptChannel this_ptr_conv;
10199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10200 this_ptr_conv.is_owned = false;
10201 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
10205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10206 LDKAcceptChannel this_ptr_conv;
10207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10208 this_ptr_conv.is_owned = false;
10209 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10213 LDKAcceptChannel this_ptr_conv;
10214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10215 this_ptr_conv.is_owned = false;
10216 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
10220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10221 LDKAcceptChannel this_ptr_conv;
10222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10223 this_ptr_conv.is_owned = false;
10224 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
10227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10228 LDKAcceptChannel this_ptr_conv;
10229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10230 this_ptr_conv.is_owned = false;
10231 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
10235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10236 LDKAcceptChannel this_ptr_conv;
10237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10238 this_ptr_conv.is_owned = false;
10239 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
10242 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10243 LDKAcceptChannel this_ptr_conv;
10244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10245 this_ptr_conv.is_owned = false;
10246 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
10250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10251 LDKAcceptChannel this_ptr_conv;
10252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10253 this_ptr_conv.is_owned = false;
10254 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
10257 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10258 LDKAcceptChannel this_ptr_conv;
10259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10260 this_ptr_conv.is_owned = false;
10261 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
10265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10266 LDKAcceptChannel this_ptr_conv;
10267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10268 this_ptr_conv.is_owned = false;
10269 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
10272 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
10273 LDKAcceptChannel this_ptr_conv;
10274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10275 this_ptr_conv.is_owned = false;
10276 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
10280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10281 LDKAcceptChannel this_ptr_conv;
10282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10283 this_ptr_conv.is_owned = false;
10284 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
10287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10288 LDKAcceptChannel this_ptr_conv;
10289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10290 this_ptr_conv.is_owned = false;
10291 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10292 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
10296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10297 LDKAcceptChannel this_ptr_conv;
10298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10299 this_ptr_conv.is_owned = false;
10300 LDKPublicKey val_ref;
10301 CHECK((*env)->GetArrayLength(env, val) == 33);
10302 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10303 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10306 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10307 LDKAcceptChannel this_ptr_conv;
10308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10309 this_ptr_conv.is_owned = false;
10310 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10311 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10316 LDKAcceptChannel this_ptr_conv;
10317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10318 this_ptr_conv.is_owned = false;
10319 LDKPublicKey val_ref;
10320 CHECK((*env)->GetArrayLength(env, val) == 33);
10321 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10322 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10326 LDKAcceptChannel this_ptr_conv;
10327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10328 this_ptr_conv.is_owned = false;
10329 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10330 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
10334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10335 LDKAcceptChannel this_ptr_conv;
10336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10337 this_ptr_conv.is_owned = false;
10338 LDKPublicKey val_ref;
10339 CHECK((*env)->GetArrayLength(env, val) == 33);
10340 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10341 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
10344 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10345 LDKAcceptChannel this_ptr_conv;
10346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10347 this_ptr_conv.is_owned = false;
10348 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10349 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10354 LDKAcceptChannel this_ptr_conv;
10355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10356 this_ptr_conv.is_owned = false;
10357 LDKPublicKey val_ref;
10358 CHECK((*env)->GetArrayLength(env, val) == 33);
10359 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10360 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10363 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10364 LDKAcceptChannel this_ptr_conv;
10365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10366 this_ptr_conv.is_owned = false;
10367 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10368 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10373 LDKAcceptChannel this_ptr_conv;
10374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10375 this_ptr_conv.is_owned = false;
10376 LDKPublicKey val_ref;
10377 CHECK((*env)->GetArrayLength(env, val) == 33);
10378 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10379 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10382 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10383 LDKAcceptChannel this_ptr_conv;
10384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10385 this_ptr_conv.is_owned = false;
10386 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10387 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10392 LDKAcceptChannel this_ptr_conv;
10393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10394 this_ptr_conv.is_owned = false;
10395 LDKPublicKey val_ref;
10396 CHECK((*env)->GetArrayLength(env, val) == 33);
10397 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10398 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10402 LDKFundingCreated this_ptr_conv;
10403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10404 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10405 FundingCreated_free(this_ptr_conv);
10408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10409 LDKFundingCreated orig_conv;
10410 orig_conv.inner = (void*)(orig & (~1));
10411 orig_conv.is_owned = false;
10412 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
10413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10415 long ret_ref = (long)ret_var.inner;
10416 if (ret_var.is_owned) {
10422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10423 LDKFundingCreated this_ptr_conv;
10424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10425 this_ptr_conv.is_owned = false;
10426 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10427 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
10431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10432 LDKFundingCreated this_ptr_conv;
10433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10434 this_ptr_conv.is_owned = false;
10435 LDKThirtyTwoBytes val_ref;
10436 CHECK((*env)->GetArrayLength(env, val) == 32);
10437 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10438 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
10441 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
10442 LDKFundingCreated this_ptr_conv;
10443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10444 this_ptr_conv.is_owned = false;
10445 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10446 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
10450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10451 LDKFundingCreated this_ptr_conv;
10452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10453 this_ptr_conv.is_owned = false;
10454 LDKThirtyTwoBytes val_ref;
10455 CHECK((*env)->GetArrayLength(env, val) == 32);
10456 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10457 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
10460 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
10461 LDKFundingCreated this_ptr_conv;
10462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10463 this_ptr_conv.is_owned = false;
10464 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
10468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10469 LDKFundingCreated this_ptr_conv;
10470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10471 this_ptr_conv.is_owned = false;
10472 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
10475 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10476 LDKFundingCreated this_ptr_conv;
10477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10478 this_ptr_conv.is_owned = false;
10479 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10480 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
10484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10485 LDKFundingCreated this_ptr_conv;
10486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10487 this_ptr_conv.is_owned = false;
10488 LDKSignature val_ref;
10489 CHECK((*env)->GetArrayLength(env, val) == 64);
10490 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10491 FundingCreated_set_signature(&this_ptr_conv, val_ref);
10494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv *env, jclass clz, int8_tArray temporary_channel_id_arg, int8_tArray funding_txid_arg, int16_t funding_output_index_arg, int8_tArray signature_arg) {
10495 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
10496 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
10497 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
10498 LDKThirtyTwoBytes funding_txid_arg_ref;
10499 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
10500 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
10501 LDKSignature signature_arg_ref;
10502 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10503 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10504 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
10505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10507 long ret_ref = (long)ret_var.inner;
10508 if (ret_var.is_owned) {
10514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10515 LDKFundingSigned this_ptr_conv;
10516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10518 FundingSigned_free(this_ptr_conv);
10521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10522 LDKFundingSigned orig_conv;
10523 orig_conv.inner = (void*)(orig & (~1));
10524 orig_conv.is_owned = false;
10525 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
10526 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10527 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10528 long ret_ref = (long)ret_var.inner;
10529 if (ret_var.is_owned) {
10535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10536 LDKFundingSigned this_ptr_conv;
10537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10538 this_ptr_conv.is_owned = false;
10539 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10540 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
10544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10545 LDKFundingSigned this_ptr_conv;
10546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10547 this_ptr_conv.is_owned = false;
10548 LDKThirtyTwoBytes val_ref;
10549 CHECK((*env)->GetArrayLength(env, val) == 32);
10550 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10551 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
10554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10555 LDKFundingSigned this_ptr_conv;
10556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10557 this_ptr_conv.is_owned = false;
10558 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10559 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
10563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10564 LDKFundingSigned this_ptr_conv;
10565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10566 this_ptr_conv.is_owned = false;
10567 LDKSignature val_ref;
10568 CHECK((*env)->GetArrayLength(env, val) == 64);
10569 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10570 FundingSigned_set_signature(&this_ptr_conv, val_ref);
10573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
10574 LDKThirtyTwoBytes channel_id_arg_ref;
10575 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10576 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10577 LDKSignature signature_arg_ref;
10578 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10579 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10580 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
10581 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10582 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10583 long ret_ref = (long)ret_var.inner;
10584 if (ret_var.is_owned) {
10590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10591 LDKFundingLocked this_ptr_conv;
10592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10593 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10594 FundingLocked_free(this_ptr_conv);
10597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10598 LDKFundingLocked orig_conv;
10599 orig_conv.inner = (void*)(orig & (~1));
10600 orig_conv.is_owned = false;
10601 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
10602 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10603 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10604 long ret_ref = (long)ret_var.inner;
10605 if (ret_var.is_owned) {
10611 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10612 LDKFundingLocked this_ptr_conv;
10613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10614 this_ptr_conv.is_owned = false;
10615 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10616 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
10620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10621 LDKFundingLocked this_ptr_conv;
10622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10623 this_ptr_conv.is_owned = false;
10624 LDKThirtyTwoBytes val_ref;
10625 CHECK((*env)->GetArrayLength(env, val) == 32);
10626 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10627 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
10630 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10631 LDKFundingLocked this_ptr_conv;
10632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10633 this_ptr_conv.is_owned = false;
10634 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10635 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
10639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10640 LDKFundingLocked this_ptr_conv;
10641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10642 this_ptr_conv.is_owned = false;
10643 LDKPublicKey val_ref;
10644 CHECK((*env)->GetArrayLength(env, val) == 33);
10645 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10646 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
10649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray next_per_commitment_point_arg) {
10650 LDKThirtyTwoBytes channel_id_arg_ref;
10651 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10652 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10653 LDKPublicKey next_per_commitment_point_arg_ref;
10654 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
10655 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
10656 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
10657 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10658 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10659 long ret_ref = (long)ret_var.inner;
10660 if (ret_var.is_owned) {
10666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10667 LDKShutdown this_ptr_conv;
10668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10670 Shutdown_free(this_ptr_conv);
10673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10674 LDKShutdown orig_conv;
10675 orig_conv.inner = (void*)(orig & (~1));
10676 orig_conv.is_owned = false;
10677 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
10678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10680 long ret_ref = (long)ret_var.inner;
10681 if (ret_var.is_owned) {
10687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10688 LDKShutdown this_ptr_conv;
10689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10690 this_ptr_conv.is_owned = false;
10691 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10692 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
10696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10697 LDKShutdown this_ptr_conv;
10698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10699 this_ptr_conv.is_owned = false;
10700 LDKThirtyTwoBytes val_ref;
10701 CHECK((*env)->GetArrayLength(env, val) == 32);
10702 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10703 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
10706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10707 LDKShutdown this_ptr_conv;
10708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10709 this_ptr_conv.is_owned = false;
10710 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
10711 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10712 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10717 LDKShutdown this_ptr_conv;
10718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10719 this_ptr_conv.is_owned = false;
10720 LDKCVec_u8Z val_ref;
10721 val_ref.datalen = (*env)->GetArrayLength(env, val);
10722 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10723 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
10724 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
10727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
10728 LDKThirtyTwoBytes channel_id_arg_ref;
10729 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10730 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10731 LDKCVec_u8Z scriptpubkey_arg_ref;
10732 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
10733 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10734 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
10735 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
10736 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10737 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10738 long ret_ref = (long)ret_var.inner;
10739 if (ret_var.is_owned) {
10745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10746 LDKClosingSigned this_ptr_conv;
10747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10749 ClosingSigned_free(this_ptr_conv);
10752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10753 LDKClosingSigned orig_conv;
10754 orig_conv.inner = (void*)(orig & (~1));
10755 orig_conv.is_owned = false;
10756 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
10757 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10758 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10759 long ret_ref = (long)ret_var.inner;
10760 if (ret_var.is_owned) {
10766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10767 LDKClosingSigned this_ptr_conv;
10768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10769 this_ptr_conv.is_owned = false;
10770 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10771 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
10775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10776 LDKClosingSigned this_ptr_conv;
10777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10778 this_ptr_conv.is_owned = false;
10779 LDKThirtyTwoBytes val_ref;
10780 CHECK((*env)->GetArrayLength(env, val) == 32);
10781 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10782 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
10785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10786 LDKClosingSigned this_ptr_conv;
10787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10788 this_ptr_conv.is_owned = false;
10789 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
10793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10794 LDKClosingSigned this_ptr_conv;
10795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10796 this_ptr_conv.is_owned = false;
10797 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
10800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10801 LDKClosingSigned this_ptr_conv;
10802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10803 this_ptr_conv.is_owned = false;
10804 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10805 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
10809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10810 LDKClosingSigned this_ptr_conv;
10811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10812 this_ptr_conv.is_owned = false;
10813 LDKSignature val_ref;
10814 CHECK((*env)->GetArrayLength(env, val) == 64);
10815 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10816 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
10819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t fee_satoshis_arg, int8_tArray signature_arg) {
10820 LDKThirtyTwoBytes channel_id_arg_ref;
10821 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10822 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10823 LDKSignature signature_arg_ref;
10824 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10825 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10826 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
10827 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10828 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10829 long ret_ref = (long)ret_var.inner;
10830 if (ret_var.is_owned) {
10836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10837 LDKUpdateAddHTLC this_ptr_conv;
10838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10840 UpdateAddHTLC_free(this_ptr_conv);
10843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10844 LDKUpdateAddHTLC orig_conv;
10845 orig_conv.inner = (void*)(orig & (~1));
10846 orig_conv.is_owned = false;
10847 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
10848 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10849 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10850 long ret_ref = (long)ret_var.inner;
10851 if (ret_var.is_owned) {
10857 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10858 LDKUpdateAddHTLC this_ptr_conv;
10859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10860 this_ptr_conv.is_owned = false;
10861 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10862 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
10866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10867 LDKUpdateAddHTLC this_ptr_conv;
10868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10869 this_ptr_conv.is_owned = false;
10870 LDKThirtyTwoBytes val_ref;
10871 CHECK((*env)->GetArrayLength(env, val) == 32);
10872 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10873 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
10876 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10877 LDKUpdateAddHTLC this_ptr_conv;
10878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10879 this_ptr_conv.is_owned = false;
10880 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
10884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10885 LDKUpdateAddHTLC this_ptr_conv;
10886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10887 this_ptr_conv.is_owned = false;
10888 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
10891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10892 LDKUpdateAddHTLC this_ptr_conv;
10893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10894 this_ptr_conv.is_owned = false;
10895 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
10899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10900 LDKUpdateAddHTLC this_ptr_conv;
10901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10902 this_ptr_conv.is_owned = false;
10903 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
10906 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
10907 LDKUpdateAddHTLC this_ptr_conv;
10908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10909 this_ptr_conv.is_owned = false;
10910 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10911 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
10915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10916 LDKUpdateAddHTLC this_ptr_conv;
10917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10918 this_ptr_conv.is_owned = false;
10919 LDKThirtyTwoBytes val_ref;
10920 CHECK((*env)->GetArrayLength(env, val) == 32);
10921 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10922 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
10925 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
10926 LDKUpdateAddHTLC this_ptr_conv;
10927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10928 this_ptr_conv.is_owned = false;
10929 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
10933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10934 LDKUpdateAddHTLC this_ptr_conv;
10935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10936 this_ptr_conv.is_owned = false;
10937 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
10940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10941 LDKUpdateFulfillHTLC this_ptr_conv;
10942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10944 UpdateFulfillHTLC_free(this_ptr_conv);
10947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10948 LDKUpdateFulfillHTLC orig_conv;
10949 orig_conv.inner = (void*)(orig & (~1));
10950 orig_conv.is_owned = false;
10951 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
10952 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10953 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10954 long ret_ref = (long)ret_var.inner;
10955 if (ret_var.is_owned) {
10961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10962 LDKUpdateFulfillHTLC this_ptr_conv;
10963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10964 this_ptr_conv.is_owned = false;
10965 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10966 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
10970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10971 LDKUpdateFulfillHTLC this_ptr_conv;
10972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10973 this_ptr_conv.is_owned = false;
10974 LDKThirtyTwoBytes val_ref;
10975 CHECK((*env)->GetArrayLength(env, val) == 32);
10976 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10977 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
10980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10981 LDKUpdateFulfillHTLC this_ptr_conv;
10982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10983 this_ptr_conv.is_owned = false;
10984 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
10988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10989 LDKUpdateFulfillHTLC this_ptr_conv;
10990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10991 this_ptr_conv.is_owned = false;
10992 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
10995 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
10996 LDKUpdateFulfillHTLC this_ptr_conv;
10997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10998 this_ptr_conv.is_owned = false;
10999 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11000 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
11004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11005 LDKUpdateFulfillHTLC this_ptr_conv;
11006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11007 this_ptr_conv.is_owned = false;
11008 LDKThirtyTwoBytes val_ref;
11009 CHECK((*env)->GetArrayLength(env, val) == 32);
11010 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11011 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
11014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t htlc_id_arg, int8_tArray payment_preimage_arg) {
11015 LDKThirtyTwoBytes channel_id_arg_ref;
11016 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11017 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11018 LDKThirtyTwoBytes payment_preimage_arg_ref;
11019 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
11020 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
11021 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
11022 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11023 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11024 long ret_ref = (long)ret_var.inner;
11025 if (ret_var.is_owned) {
11031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11032 LDKUpdateFailHTLC this_ptr_conv;
11033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11035 UpdateFailHTLC_free(this_ptr_conv);
11038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11039 LDKUpdateFailHTLC orig_conv;
11040 orig_conv.inner = (void*)(orig & (~1));
11041 orig_conv.is_owned = false;
11042 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
11043 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11044 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11045 long ret_ref = (long)ret_var.inner;
11046 if (ret_var.is_owned) {
11052 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11053 LDKUpdateFailHTLC this_ptr_conv;
11054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11055 this_ptr_conv.is_owned = false;
11056 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11057 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
11061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11062 LDKUpdateFailHTLC this_ptr_conv;
11063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11064 this_ptr_conv.is_owned = false;
11065 LDKThirtyTwoBytes val_ref;
11066 CHECK((*env)->GetArrayLength(env, val) == 32);
11067 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11068 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
11071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11072 LDKUpdateFailHTLC this_ptr_conv;
11073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11074 this_ptr_conv.is_owned = false;
11075 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
11079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11080 LDKUpdateFailHTLC this_ptr_conv;
11081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11082 this_ptr_conv.is_owned = false;
11083 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
11086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11087 LDKUpdateFailMalformedHTLC this_ptr_conv;
11088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11090 UpdateFailMalformedHTLC_free(this_ptr_conv);
11093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11094 LDKUpdateFailMalformedHTLC orig_conv;
11095 orig_conv.inner = (void*)(orig & (~1));
11096 orig_conv.is_owned = false;
11097 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
11098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11100 long ret_ref = (long)ret_var.inner;
11101 if (ret_var.is_owned) {
11107 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11108 LDKUpdateFailMalformedHTLC this_ptr_conv;
11109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11110 this_ptr_conv.is_owned = false;
11111 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11112 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
11116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11117 LDKUpdateFailMalformedHTLC this_ptr_conv;
11118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11119 this_ptr_conv.is_owned = false;
11120 LDKThirtyTwoBytes val_ref;
11121 CHECK((*env)->GetArrayLength(env, val) == 32);
11122 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11123 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
11126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11127 LDKUpdateFailMalformedHTLC this_ptr_conv;
11128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11129 this_ptr_conv.is_owned = false;
11130 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
11134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11135 LDKUpdateFailMalformedHTLC this_ptr_conv;
11136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11137 this_ptr_conv.is_owned = false;
11138 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
11141 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
11142 LDKUpdateFailMalformedHTLC this_ptr_conv;
11143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11144 this_ptr_conv.is_owned = false;
11145 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
11149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11150 LDKUpdateFailMalformedHTLC this_ptr_conv;
11151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11152 this_ptr_conv.is_owned = false;
11153 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
11156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11157 LDKCommitmentSigned this_ptr_conv;
11158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11160 CommitmentSigned_free(this_ptr_conv);
11163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11164 LDKCommitmentSigned orig_conv;
11165 orig_conv.inner = (void*)(orig & (~1));
11166 orig_conv.is_owned = false;
11167 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
11168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11170 long ret_ref = (long)ret_var.inner;
11171 if (ret_var.is_owned) {
11177 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11178 LDKCommitmentSigned this_ptr_conv;
11179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11180 this_ptr_conv.is_owned = false;
11181 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11182 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
11186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11187 LDKCommitmentSigned this_ptr_conv;
11188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11189 this_ptr_conv.is_owned = false;
11190 LDKThirtyTwoBytes val_ref;
11191 CHECK((*env)->GetArrayLength(env, val) == 32);
11192 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11193 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
11196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11197 LDKCommitmentSigned this_ptr_conv;
11198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11199 this_ptr_conv.is_owned = false;
11200 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11201 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
11205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11206 LDKCommitmentSigned this_ptr_conv;
11207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11208 this_ptr_conv.is_owned = false;
11209 LDKSignature val_ref;
11210 CHECK((*env)->GetArrayLength(env, val) == 64);
11211 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11212 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
11215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
11216 LDKCommitmentSigned this_ptr_conv;
11217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11218 this_ptr_conv.is_owned = false;
11219 LDKCVec_SignatureZ val_constr;
11220 val_constr.datalen = (*env)->GetArrayLength(env, val);
11221 if (val_constr.datalen > 0)
11222 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11224 val_constr.data = NULL;
11225 for (size_t i = 0; i < val_constr.datalen; i++) {
11226 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
11227 LDKSignature arr_conv_8_ref;
11228 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11229 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11230 val_constr.data[i] = arr_conv_8_ref;
11232 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
11235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg, jobjectArray htlc_signatures_arg) {
11236 LDKThirtyTwoBytes channel_id_arg_ref;
11237 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11238 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11239 LDKSignature signature_arg_ref;
11240 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11241 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11242 LDKCVec_SignatureZ htlc_signatures_arg_constr;
11243 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
11244 if (htlc_signatures_arg_constr.datalen > 0)
11245 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11247 htlc_signatures_arg_constr.data = NULL;
11248 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
11249 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
11250 LDKSignature arr_conv_8_ref;
11251 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11252 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11253 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
11255 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
11256 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11257 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11258 long ret_ref = (long)ret_var.inner;
11259 if (ret_var.is_owned) {
11265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11266 LDKRevokeAndACK this_ptr_conv;
11267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11269 RevokeAndACK_free(this_ptr_conv);
11272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11273 LDKRevokeAndACK orig_conv;
11274 orig_conv.inner = (void*)(orig & (~1));
11275 orig_conv.is_owned = false;
11276 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
11277 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11278 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11279 long ret_ref = (long)ret_var.inner;
11280 if (ret_var.is_owned) {
11286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11287 LDKRevokeAndACK this_ptr_conv;
11288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11289 this_ptr_conv.is_owned = false;
11290 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11291 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
11295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11296 LDKRevokeAndACK this_ptr_conv;
11297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11298 this_ptr_conv.is_owned = false;
11299 LDKThirtyTwoBytes val_ref;
11300 CHECK((*env)->GetArrayLength(env, val) == 32);
11301 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11302 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
11305 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11306 LDKRevokeAndACK this_ptr_conv;
11307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11308 this_ptr_conv.is_owned = false;
11309 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11310 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
11314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11315 LDKRevokeAndACK this_ptr_conv;
11316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11317 this_ptr_conv.is_owned = false;
11318 LDKThirtyTwoBytes val_ref;
11319 CHECK((*env)->GetArrayLength(env, val) == 32);
11320 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11321 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
11324 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11325 LDKRevokeAndACK this_ptr_conv;
11326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11327 this_ptr_conv.is_owned = false;
11328 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11329 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
11333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11334 LDKRevokeAndACK this_ptr_conv;
11335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11336 this_ptr_conv.is_owned = false;
11337 LDKPublicKey val_ref;
11338 CHECK((*env)->GetArrayLength(env, val) == 33);
11339 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11340 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
11343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray per_commitment_secret_arg, int8_tArray next_per_commitment_point_arg) {
11344 LDKThirtyTwoBytes channel_id_arg_ref;
11345 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11346 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11347 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
11348 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
11349 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
11350 LDKPublicKey next_per_commitment_point_arg_ref;
11351 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
11352 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
11353 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
11354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11356 long ret_ref = (long)ret_var.inner;
11357 if (ret_var.is_owned) {
11363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11364 LDKUpdateFee this_ptr_conv;
11365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11367 UpdateFee_free(this_ptr_conv);
11370 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11371 LDKUpdateFee orig_conv;
11372 orig_conv.inner = (void*)(orig & (~1));
11373 orig_conv.is_owned = false;
11374 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
11375 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11376 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11377 long ret_ref = (long)ret_var.inner;
11378 if (ret_var.is_owned) {
11384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11385 LDKUpdateFee this_ptr_conv;
11386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11387 this_ptr_conv.is_owned = false;
11388 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11389 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
11393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11394 LDKUpdateFee this_ptr_conv;
11395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11396 this_ptr_conv.is_owned = false;
11397 LDKThirtyTwoBytes val_ref;
11398 CHECK((*env)->GetArrayLength(env, val) == 32);
11399 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11400 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
11403 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
11404 LDKUpdateFee this_ptr_conv;
11405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11406 this_ptr_conv.is_owned = false;
11407 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
11411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11412 LDKUpdateFee this_ptr_conv;
11413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11414 this_ptr_conv.is_owned = false;
11415 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
11418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int32_t feerate_per_kw_arg) {
11419 LDKThirtyTwoBytes channel_id_arg_ref;
11420 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11421 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11422 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
11423 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11424 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11425 long ret_ref = (long)ret_var.inner;
11426 if (ret_var.is_owned) {
11432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11433 LDKDataLossProtect this_ptr_conv;
11434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11436 DataLossProtect_free(this_ptr_conv);
11439 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11440 LDKDataLossProtect orig_conv;
11441 orig_conv.inner = (void*)(orig & (~1));
11442 orig_conv.is_owned = false;
11443 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
11444 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11445 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11446 long ret_ref = (long)ret_var.inner;
11447 if (ret_var.is_owned) {
11453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11454 LDKDataLossProtect this_ptr_conv;
11455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11456 this_ptr_conv.is_owned = false;
11457 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11458 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
11462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11463 LDKDataLossProtect this_ptr_conv;
11464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11465 this_ptr_conv.is_owned = false;
11466 LDKThirtyTwoBytes val_ref;
11467 CHECK((*env)->GetArrayLength(env, val) == 32);
11468 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11469 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
11472 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11473 LDKDataLossProtect this_ptr_conv;
11474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11475 this_ptr_conv.is_owned = false;
11476 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11477 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
11481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11482 LDKDataLossProtect this_ptr_conv;
11483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11484 this_ptr_conv.is_owned = false;
11485 LDKPublicKey val_ref;
11486 CHECK((*env)->GetArrayLength(env, val) == 33);
11487 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11488 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
11491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv *env, jclass clz, int8_tArray your_last_per_commitment_secret_arg, int8_tArray my_current_per_commitment_point_arg) {
11492 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
11493 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
11494 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
11495 LDKPublicKey my_current_per_commitment_point_arg_ref;
11496 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
11497 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
11498 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
11499 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11500 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11501 long ret_ref = (long)ret_var.inner;
11502 if (ret_var.is_owned) {
11508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11509 LDKChannelReestablish this_ptr_conv;
11510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11512 ChannelReestablish_free(this_ptr_conv);
11515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11516 LDKChannelReestablish orig_conv;
11517 orig_conv.inner = (void*)(orig & (~1));
11518 orig_conv.is_owned = false;
11519 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
11520 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11521 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11522 long ret_ref = (long)ret_var.inner;
11523 if (ret_var.is_owned) {
11529 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11530 LDKChannelReestablish this_ptr_conv;
11531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11532 this_ptr_conv.is_owned = false;
11533 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11534 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
11538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11539 LDKChannelReestablish this_ptr_conv;
11540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11541 this_ptr_conv.is_owned = false;
11542 LDKThirtyTwoBytes val_ref;
11543 CHECK((*env)->GetArrayLength(env, val) == 32);
11544 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11545 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
11548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11549 LDKChannelReestablish this_ptr_conv;
11550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11551 this_ptr_conv.is_owned = false;
11552 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
11556 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11557 LDKChannelReestablish this_ptr_conv;
11558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11559 this_ptr_conv.is_owned = false;
11560 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
11563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11564 LDKChannelReestablish this_ptr_conv;
11565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11566 this_ptr_conv.is_owned = false;
11567 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
11571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11572 LDKChannelReestablish this_ptr_conv;
11573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11574 this_ptr_conv.is_owned = false;
11575 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
11578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11579 LDKAnnouncementSignatures this_ptr_conv;
11580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11582 AnnouncementSignatures_free(this_ptr_conv);
11585 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11586 LDKAnnouncementSignatures orig_conv;
11587 orig_conv.inner = (void*)(orig & (~1));
11588 orig_conv.is_owned = false;
11589 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
11590 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11591 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11592 long ret_ref = (long)ret_var.inner;
11593 if (ret_var.is_owned) {
11599 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11600 LDKAnnouncementSignatures this_ptr_conv;
11601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11602 this_ptr_conv.is_owned = false;
11603 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11604 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
11608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11609 LDKAnnouncementSignatures this_ptr_conv;
11610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11611 this_ptr_conv.is_owned = false;
11612 LDKThirtyTwoBytes val_ref;
11613 CHECK((*env)->GetArrayLength(env, val) == 32);
11614 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11615 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
11618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11619 LDKAnnouncementSignatures this_ptr_conv;
11620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11621 this_ptr_conv.is_owned = false;
11622 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
11626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11627 LDKAnnouncementSignatures this_ptr_conv;
11628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11629 this_ptr_conv.is_owned = false;
11630 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
11633 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11634 LDKAnnouncementSignatures this_ptr_conv;
11635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11636 this_ptr_conv.is_owned = false;
11637 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11638 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
11642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11643 LDKAnnouncementSignatures this_ptr_conv;
11644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11645 this_ptr_conv.is_owned = false;
11646 LDKSignature val_ref;
11647 CHECK((*env)->GetArrayLength(env, val) == 64);
11648 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11649 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
11652 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11653 LDKAnnouncementSignatures this_ptr_conv;
11654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11655 this_ptr_conv.is_owned = false;
11656 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11657 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
11661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11662 LDKAnnouncementSignatures this_ptr_conv;
11663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11664 this_ptr_conv.is_owned = false;
11665 LDKSignature val_ref;
11666 CHECK((*env)->GetArrayLength(env, val) == 64);
11667 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11668 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
11671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t short_channel_id_arg, int8_tArray node_signature_arg, int8_tArray bitcoin_signature_arg) {
11672 LDKThirtyTwoBytes channel_id_arg_ref;
11673 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11674 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11675 LDKSignature node_signature_arg_ref;
11676 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
11677 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
11678 LDKSignature bitcoin_signature_arg_ref;
11679 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
11680 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
11681 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
11682 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11683 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11684 long ret_ref = (long)ret_var.inner;
11685 if (ret_var.is_owned) {
11691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11692 if ((this_ptr & 1) != 0) return;
11693 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
11694 FREE((void*)this_ptr);
11695 NetAddress_free(this_ptr_conv);
11698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11699 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
11700 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
11701 *ret_copy = NetAddress_clone(orig_conv);
11702 long ret_ref = (long)ret_copy;
11706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
11707 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
11708 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
11709 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
11710 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
11711 CVec_u8Z_free(arg_var);
11715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11716 LDKu8slice ser_ref;
11717 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11718 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11719 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11720 *ret_conv = Result_read(ser_ref);
11721 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11722 return (long)ret_conv;
11725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11726 LDKUnsignedNodeAnnouncement this_ptr_conv;
11727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11729 UnsignedNodeAnnouncement_free(this_ptr_conv);
11732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11733 LDKUnsignedNodeAnnouncement orig_conv;
11734 orig_conv.inner = (void*)(orig & (~1));
11735 orig_conv.is_owned = false;
11736 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
11737 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11738 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11739 long ret_ref = (long)ret_var.inner;
11740 if (ret_var.is_owned) {
11746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11747 LDKUnsignedNodeAnnouncement this_ptr_conv;
11748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11749 this_ptr_conv.is_owned = false;
11750 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
11751 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11752 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11753 long ret_ref = (long)ret_var.inner;
11754 if (ret_var.is_owned) {
11760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11761 LDKUnsignedNodeAnnouncement this_ptr_conv;
11762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11763 this_ptr_conv.is_owned = false;
11764 LDKNodeFeatures val_conv;
11765 val_conv.inner = (void*)(val & (~1));
11766 val_conv.is_owned = (val & 1) || (val == 0);
11767 // Warning: we need a move here but no clone is available for LDKNodeFeatures
11768 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
11771 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
11772 LDKUnsignedNodeAnnouncement this_ptr_conv;
11773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11774 this_ptr_conv.is_owned = false;
11775 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
11779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11780 LDKUnsignedNodeAnnouncement this_ptr_conv;
11781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11782 this_ptr_conv.is_owned = false;
11783 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
11786 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11787 LDKUnsignedNodeAnnouncement this_ptr_conv;
11788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11789 this_ptr_conv.is_owned = false;
11790 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11791 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
11795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11796 LDKUnsignedNodeAnnouncement this_ptr_conv;
11797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11798 this_ptr_conv.is_owned = false;
11799 LDKPublicKey val_ref;
11800 CHECK((*env)->GetArrayLength(env, val) == 33);
11801 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11802 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
11805 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
11806 LDKUnsignedNodeAnnouncement this_ptr_conv;
11807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11808 this_ptr_conv.is_owned = false;
11809 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
11810 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
11814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11815 LDKUnsignedNodeAnnouncement this_ptr_conv;
11816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11817 this_ptr_conv.is_owned = false;
11818 LDKThreeBytes val_ref;
11819 CHECK((*env)->GetArrayLength(env, val) == 3);
11820 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
11821 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
11824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
11825 LDKUnsignedNodeAnnouncement this_ptr_conv;
11826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11827 this_ptr_conv.is_owned = false;
11828 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
11833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11834 LDKUnsignedNodeAnnouncement this_ptr_conv;
11835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11836 this_ptr_conv.is_owned = false;
11837 LDKThirtyTwoBytes val_ref;
11838 CHECK((*env)->GetArrayLength(env, val) == 32);
11839 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11840 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
11843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
11844 LDKUnsignedNodeAnnouncement this_ptr_conv;
11845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11846 this_ptr_conv.is_owned = false;
11847 LDKCVec_NetAddressZ val_constr;
11848 val_constr.datalen = (*env)->GetArrayLength(env, val);
11849 if (val_constr.datalen > 0)
11850 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11852 val_constr.data = NULL;
11853 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
11854 for (size_t m = 0; m < val_constr.datalen; m++) {
11855 int64_t arr_conv_12 = val_vals[m];
11856 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
11857 FREE((void*)arr_conv_12);
11858 val_constr.data[m] = arr_conv_12_conv;
11860 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
11861 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
11864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11865 LDKNodeAnnouncement this_ptr_conv;
11866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11867 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11868 NodeAnnouncement_free(this_ptr_conv);
11871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11872 LDKNodeAnnouncement orig_conv;
11873 orig_conv.inner = (void*)(orig & (~1));
11874 orig_conv.is_owned = false;
11875 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
11876 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11877 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11878 long ret_ref = (long)ret_var.inner;
11879 if (ret_var.is_owned) {
11885 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11886 LDKNodeAnnouncement this_ptr_conv;
11887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11888 this_ptr_conv.is_owned = false;
11889 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11890 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
11894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11895 LDKNodeAnnouncement this_ptr_conv;
11896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11897 this_ptr_conv.is_owned = false;
11898 LDKSignature val_ref;
11899 CHECK((*env)->GetArrayLength(env, val) == 64);
11900 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11901 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
11904 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
11905 LDKNodeAnnouncement this_ptr_conv;
11906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11907 this_ptr_conv.is_owned = false;
11908 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
11909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11911 long ret_ref = (long)ret_var.inner;
11912 if (ret_var.is_owned) {
11918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11919 LDKNodeAnnouncement this_ptr_conv;
11920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11921 this_ptr_conv.is_owned = false;
11922 LDKUnsignedNodeAnnouncement val_conv;
11923 val_conv.inner = (void*)(val & (~1));
11924 val_conv.is_owned = (val & 1) || (val == 0);
11925 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
11926 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
11929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
11930 LDKSignature signature_arg_ref;
11931 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11932 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11933 LDKUnsignedNodeAnnouncement contents_arg_conv;
11934 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11935 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11936 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
11937 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
11938 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11939 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11940 long ret_ref = (long)ret_var.inner;
11941 if (ret_var.is_owned) {
11947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11948 LDKUnsignedChannelAnnouncement this_ptr_conv;
11949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11951 UnsignedChannelAnnouncement_free(this_ptr_conv);
11954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11955 LDKUnsignedChannelAnnouncement orig_conv;
11956 orig_conv.inner = (void*)(orig & (~1));
11957 orig_conv.is_owned = false;
11958 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
11959 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11960 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11961 long ret_ref = (long)ret_var.inner;
11962 if (ret_var.is_owned) {
11968 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11969 LDKUnsignedChannelAnnouncement this_ptr_conv;
11970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11971 this_ptr_conv.is_owned = false;
11972 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
11973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11975 long ret_ref = (long)ret_var.inner;
11976 if (ret_var.is_owned) {
11982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11983 LDKUnsignedChannelAnnouncement this_ptr_conv;
11984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11985 this_ptr_conv.is_owned = false;
11986 LDKChannelFeatures val_conv;
11987 val_conv.inner = (void*)(val & (~1));
11988 val_conv.is_owned = (val & 1) || (val == 0);
11989 // Warning: we need a move here but no clone is available for LDKChannelFeatures
11990 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
11993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11994 LDKUnsignedChannelAnnouncement this_ptr_conv;
11995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11996 this_ptr_conv.is_owned = false;
11997 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11998 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
12002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12003 LDKUnsignedChannelAnnouncement this_ptr_conv;
12004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12005 this_ptr_conv.is_owned = false;
12006 LDKThirtyTwoBytes val_ref;
12007 CHECK((*env)->GetArrayLength(env, val) == 32);
12008 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12009 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
12012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12013 LDKUnsignedChannelAnnouncement this_ptr_conv;
12014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12015 this_ptr_conv.is_owned = false;
12016 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
12020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12021 LDKUnsignedChannelAnnouncement this_ptr_conv;
12022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12023 this_ptr_conv.is_owned = false;
12024 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
12027 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12028 LDKUnsignedChannelAnnouncement this_ptr_conv;
12029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12030 this_ptr_conv.is_owned = false;
12031 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12032 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
12036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12037 LDKUnsignedChannelAnnouncement this_ptr_conv;
12038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12039 this_ptr_conv.is_owned = false;
12040 LDKPublicKey val_ref;
12041 CHECK((*env)->GetArrayLength(env, val) == 33);
12042 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12043 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
12046 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12047 LDKUnsignedChannelAnnouncement this_ptr_conv;
12048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12049 this_ptr_conv.is_owned = false;
12050 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12051 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
12055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12056 LDKUnsignedChannelAnnouncement this_ptr_conv;
12057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12058 this_ptr_conv.is_owned = false;
12059 LDKPublicKey val_ref;
12060 CHECK((*env)->GetArrayLength(env, val) == 33);
12061 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12062 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
12065 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12066 LDKUnsignedChannelAnnouncement this_ptr_conv;
12067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12068 this_ptr_conv.is_owned = false;
12069 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12070 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
12074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12075 LDKUnsignedChannelAnnouncement this_ptr_conv;
12076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12077 this_ptr_conv.is_owned = false;
12078 LDKPublicKey val_ref;
12079 CHECK((*env)->GetArrayLength(env, val) == 33);
12080 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12081 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
12084 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12085 LDKUnsignedChannelAnnouncement this_ptr_conv;
12086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12087 this_ptr_conv.is_owned = false;
12088 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12089 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
12093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12094 LDKUnsignedChannelAnnouncement this_ptr_conv;
12095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12096 this_ptr_conv.is_owned = false;
12097 LDKPublicKey val_ref;
12098 CHECK((*env)->GetArrayLength(env, val) == 33);
12099 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12100 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
12103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12104 LDKChannelAnnouncement this_ptr_conv;
12105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12107 ChannelAnnouncement_free(this_ptr_conv);
12110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12111 LDKChannelAnnouncement orig_conv;
12112 orig_conv.inner = (void*)(orig & (~1));
12113 orig_conv.is_owned = false;
12114 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
12115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12117 long ret_ref = (long)ret_var.inner;
12118 if (ret_var.is_owned) {
12124 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12125 LDKChannelAnnouncement this_ptr_conv;
12126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12127 this_ptr_conv.is_owned = false;
12128 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12129 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
12133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12134 LDKChannelAnnouncement this_ptr_conv;
12135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12136 this_ptr_conv.is_owned = false;
12137 LDKSignature val_ref;
12138 CHECK((*env)->GetArrayLength(env, val) == 64);
12139 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12140 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
12143 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12144 LDKChannelAnnouncement this_ptr_conv;
12145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12146 this_ptr_conv.is_owned = false;
12147 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12148 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
12152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12153 LDKChannelAnnouncement this_ptr_conv;
12154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12155 this_ptr_conv.is_owned = false;
12156 LDKSignature val_ref;
12157 CHECK((*env)->GetArrayLength(env, val) == 64);
12158 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12159 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
12162 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12163 LDKChannelAnnouncement this_ptr_conv;
12164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12165 this_ptr_conv.is_owned = false;
12166 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12167 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
12171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12172 LDKChannelAnnouncement this_ptr_conv;
12173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12174 this_ptr_conv.is_owned = false;
12175 LDKSignature val_ref;
12176 CHECK((*env)->GetArrayLength(env, val) == 64);
12177 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12178 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
12181 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12182 LDKChannelAnnouncement this_ptr_conv;
12183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12184 this_ptr_conv.is_owned = false;
12185 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12186 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
12190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12191 LDKChannelAnnouncement this_ptr_conv;
12192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12193 this_ptr_conv.is_owned = false;
12194 LDKSignature val_ref;
12195 CHECK((*env)->GetArrayLength(env, val) == 64);
12196 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12197 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
12200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12201 LDKChannelAnnouncement this_ptr_conv;
12202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12203 this_ptr_conv.is_owned = false;
12204 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
12205 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12206 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12207 long ret_ref = (long)ret_var.inner;
12208 if (ret_var.is_owned) {
12214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12215 LDKChannelAnnouncement this_ptr_conv;
12216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12217 this_ptr_conv.is_owned = false;
12218 LDKUnsignedChannelAnnouncement val_conv;
12219 val_conv.inner = (void*)(val & (~1));
12220 val_conv.is_owned = (val & 1) || (val == 0);
12221 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
12222 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
12225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray node_signature_1_arg, int8_tArray node_signature_2_arg, int8_tArray bitcoin_signature_1_arg, int8_tArray bitcoin_signature_2_arg, int64_t contents_arg) {
12226 LDKSignature node_signature_1_arg_ref;
12227 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
12228 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
12229 LDKSignature node_signature_2_arg_ref;
12230 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
12231 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
12232 LDKSignature bitcoin_signature_1_arg_ref;
12233 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
12234 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
12235 LDKSignature bitcoin_signature_2_arg_ref;
12236 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
12237 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
12238 LDKUnsignedChannelAnnouncement contents_arg_conv;
12239 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12240 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12241 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
12242 LDKChannelAnnouncement ret_var = ChannelAnnouncement_new(node_signature_1_arg_ref, node_signature_2_arg_ref, bitcoin_signature_1_arg_ref, bitcoin_signature_2_arg_ref, contents_arg_conv);
12243 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12244 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12245 long ret_ref = (long)ret_var.inner;
12246 if (ret_var.is_owned) {
12252 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12253 LDKUnsignedChannelUpdate this_ptr_conv;
12254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12256 UnsignedChannelUpdate_free(this_ptr_conv);
12259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12260 LDKUnsignedChannelUpdate orig_conv;
12261 orig_conv.inner = (void*)(orig & (~1));
12262 orig_conv.is_owned = false;
12263 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
12264 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12265 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12266 long ret_ref = (long)ret_var.inner;
12267 if (ret_var.is_owned) {
12273 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12274 LDKUnsignedChannelUpdate this_ptr_conv;
12275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12276 this_ptr_conv.is_owned = false;
12277 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12278 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
12282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12283 LDKUnsignedChannelUpdate this_ptr_conv;
12284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12285 this_ptr_conv.is_owned = false;
12286 LDKThirtyTwoBytes val_ref;
12287 CHECK((*env)->GetArrayLength(env, val) == 32);
12288 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12289 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
12292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12293 LDKUnsignedChannelUpdate this_ptr_conv;
12294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12295 this_ptr_conv.is_owned = false;
12296 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
12300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12301 LDKUnsignedChannelUpdate this_ptr_conv;
12302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12303 this_ptr_conv.is_owned = false;
12304 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
12307 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12308 LDKUnsignedChannelUpdate this_ptr_conv;
12309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12310 this_ptr_conv.is_owned = false;
12311 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
12315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12316 LDKUnsignedChannelUpdate this_ptr_conv;
12317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12318 this_ptr_conv.is_owned = false;
12319 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
12322 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
12323 LDKUnsignedChannelUpdate this_ptr_conv;
12324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12325 this_ptr_conv.is_owned = false;
12326 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
12330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
12331 LDKUnsignedChannelUpdate this_ptr_conv;
12332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12333 this_ptr_conv.is_owned = false;
12334 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
12337 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
12338 LDKUnsignedChannelUpdate this_ptr_conv;
12339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12340 this_ptr_conv.is_owned = false;
12341 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
12345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12346 LDKUnsignedChannelUpdate this_ptr_conv;
12347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12348 this_ptr_conv.is_owned = false;
12349 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
12352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12353 LDKUnsignedChannelUpdate this_ptr_conv;
12354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12355 this_ptr_conv.is_owned = false;
12356 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
12360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12361 LDKUnsignedChannelUpdate this_ptr_conv;
12362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12363 this_ptr_conv.is_owned = false;
12364 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
12367 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12368 LDKUnsignedChannelUpdate this_ptr_conv;
12369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12370 this_ptr_conv.is_owned = false;
12371 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
12375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12376 LDKUnsignedChannelUpdate this_ptr_conv;
12377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12378 this_ptr_conv.is_owned = false;
12379 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
12382 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
12383 LDKUnsignedChannelUpdate this_ptr_conv;
12384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12385 this_ptr_conv.is_owned = false;
12386 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
12390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12391 LDKUnsignedChannelUpdate this_ptr_conv;
12392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12393 this_ptr_conv.is_owned = false;
12394 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
12397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12398 LDKChannelUpdate this_ptr_conv;
12399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12401 ChannelUpdate_free(this_ptr_conv);
12404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12405 LDKChannelUpdate orig_conv;
12406 orig_conv.inner = (void*)(orig & (~1));
12407 orig_conv.is_owned = false;
12408 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
12409 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12410 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12411 long ret_ref = (long)ret_var.inner;
12412 if (ret_var.is_owned) {
12418 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
12419 LDKChannelUpdate this_ptr_conv;
12420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12421 this_ptr_conv.is_owned = false;
12422 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12423 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
12427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12428 LDKChannelUpdate this_ptr_conv;
12429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12430 this_ptr_conv.is_owned = false;
12431 LDKSignature val_ref;
12432 CHECK((*env)->GetArrayLength(env, val) == 64);
12433 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12434 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
12437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12438 LDKChannelUpdate this_ptr_conv;
12439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12440 this_ptr_conv.is_owned = false;
12441 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
12442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12444 long ret_ref = (long)ret_var.inner;
12445 if (ret_var.is_owned) {
12451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12452 LDKChannelUpdate this_ptr_conv;
12453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12454 this_ptr_conv.is_owned = false;
12455 LDKUnsignedChannelUpdate val_conv;
12456 val_conv.inner = (void*)(val & (~1));
12457 val_conv.is_owned = (val & 1) || (val == 0);
12458 val_conv = UnsignedChannelUpdate_clone(&val_conv);
12459 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
12462 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
12463 LDKSignature signature_arg_ref;
12464 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
12465 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12466 LDKUnsignedChannelUpdate contents_arg_conv;
12467 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12468 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12469 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
12470 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
12471 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12472 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12473 long ret_ref = (long)ret_var.inner;
12474 if (ret_var.is_owned) {
12480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12481 LDKQueryChannelRange this_ptr_conv;
12482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12484 QueryChannelRange_free(this_ptr_conv);
12487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12488 LDKQueryChannelRange orig_conv;
12489 orig_conv.inner = (void*)(orig & (~1));
12490 orig_conv.is_owned = false;
12491 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
12492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12494 long ret_ref = (long)ret_var.inner;
12495 if (ret_var.is_owned) {
12501 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12502 LDKQueryChannelRange this_ptr_conv;
12503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12504 this_ptr_conv.is_owned = false;
12505 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12506 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
12510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12511 LDKQueryChannelRange this_ptr_conv;
12512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12513 this_ptr_conv.is_owned = false;
12514 LDKThirtyTwoBytes val_ref;
12515 CHECK((*env)->GetArrayLength(env, val) == 32);
12516 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12517 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12520 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12521 LDKQueryChannelRange this_ptr_conv;
12522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12523 this_ptr_conv.is_owned = false;
12524 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
12528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12529 LDKQueryChannelRange this_ptr_conv;
12530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12531 this_ptr_conv.is_owned = false;
12532 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
12535 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12536 LDKQueryChannelRange this_ptr_conv;
12537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12538 this_ptr_conv.is_owned = false;
12539 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
12543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12544 LDKQueryChannelRange this_ptr_conv;
12545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12546 this_ptr_conv.is_owned = false;
12547 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12550 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg) {
12551 LDKThirtyTwoBytes chain_hash_arg_ref;
12552 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12553 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12554 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
12555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12557 long ret_ref = (long)ret_var.inner;
12558 if (ret_var.is_owned) {
12564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12565 LDKReplyChannelRange this_ptr_conv;
12566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12568 ReplyChannelRange_free(this_ptr_conv);
12571 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12572 LDKReplyChannelRange orig_conv;
12573 orig_conv.inner = (void*)(orig & (~1));
12574 orig_conv.is_owned = false;
12575 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
12576 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12577 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12578 long ret_ref = (long)ret_var.inner;
12579 if (ret_var.is_owned) {
12585 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12586 LDKReplyChannelRange this_ptr_conv;
12587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12588 this_ptr_conv.is_owned = false;
12589 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12590 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
12594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12595 LDKReplyChannelRange this_ptr_conv;
12596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12597 this_ptr_conv.is_owned = false;
12598 LDKThirtyTwoBytes val_ref;
12599 CHECK((*env)->GetArrayLength(env, val) == 32);
12600 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12601 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12604 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12605 LDKReplyChannelRange this_ptr_conv;
12606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12607 this_ptr_conv.is_owned = false;
12608 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
12612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12613 LDKReplyChannelRange this_ptr_conv;
12614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12615 this_ptr_conv.is_owned = false;
12616 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
12619 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12620 LDKReplyChannelRange this_ptr_conv;
12621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12622 this_ptr_conv.is_owned = false;
12623 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
12627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12628 LDKReplyChannelRange this_ptr_conv;
12629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12630 this_ptr_conv.is_owned = false;
12631 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12635 LDKReplyChannelRange this_ptr_conv;
12636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12637 this_ptr_conv.is_owned = false;
12638 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
12642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12643 LDKReplyChannelRange this_ptr_conv;
12644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12645 this_ptr_conv.is_owned = false;
12646 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
12649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12650 LDKReplyChannelRange this_ptr_conv;
12651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12652 this_ptr_conv.is_owned = false;
12653 LDKCVec_u64Z val_constr;
12654 val_constr.datalen = (*env)->GetArrayLength(env, val);
12655 if (val_constr.datalen > 0)
12656 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12658 val_constr.data = NULL;
12659 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12660 for (size_t g = 0; g < val_constr.datalen; g++) {
12661 int64_t arr_conv_6 = val_vals[g];
12662 val_constr.data[g] = arr_conv_6;
12664 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12665 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
12668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean full_information_arg, int64_tArray short_channel_ids_arg) {
12669 LDKThirtyTwoBytes chain_hash_arg_ref;
12670 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12671 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12672 LDKCVec_u64Z short_channel_ids_arg_constr;
12673 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12674 if (short_channel_ids_arg_constr.datalen > 0)
12675 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12677 short_channel_ids_arg_constr.data = NULL;
12678 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12679 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12680 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12681 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12683 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12684 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
12685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12687 long ret_ref = (long)ret_var.inner;
12688 if (ret_var.is_owned) {
12694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12695 LDKQueryShortChannelIds this_ptr_conv;
12696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12698 QueryShortChannelIds_free(this_ptr_conv);
12701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12702 LDKQueryShortChannelIds orig_conv;
12703 orig_conv.inner = (void*)(orig & (~1));
12704 orig_conv.is_owned = false;
12705 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
12706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12708 long ret_ref = (long)ret_var.inner;
12709 if (ret_var.is_owned) {
12715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12716 LDKQueryShortChannelIds this_ptr_conv;
12717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12718 this_ptr_conv.is_owned = false;
12719 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12720 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
12724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12725 LDKQueryShortChannelIds this_ptr_conv;
12726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12727 this_ptr_conv.is_owned = false;
12728 LDKThirtyTwoBytes val_ref;
12729 CHECK((*env)->GetArrayLength(env, val) == 32);
12730 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12731 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
12734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12735 LDKQueryShortChannelIds this_ptr_conv;
12736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12737 this_ptr_conv.is_owned = false;
12738 LDKCVec_u64Z val_constr;
12739 val_constr.datalen = (*env)->GetArrayLength(env, val);
12740 if (val_constr.datalen > 0)
12741 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12743 val_constr.data = NULL;
12744 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12745 for (size_t g = 0; g < val_constr.datalen; g++) {
12746 int64_t arr_conv_6 = val_vals[g];
12747 val_constr.data[g] = arr_conv_6;
12749 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12750 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
12753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int64_tArray short_channel_ids_arg) {
12754 LDKThirtyTwoBytes chain_hash_arg_ref;
12755 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12756 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12757 LDKCVec_u64Z short_channel_ids_arg_constr;
12758 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12759 if (short_channel_ids_arg_constr.datalen > 0)
12760 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12762 short_channel_ids_arg_constr.data = NULL;
12763 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12764 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12765 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12766 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12768 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12769 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
12770 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12771 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12772 long ret_ref = (long)ret_var.inner;
12773 if (ret_var.is_owned) {
12779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12780 LDKReplyShortChannelIdsEnd this_ptr_conv;
12781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12783 ReplyShortChannelIdsEnd_free(this_ptr_conv);
12786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12787 LDKReplyShortChannelIdsEnd orig_conv;
12788 orig_conv.inner = (void*)(orig & (~1));
12789 orig_conv.is_owned = false;
12790 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
12791 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12792 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12793 long ret_ref = (long)ret_var.inner;
12794 if (ret_var.is_owned) {
12800 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12801 LDKReplyShortChannelIdsEnd this_ptr_conv;
12802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12803 this_ptr_conv.is_owned = false;
12804 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12805 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
12809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12810 LDKReplyShortChannelIdsEnd this_ptr_conv;
12811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12812 this_ptr_conv.is_owned = false;
12813 LDKThirtyTwoBytes val_ref;
12814 CHECK((*env)->GetArrayLength(env, val) == 32);
12815 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12816 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
12819 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12820 LDKReplyShortChannelIdsEnd this_ptr_conv;
12821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12822 this_ptr_conv.is_owned = false;
12823 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
12827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12828 LDKReplyShortChannelIdsEnd this_ptr_conv;
12829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12830 this_ptr_conv.is_owned = false;
12831 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
12834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
12835 LDKThirtyTwoBytes chain_hash_arg_ref;
12836 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12837 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12838 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
12839 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12840 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12841 long ret_ref = (long)ret_var.inner;
12842 if (ret_var.is_owned) {
12848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12849 LDKGossipTimestampFilter this_ptr_conv;
12850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12852 GossipTimestampFilter_free(this_ptr_conv);
12855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12856 LDKGossipTimestampFilter orig_conv;
12857 orig_conv.inner = (void*)(orig & (~1));
12858 orig_conv.is_owned = false;
12859 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
12860 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12861 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12862 long ret_ref = (long)ret_var.inner;
12863 if (ret_var.is_owned) {
12869 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12870 LDKGossipTimestampFilter this_ptr_conv;
12871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12872 this_ptr_conv.is_owned = false;
12873 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12874 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
12878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12879 LDKGossipTimestampFilter this_ptr_conv;
12880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12881 this_ptr_conv.is_owned = false;
12882 LDKThirtyTwoBytes val_ref;
12883 CHECK((*env)->GetArrayLength(env, val) == 32);
12884 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12885 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
12888 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12889 LDKGossipTimestampFilter this_ptr_conv;
12890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12891 this_ptr_conv.is_owned = false;
12892 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
12896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12897 LDKGossipTimestampFilter this_ptr_conv;
12898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12899 this_ptr_conv.is_owned = false;
12900 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
12903 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
12904 LDKGossipTimestampFilter this_ptr_conv;
12905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12906 this_ptr_conv.is_owned = false;
12907 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
12911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12912 LDKGossipTimestampFilter this_ptr_conv;
12913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12914 this_ptr_conv.is_owned = false;
12915 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
12918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_timestamp_arg, int32_t timestamp_range_arg) {
12919 LDKThirtyTwoBytes chain_hash_arg_ref;
12920 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12921 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12922 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
12923 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12924 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12925 long ret_ref = (long)ret_var.inner;
12926 if (ret_var.is_owned) {
12932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12933 if ((this_ptr & 1) != 0) return;
12934 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
12935 FREE((void*)this_ptr);
12936 ErrorAction_free(this_ptr_conv);
12939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12940 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
12941 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12942 *ret_copy = ErrorAction_clone(orig_conv);
12943 long ret_ref = (long)ret_copy;
12947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12948 LDKLightningError this_ptr_conv;
12949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12950 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12951 LightningError_free(this_ptr_conv);
12954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12955 LDKLightningError orig_conv;
12956 orig_conv.inner = (void*)(orig & (~1));
12957 orig_conv.is_owned = false;
12958 LDKLightningError ret_var = LightningError_clone(&orig_conv);
12959 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12960 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12961 long ret_ref = (long)ret_var.inner;
12962 if (ret_var.is_owned) {
12968 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
12969 LDKLightningError this_ptr_conv;
12970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12971 this_ptr_conv.is_owned = false;
12972 LDKStr _str = LightningError_get_err(&this_ptr_conv);
12973 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
12977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12978 LDKLightningError this_ptr_conv;
12979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12980 this_ptr_conv.is_owned = false;
12981 LDKCVec_u8Z val_ref;
12982 val_ref.datalen = (*env)->GetArrayLength(env, val);
12983 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12984 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12985 LightningError_set_err(&this_ptr_conv, val_ref);
12988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
12989 LDKLightningError this_ptr_conv;
12990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12991 this_ptr_conv.is_owned = false;
12992 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12993 *ret_copy = LightningError_get_action(&this_ptr_conv);
12994 long ret_ref = (long)ret_copy;
12998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12999 LDKLightningError this_ptr_conv;
13000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13001 this_ptr_conv.is_owned = false;
13002 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
13004 LightningError_set_action(&this_ptr_conv, val_conv);
13007 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
13008 LDKCVec_u8Z err_arg_ref;
13009 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
13010 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
13011 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
13012 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
13013 FREE((void*)action_arg);
13014 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
13015 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13016 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13017 long ret_ref = (long)ret_var.inner;
13018 if (ret_var.is_owned) {
13024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13025 LDKCommitmentUpdate this_ptr_conv;
13026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13028 CommitmentUpdate_free(this_ptr_conv);
13031 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13032 LDKCommitmentUpdate orig_conv;
13033 orig_conv.inner = (void*)(orig & (~1));
13034 orig_conv.is_owned = false;
13035 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
13036 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13037 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13038 long ret_ref = (long)ret_var.inner;
13039 if (ret_var.is_owned) {
13045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13046 LDKCommitmentUpdate this_ptr_conv;
13047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13048 this_ptr_conv.is_owned = false;
13049 LDKCVec_UpdateAddHTLCZ val_constr;
13050 val_constr.datalen = (*env)->GetArrayLength(env, val);
13051 if (val_constr.datalen > 0)
13052 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13054 val_constr.data = NULL;
13055 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13056 for (size_t p = 0; p < val_constr.datalen; p++) {
13057 int64_t arr_conv_15 = val_vals[p];
13058 LDKUpdateAddHTLC arr_conv_15_conv;
13059 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13060 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13061 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13062 val_constr.data[p] = arr_conv_15_conv;
13064 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13065 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
13068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13069 LDKCommitmentUpdate this_ptr_conv;
13070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13071 this_ptr_conv.is_owned = false;
13072 LDKCVec_UpdateFulfillHTLCZ val_constr;
13073 val_constr.datalen = (*env)->GetArrayLength(env, val);
13074 if (val_constr.datalen > 0)
13075 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13077 val_constr.data = NULL;
13078 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13079 for (size_t t = 0; t < val_constr.datalen; t++) {
13080 int64_t arr_conv_19 = val_vals[t];
13081 LDKUpdateFulfillHTLC arr_conv_19_conv;
13082 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13083 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13084 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13085 val_constr.data[t] = arr_conv_19_conv;
13087 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13088 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
13091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13092 LDKCommitmentUpdate this_ptr_conv;
13093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13094 this_ptr_conv.is_owned = false;
13095 LDKCVec_UpdateFailHTLCZ val_constr;
13096 val_constr.datalen = (*env)->GetArrayLength(env, val);
13097 if (val_constr.datalen > 0)
13098 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13100 val_constr.data = NULL;
13101 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13102 for (size_t q = 0; q < val_constr.datalen; q++) {
13103 int64_t arr_conv_16 = val_vals[q];
13104 LDKUpdateFailHTLC arr_conv_16_conv;
13105 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13106 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13107 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13108 val_constr.data[q] = arr_conv_16_conv;
13110 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13111 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
13114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13115 LDKCommitmentUpdate this_ptr_conv;
13116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13117 this_ptr_conv.is_owned = false;
13118 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
13119 val_constr.datalen = (*env)->GetArrayLength(env, val);
13120 if (val_constr.datalen > 0)
13121 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13123 val_constr.data = NULL;
13124 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13125 for (size_t z = 0; z < val_constr.datalen; z++) {
13126 int64_t arr_conv_25 = val_vals[z];
13127 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13128 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13129 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13130 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13131 val_constr.data[z] = arr_conv_25_conv;
13133 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13134 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
13137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
13138 LDKCommitmentUpdate this_ptr_conv;
13139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13140 this_ptr_conv.is_owned = false;
13141 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
13142 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13143 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13144 long ret_ref = (long)ret_var.inner;
13145 if (ret_var.is_owned) {
13151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13152 LDKCommitmentUpdate this_ptr_conv;
13153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13154 this_ptr_conv.is_owned = false;
13155 LDKUpdateFee val_conv;
13156 val_conv.inner = (void*)(val & (~1));
13157 val_conv.is_owned = (val & 1) || (val == 0);
13158 val_conv = UpdateFee_clone(&val_conv);
13159 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
13162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
13163 LDKCommitmentUpdate this_ptr_conv;
13164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13165 this_ptr_conv.is_owned = false;
13166 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
13167 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13168 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13169 long ret_ref = (long)ret_var.inner;
13170 if (ret_var.is_owned) {
13176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13177 LDKCommitmentUpdate this_ptr_conv;
13178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13179 this_ptr_conv.is_owned = false;
13180 LDKCommitmentSigned val_conv;
13181 val_conv.inner = (void*)(val & (~1));
13182 val_conv.is_owned = (val & 1) || (val == 0);
13183 val_conv = CommitmentSigned_clone(&val_conv);
13184 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
13187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv *env, jclass clz, int64_tArray update_add_htlcs_arg, int64_tArray update_fulfill_htlcs_arg, int64_tArray update_fail_htlcs_arg, int64_tArray update_fail_malformed_htlcs_arg, int64_t update_fee_arg, int64_t commitment_signed_arg) {
13188 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
13189 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
13190 if (update_add_htlcs_arg_constr.datalen > 0)
13191 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13193 update_add_htlcs_arg_constr.data = NULL;
13194 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
13195 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
13196 int64_t arr_conv_15 = update_add_htlcs_arg_vals[p];
13197 LDKUpdateAddHTLC arr_conv_15_conv;
13198 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13199 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13200 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13201 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
13203 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
13204 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
13205 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
13206 if (update_fulfill_htlcs_arg_constr.datalen > 0)
13207 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13209 update_fulfill_htlcs_arg_constr.data = NULL;
13210 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
13211 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
13212 int64_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
13213 LDKUpdateFulfillHTLC arr_conv_19_conv;
13214 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13215 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13216 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13217 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
13219 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
13220 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
13221 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
13222 if (update_fail_htlcs_arg_constr.datalen > 0)
13223 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13225 update_fail_htlcs_arg_constr.data = NULL;
13226 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
13227 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
13228 int64_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
13229 LDKUpdateFailHTLC arr_conv_16_conv;
13230 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13231 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13232 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13233 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
13235 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
13236 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
13237 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
13238 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
13239 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13241 update_fail_malformed_htlcs_arg_constr.data = NULL;
13242 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
13243 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
13244 int64_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
13245 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13246 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13247 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13248 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13249 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
13251 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
13252 LDKUpdateFee update_fee_arg_conv;
13253 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
13254 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
13255 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
13256 LDKCommitmentSigned commitment_signed_arg_conv;
13257 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
13258 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
13259 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
13260 LDKCommitmentUpdate ret_var = CommitmentUpdate_new(update_add_htlcs_arg_constr, update_fulfill_htlcs_arg_constr, update_fail_htlcs_arg_constr, update_fail_malformed_htlcs_arg_constr, update_fee_arg_conv, commitment_signed_arg_conv);
13261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13263 long ret_ref = (long)ret_var.inner;
13264 if (ret_var.is_owned) {
13270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13271 if ((this_ptr & 1) != 0) return;
13272 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
13273 FREE((void*)this_ptr);
13274 HTLCFailChannelUpdate_free(this_ptr_conv);
13277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13278 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
13279 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
13280 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
13281 long ret_ref = (long)ret_copy;
13285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13286 if ((this_ptr & 1) != 0) return;
13287 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
13288 FREE((void*)this_ptr);
13289 ChannelMessageHandler_free(this_ptr_conv);
13292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13293 if ((this_ptr & 1) != 0) return;
13294 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
13295 FREE((void*)this_ptr);
13296 RoutingMessageHandler_free(this_ptr_conv);
13299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13300 LDKAcceptChannel obj_conv;
13301 obj_conv.inner = (void*)(obj & (~1));
13302 obj_conv.is_owned = false;
13303 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
13304 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13305 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13306 CVec_u8Z_free(arg_var);
13310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13311 LDKu8slice ser_ref;
13312 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13313 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13314 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
13315 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13316 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13317 long ret_ref = (long)ret_var.inner;
13318 if (ret_var.is_owned) {
13321 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13325 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
13326 LDKAnnouncementSignatures obj_conv;
13327 obj_conv.inner = (void*)(obj & (~1));
13328 obj_conv.is_owned = false;
13329 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
13330 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13331 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13332 CVec_u8Z_free(arg_var);
13336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13337 LDKu8slice ser_ref;
13338 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13339 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13340 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
13341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13343 long ret_ref = (long)ret_var.inner;
13344 if (ret_var.is_owned) {
13347 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13351 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
13352 LDKChannelReestablish obj_conv;
13353 obj_conv.inner = (void*)(obj & (~1));
13354 obj_conv.is_owned = false;
13355 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
13356 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13357 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13358 CVec_u8Z_free(arg_var);
13362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13363 LDKu8slice ser_ref;
13364 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13365 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13366 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13367 *ret_conv = ChannelReestablish_read(ser_ref);
13368 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13369 return (long)ret_conv;
13372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13373 LDKClosingSigned obj_conv;
13374 obj_conv.inner = (void*)(obj & (~1));
13375 obj_conv.is_owned = false;
13376 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
13377 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13378 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13379 CVec_u8Z_free(arg_var);
13383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13384 LDKu8slice ser_ref;
13385 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13386 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13387 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
13388 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13389 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13390 long ret_ref = (long)ret_var.inner;
13391 if (ret_var.is_owned) {
13394 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13399 LDKCommitmentSigned obj_conv;
13400 obj_conv.inner = (void*)(obj & (~1));
13401 obj_conv.is_owned = false;
13402 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
13403 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13404 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13405 CVec_u8Z_free(arg_var);
13409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13410 LDKu8slice ser_ref;
13411 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13412 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13413 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
13414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13416 long ret_ref = (long)ret_var.inner;
13417 if (ret_var.is_owned) {
13420 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13424 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
13425 LDKFundingCreated obj_conv;
13426 obj_conv.inner = (void*)(obj & (~1));
13427 obj_conv.is_owned = false;
13428 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
13429 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13430 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13431 CVec_u8Z_free(arg_var);
13435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13436 LDKu8slice ser_ref;
13437 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13438 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13439 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
13440 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13441 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13442 long ret_ref = (long)ret_var.inner;
13443 if (ret_var.is_owned) {
13446 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13451 LDKFundingSigned obj_conv;
13452 obj_conv.inner = (void*)(obj & (~1));
13453 obj_conv.is_owned = false;
13454 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
13455 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13456 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13457 CVec_u8Z_free(arg_var);
13461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13462 LDKu8slice ser_ref;
13463 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13464 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13465 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
13466 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13467 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13468 long ret_ref = (long)ret_var.inner;
13469 if (ret_var.is_owned) {
13472 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13476 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
13477 LDKFundingLocked obj_conv;
13478 obj_conv.inner = (void*)(obj & (~1));
13479 obj_conv.is_owned = false;
13480 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
13481 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13482 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13483 CVec_u8Z_free(arg_var);
13487 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13488 LDKu8slice ser_ref;
13489 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13490 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13491 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
13492 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13493 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13494 long ret_ref = (long)ret_var.inner;
13495 if (ret_var.is_owned) {
13498 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
13504 obj_conv.inner = (void*)(obj & (~1));
13505 obj_conv.is_owned = false;
13506 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
13507 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13508 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13509 CVec_u8Z_free(arg_var);
13513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13514 LDKu8slice ser_ref;
13515 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13516 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13517 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13518 *ret_conv = Init_read(ser_ref);
13519 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13520 return (long)ret_conv;
13523 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13524 LDKOpenChannel obj_conv;
13525 obj_conv.inner = (void*)(obj & (~1));
13526 obj_conv.is_owned = false;
13527 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
13528 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13529 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13530 CVec_u8Z_free(arg_var);
13534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13535 LDKu8slice ser_ref;
13536 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13537 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13538 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
13539 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13540 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13541 long ret_ref = (long)ret_var.inner;
13542 if (ret_var.is_owned) {
13545 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13549 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
13550 LDKRevokeAndACK obj_conv;
13551 obj_conv.inner = (void*)(obj & (~1));
13552 obj_conv.is_owned = false;
13553 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
13554 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13555 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13556 CVec_u8Z_free(arg_var);
13560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13561 LDKu8slice ser_ref;
13562 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13563 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13564 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
13565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13567 long ret_ref = (long)ret_var.inner;
13568 if (ret_var.is_owned) {
13571 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
13576 LDKShutdown obj_conv;
13577 obj_conv.inner = (void*)(obj & (~1));
13578 obj_conv.is_owned = false;
13579 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
13580 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13581 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13582 CVec_u8Z_free(arg_var);
13586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13587 LDKu8slice ser_ref;
13588 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13589 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13590 LDKShutdown ret_var = Shutdown_read(ser_ref);
13591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13593 long ret_ref = (long)ret_var.inner;
13594 if (ret_var.is_owned) {
13597 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13601 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13602 LDKUpdateFailHTLC obj_conv;
13603 obj_conv.inner = (void*)(obj & (~1));
13604 obj_conv.is_owned = false;
13605 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
13606 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13607 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13608 CVec_u8Z_free(arg_var);
13612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13613 LDKu8slice ser_ref;
13614 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13615 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13616 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
13617 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13618 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13619 long ret_ref = (long)ret_var.inner;
13620 if (ret_var.is_owned) {
13623 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13627 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13628 LDKUpdateFailMalformedHTLC obj_conv;
13629 obj_conv.inner = (void*)(obj & (~1));
13630 obj_conv.is_owned = false;
13631 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
13632 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13633 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13634 CVec_u8Z_free(arg_var);
13638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13639 LDKu8slice ser_ref;
13640 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13641 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13642 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
13643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13645 long ret_ref = (long)ret_var.inner;
13646 if (ret_var.is_owned) {
13649 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13653 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
13654 LDKUpdateFee obj_conv;
13655 obj_conv.inner = (void*)(obj & (~1));
13656 obj_conv.is_owned = false;
13657 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
13658 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13659 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13660 CVec_u8Z_free(arg_var);
13664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13665 LDKu8slice ser_ref;
13666 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13667 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13668 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
13669 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13670 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13671 long ret_ref = (long)ret_var.inner;
13672 if (ret_var.is_owned) {
13675 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13680 LDKUpdateFulfillHTLC obj_conv;
13681 obj_conv.inner = (void*)(obj & (~1));
13682 obj_conv.is_owned = false;
13683 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
13684 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13685 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13686 CVec_u8Z_free(arg_var);
13690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13691 LDKu8slice ser_ref;
13692 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13693 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13694 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
13695 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13696 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13697 long ret_ref = (long)ret_var.inner;
13698 if (ret_var.is_owned) {
13701 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13705 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13706 LDKUpdateAddHTLC obj_conv;
13707 obj_conv.inner = (void*)(obj & (~1));
13708 obj_conv.is_owned = false;
13709 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
13710 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13711 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13712 CVec_u8Z_free(arg_var);
13716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13717 LDKu8slice ser_ref;
13718 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13719 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13720 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
13721 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13722 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13723 long ret_ref = (long)ret_var.inner;
13724 if (ret_var.is_owned) {
13727 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
13733 obj_conv.inner = (void*)(obj & (~1));
13734 obj_conv.is_owned = false;
13735 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
13736 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13737 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13738 CVec_u8Z_free(arg_var);
13742 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13743 LDKu8slice ser_ref;
13744 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13745 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13746 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13747 *ret_conv = Ping_read(ser_ref);
13748 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13749 return (long)ret_conv;
13752 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
13754 obj_conv.inner = (void*)(obj & (~1));
13755 obj_conv.is_owned = false;
13756 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
13757 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13758 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13759 CVec_u8Z_free(arg_var);
13763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13764 LDKu8slice ser_ref;
13765 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13766 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13767 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13768 *ret_conv = Pong_read(ser_ref);
13769 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13770 return (long)ret_conv;
13773 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13774 LDKUnsignedChannelAnnouncement obj_conv;
13775 obj_conv.inner = (void*)(obj & (~1));
13776 obj_conv.is_owned = false;
13777 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
13778 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13779 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13780 CVec_u8Z_free(arg_var);
13784 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13785 LDKu8slice ser_ref;
13786 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13787 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13788 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13789 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
13790 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13791 return (long)ret_conv;
13794 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13795 LDKChannelAnnouncement obj_conv;
13796 obj_conv.inner = (void*)(obj & (~1));
13797 obj_conv.is_owned = false;
13798 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
13799 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13800 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13801 CVec_u8Z_free(arg_var);
13805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13806 LDKu8slice ser_ref;
13807 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13808 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13809 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
13810 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13811 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13812 long ret_ref = (long)ret_var.inner;
13813 if (ret_var.is_owned) {
13816 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13821 LDKUnsignedChannelUpdate obj_conv;
13822 obj_conv.inner = (void*)(obj & (~1));
13823 obj_conv.is_owned = false;
13824 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
13825 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13826 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13827 CVec_u8Z_free(arg_var);
13831 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13832 LDKu8slice ser_ref;
13833 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13834 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13835 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13836 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
13837 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13838 return (long)ret_conv;
13841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13842 LDKChannelUpdate obj_conv;
13843 obj_conv.inner = (void*)(obj & (~1));
13844 obj_conv.is_owned = false;
13845 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
13846 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13847 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13848 CVec_u8Z_free(arg_var);
13852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13853 LDKu8slice ser_ref;
13854 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13855 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13856 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
13857 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13858 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13859 long ret_ref = (long)ret_var.inner;
13860 if (ret_var.is_owned) {
13863 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13867 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
13868 LDKErrorMessage obj_conv;
13869 obj_conv.inner = (void*)(obj & (~1));
13870 obj_conv.is_owned = false;
13871 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
13872 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13873 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13874 CVec_u8Z_free(arg_var);
13878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13879 LDKu8slice ser_ref;
13880 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13881 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13882 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13883 *ret_conv = ErrorMessage_read(ser_ref);
13884 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13885 return (long)ret_conv;
13888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13889 LDKUnsignedNodeAnnouncement obj_conv;
13890 obj_conv.inner = (void*)(obj & (~1));
13891 obj_conv.is_owned = false;
13892 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
13893 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13894 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13895 CVec_u8Z_free(arg_var);
13899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13900 LDKu8slice ser_ref;
13901 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13902 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13903 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13904 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
13905 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13906 return (long)ret_conv;
13909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13910 LDKNodeAnnouncement obj_conv;
13911 obj_conv.inner = (void*)(obj & (~1));
13912 obj_conv.is_owned = false;
13913 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
13914 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13915 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13916 CVec_u8Z_free(arg_var);
13920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13921 LDKu8slice ser_ref;
13922 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13923 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13924 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
13925 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13926 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13927 long ret_ref = (long)ret_var.inner;
13928 if (ret_var.is_owned) {
13931 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13936 LDKu8slice ser_ref;
13937 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13938 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13939 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13940 *ret_conv = QueryShortChannelIds_read(ser_ref);
13941 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13942 return (long)ret_conv;
13945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
13946 LDKQueryShortChannelIds obj_conv;
13947 obj_conv.inner = (void*)(obj & (~1));
13948 obj_conv.is_owned = false;
13949 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
13950 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13951 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13952 CVec_u8Z_free(arg_var);
13956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13957 LDKu8slice ser_ref;
13958 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13959 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13960 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13961 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
13962 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13963 return (long)ret_conv;
13966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
13967 LDKReplyShortChannelIdsEnd obj_conv;
13968 obj_conv.inner = (void*)(obj & (~1));
13969 obj_conv.is_owned = false;
13970 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
13971 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13972 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13973 CVec_u8Z_free(arg_var);
13977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13978 LDKu8slice ser_ref;
13979 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13980 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13981 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13982 *ret_conv = QueryChannelRange_read(ser_ref);
13983 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13984 return (long)ret_conv;
13987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
13988 LDKQueryChannelRange obj_conv;
13989 obj_conv.inner = (void*)(obj & (~1));
13990 obj_conv.is_owned = false;
13991 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
13992 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13993 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13994 CVec_u8Z_free(arg_var);
13998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13999 LDKu8slice ser_ref;
14000 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14001 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14002 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
14003 *ret_conv = ReplyChannelRange_read(ser_ref);
14004 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14005 return (long)ret_conv;
14008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
14009 LDKReplyChannelRange obj_conv;
14010 obj_conv.inner = (void*)(obj & (~1));
14011 obj_conv.is_owned = false;
14012 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
14013 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14014 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14015 CVec_u8Z_free(arg_var);
14019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14020 LDKu8slice ser_ref;
14021 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14022 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14023 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14024 *ret_conv = GossipTimestampFilter_read(ser_ref);
14025 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14026 return (long)ret_conv;
14029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
14030 LDKGossipTimestampFilter obj_conv;
14031 obj_conv.inner = (void*)(obj & (~1));
14032 obj_conv.is_owned = false;
14033 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
14034 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14035 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14036 CVec_u8Z_free(arg_var);
14040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14041 LDKMessageHandler this_ptr_conv;
14042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14044 MessageHandler_free(this_ptr_conv);
14047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
14048 LDKMessageHandler this_ptr_conv;
14049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14050 this_ptr_conv.is_owned = false;
14051 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
14055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14056 LDKMessageHandler this_ptr_conv;
14057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14058 this_ptr_conv.is_owned = false;
14059 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
14060 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
14061 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14062 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
14064 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
14067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
14068 LDKMessageHandler this_ptr_conv;
14069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14070 this_ptr_conv.is_owned = false;
14071 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
14075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14076 LDKMessageHandler this_ptr_conv;
14077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14078 this_ptr_conv.is_owned = false;
14079 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
14080 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
14081 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14082 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
14084 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
14087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv *env, jclass clz, int64_t chan_handler_arg, int64_t route_handler_arg) {
14088 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
14089 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
14090 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14091 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
14093 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
14094 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
14095 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14096 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
14098 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
14099 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14100 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14101 long ret_ref = (long)ret_var.inner;
14102 if (ret_var.is_owned) {
14108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14109 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
14110 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14111 *ret = SocketDescriptor_clone(orig_conv);
14115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14116 if ((this_ptr & 1) != 0) return;
14117 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
14118 FREE((void*)this_ptr);
14119 SocketDescriptor_free(this_ptr_conv);
14122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14123 LDKPeerHandleError this_ptr_conv;
14124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14126 PeerHandleError_free(this_ptr_conv);
14129 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14130 LDKPeerHandleError orig_conv;
14131 orig_conv.inner = (void*)(orig & (~1));
14132 orig_conv.is_owned = false;
14133 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
14134 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14135 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14136 long ret_ref = (long)ret_var.inner;
14137 if (ret_var.is_owned) {
14143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
14144 LDKPeerHandleError this_ptr_conv;
14145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14146 this_ptr_conv.is_owned = false;
14147 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
14151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14152 LDKPeerHandleError this_ptr_conv;
14153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14154 this_ptr_conv.is_owned = false;
14155 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
14158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
14159 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
14160 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14161 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14162 long ret_ref = (long)ret_var.inner;
14163 if (ret_var.is_owned) {
14169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14170 LDKPeerManager this_ptr_conv;
14171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14172 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14173 PeerManager_free(this_ptr_conv);
14176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger) {
14177 LDKMessageHandler message_handler_conv;
14178 message_handler_conv.inner = (void*)(message_handler & (~1));
14179 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
14180 // Warning: we need a move here but no clone is available for LDKMessageHandler
14181 LDKSecretKey our_node_secret_ref;
14182 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
14183 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
14184 unsigned char ephemeral_random_data_arr[32];
14185 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
14186 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
14187 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
14188 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14189 if (logger_conv.free == LDKLogger_JCalls_free) {
14190 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14191 LDKLogger_JCalls_clone(logger_conv.this_arg);
14193 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
14194 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14195 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14196 long ret_ref = (long)ret_var.inner;
14197 if (ret_var.is_owned) {
14203 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
14204 LDKPeerManager this_arg_conv;
14205 this_arg_conv.inner = (void*)(this_arg & (~1));
14206 this_arg_conv.is_owned = false;
14207 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
14208 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14210 for (size_t i = 0; i < ret_var.datalen; i++) {
14211 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 33);
14212 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
14213 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
14215 FREE(ret_var.data);
14219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t descriptor) {
14220 LDKPeerManager this_arg_conv;
14221 this_arg_conv.inner = (void*)(this_arg & (~1));
14222 this_arg_conv.is_owned = false;
14223 LDKPublicKey their_node_id_ref;
14224 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14225 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14226 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
14227 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14228 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14229 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14231 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
14232 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
14233 return (long)ret_conv;
14236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14237 LDKPeerManager this_arg_conv;
14238 this_arg_conv.inner = (void*)(this_arg & (~1));
14239 this_arg_conv.is_owned = false;
14240 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
14241 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14242 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14243 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14245 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14246 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
14247 return (long)ret_conv;
14250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14251 LDKPeerManager this_arg_conv;
14252 this_arg_conv.inner = (void*)(this_arg & (~1));
14253 this_arg_conv.is_owned = false;
14254 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14255 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14256 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
14257 return (long)ret_conv;
14260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t peer_descriptor, int8_tArray data) {
14261 LDKPeerManager this_arg_conv;
14262 this_arg_conv.inner = (void*)(this_arg & (~1));
14263 this_arg_conv.is_owned = false;
14264 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
14265 LDKu8slice data_ref;
14266 data_ref.datalen = (*env)->GetArrayLength(env, data);
14267 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
14268 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14269 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
14270 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
14271 return (long)ret_conv;
14274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14275 LDKPeerManager this_arg_conv;
14276 this_arg_conv.inner = (void*)(this_arg & (~1));
14277 this_arg_conv.is_owned = false;
14278 PeerManager_process_events(&this_arg_conv);
14281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14282 LDKPeerManager this_arg_conv;
14283 this_arg_conv.inner = (void*)(this_arg & (~1));
14284 this_arg_conv.is_owned = false;
14285 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14286 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
14289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv *env, jclass clz, int64_t this_arg) {
14290 LDKPeerManager this_arg_conv;
14291 this_arg_conv.inner = (void*)(this_arg & (~1));
14292 this_arg_conv.is_owned = false;
14293 PeerManager_timer_tick_occured(&this_arg_conv);
14296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
14297 unsigned char commitment_seed_arr[32];
14298 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14299 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
14300 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
14301 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
14302 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
14306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
14307 LDKPublicKey per_commitment_point_ref;
14308 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14309 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14310 unsigned char base_secret_arr[32];
14311 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
14312 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
14313 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
14314 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14315 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
14316 return (long)ret_conv;
14319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_point) {
14320 LDKPublicKey per_commitment_point_ref;
14321 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14322 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14323 LDKPublicKey base_point_ref;
14324 CHECK((*env)->GetArrayLength(env, base_point) == 33);
14325 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
14326 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14327 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
14328 return (long)ret_conv;
14331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_secret, int8_tArray countersignatory_revocation_base_secret) {
14332 unsigned char per_commitment_secret_arr[32];
14333 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
14334 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
14335 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
14336 unsigned char countersignatory_revocation_base_secret_arr[32];
14337 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
14338 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
14339 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
14340 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14341 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
14342 return (long)ret_conv;
14345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray countersignatory_revocation_base_point) {
14346 LDKPublicKey per_commitment_point_ref;
14347 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14348 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14349 LDKPublicKey countersignatory_revocation_base_point_ref;
14350 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
14351 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
14352 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14353 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
14354 return (long)ret_conv;
14357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14358 LDKTxCreationKeys this_ptr_conv;
14359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14361 TxCreationKeys_free(this_ptr_conv);
14364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14365 LDKTxCreationKeys orig_conv;
14366 orig_conv.inner = (void*)(orig & (~1));
14367 orig_conv.is_owned = false;
14368 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
14369 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14370 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14371 long ret_ref = (long)ret_var.inner;
14372 if (ret_var.is_owned) {
14378 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14379 LDKTxCreationKeys this_ptr_conv;
14380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14381 this_ptr_conv.is_owned = false;
14382 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14383 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
14387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14388 LDKTxCreationKeys this_ptr_conv;
14389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14390 this_ptr_conv.is_owned = false;
14391 LDKPublicKey val_ref;
14392 CHECK((*env)->GetArrayLength(env, val) == 33);
14393 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14394 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
14397 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14398 LDKTxCreationKeys this_ptr_conv;
14399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14400 this_ptr_conv.is_owned = false;
14401 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14402 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
14406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14407 LDKTxCreationKeys this_ptr_conv;
14408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14409 this_ptr_conv.is_owned = false;
14410 LDKPublicKey val_ref;
14411 CHECK((*env)->GetArrayLength(env, val) == 33);
14412 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14413 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
14416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14417 LDKTxCreationKeys this_ptr_conv;
14418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14419 this_ptr_conv.is_owned = false;
14420 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14421 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
14425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14426 LDKTxCreationKeys this_ptr_conv;
14427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14428 this_ptr_conv.is_owned = false;
14429 LDKPublicKey val_ref;
14430 CHECK((*env)->GetArrayLength(env, val) == 33);
14431 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14432 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
14435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14436 LDKTxCreationKeys this_ptr_conv;
14437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14438 this_ptr_conv.is_owned = false;
14439 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14440 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
14444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14445 LDKTxCreationKeys this_ptr_conv;
14446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14447 this_ptr_conv.is_owned = false;
14448 LDKPublicKey val_ref;
14449 CHECK((*env)->GetArrayLength(env, val) == 33);
14450 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14451 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
14454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14455 LDKTxCreationKeys this_ptr_conv;
14456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14457 this_ptr_conv.is_owned = false;
14458 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14459 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
14463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14464 LDKTxCreationKeys this_ptr_conv;
14465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14466 this_ptr_conv.is_owned = false;
14467 LDKPublicKey val_ref;
14468 CHECK((*env)->GetArrayLength(env, val) == 33);
14469 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14470 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
14473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point_arg, int8_tArray revocation_key_arg, int8_tArray broadcaster_htlc_key_arg, int8_tArray countersignatory_htlc_key_arg, int8_tArray broadcaster_delayed_payment_key_arg) {
14474 LDKPublicKey per_commitment_point_arg_ref;
14475 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14476 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14477 LDKPublicKey revocation_key_arg_ref;
14478 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
14479 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
14480 LDKPublicKey broadcaster_htlc_key_arg_ref;
14481 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
14482 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
14483 LDKPublicKey countersignatory_htlc_key_arg_ref;
14484 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
14485 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
14486 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
14487 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
14488 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
14489 LDKTxCreationKeys ret_var = TxCreationKeys_new(per_commitment_point_arg_ref, revocation_key_arg_ref, broadcaster_htlc_key_arg_ref, countersignatory_htlc_key_arg_ref, broadcaster_delayed_payment_key_arg_ref);
14490 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14491 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14492 long ret_ref = (long)ret_var.inner;
14493 if (ret_var.is_owned) {
14499 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14500 LDKTxCreationKeys obj_conv;
14501 obj_conv.inner = (void*)(obj & (~1));
14502 obj_conv.is_owned = false;
14503 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
14504 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14505 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14506 CVec_u8Z_free(arg_var);
14510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14511 LDKu8slice ser_ref;
14512 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14513 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14514 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
14515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14517 long ret_ref = (long)ret_var.inner;
14518 if (ret_var.is_owned) {
14521 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14526 LDKChannelPublicKeys this_ptr_conv;
14527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14529 ChannelPublicKeys_free(this_ptr_conv);
14532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14533 LDKChannelPublicKeys orig_conv;
14534 orig_conv.inner = (void*)(orig & (~1));
14535 orig_conv.is_owned = false;
14536 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
14537 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14538 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14539 long ret_ref = (long)ret_var.inner;
14540 if (ret_var.is_owned) {
14546 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14547 LDKChannelPublicKeys this_ptr_conv;
14548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14549 this_ptr_conv.is_owned = false;
14550 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14551 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
14555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14556 LDKChannelPublicKeys this_ptr_conv;
14557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14558 this_ptr_conv.is_owned = false;
14559 LDKPublicKey val_ref;
14560 CHECK((*env)->GetArrayLength(env, val) == 33);
14561 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14562 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
14565 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14566 LDKChannelPublicKeys this_ptr_conv;
14567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14568 this_ptr_conv.is_owned = false;
14569 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14570 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
14574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14575 LDKChannelPublicKeys this_ptr_conv;
14576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14577 this_ptr_conv.is_owned = false;
14578 LDKPublicKey val_ref;
14579 CHECK((*env)->GetArrayLength(env, val) == 33);
14580 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14581 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
14584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14585 LDKChannelPublicKeys this_ptr_conv;
14586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14587 this_ptr_conv.is_owned = false;
14588 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14589 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
14593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14594 LDKChannelPublicKeys this_ptr_conv;
14595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14596 this_ptr_conv.is_owned = false;
14597 LDKPublicKey val_ref;
14598 CHECK((*env)->GetArrayLength(env, val) == 33);
14599 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14600 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
14603 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14604 LDKChannelPublicKeys this_ptr_conv;
14605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14606 this_ptr_conv.is_owned = false;
14607 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14608 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
14612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14613 LDKChannelPublicKeys this_ptr_conv;
14614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14615 this_ptr_conv.is_owned = false;
14616 LDKPublicKey val_ref;
14617 CHECK((*env)->GetArrayLength(env, val) == 33);
14618 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14619 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
14622 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14623 LDKChannelPublicKeys this_ptr_conv;
14624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14625 this_ptr_conv.is_owned = false;
14626 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14627 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
14631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14632 LDKChannelPublicKeys this_ptr_conv;
14633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14634 this_ptr_conv.is_owned = false;
14635 LDKPublicKey val_ref;
14636 CHECK((*env)->GetArrayLength(env, val) == 33);
14637 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14638 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
14641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_pubkey_arg, int8_tArray revocation_basepoint_arg, int8_tArray payment_point_arg, int8_tArray delayed_payment_basepoint_arg, int8_tArray htlc_basepoint_arg) {
14642 LDKPublicKey funding_pubkey_arg_ref;
14643 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
14644 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
14645 LDKPublicKey revocation_basepoint_arg_ref;
14646 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
14647 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
14648 LDKPublicKey payment_point_arg_ref;
14649 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
14650 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
14651 LDKPublicKey delayed_payment_basepoint_arg_ref;
14652 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
14653 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
14654 LDKPublicKey htlc_basepoint_arg_ref;
14655 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
14656 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
14657 LDKChannelPublicKeys ret_var = ChannelPublicKeys_new(funding_pubkey_arg_ref, revocation_basepoint_arg_ref, payment_point_arg_ref, delayed_payment_basepoint_arg_ref, htlc_basepoint_arg_ref);
14658 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14659 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14660 long ret_ref = (long)ret_var.inner;
14661 if (ret_var.is_owned) {
14667 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14668 LDKChannelPublicKeys obj_conv;
14669 obj_conv.inner = (void*)(obj & (~1));
14670 obj_conv.is_owned = false;
14671 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
14672 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14673 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14674 CVec_u8Z_free(arg_var);
14678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14679 LDKu8slice ser_ref;
14680 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14681 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14682 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
14683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14685 long ret_ref = (long)ret_var.inner;
14686 if (ret_var.is_owned) {
14689 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray broadcaster_delayed_payment_base, int8_tArray broadcaster_htlc_base, int8_tArray countersignatory_revocation_base, int8_tArray countersignatory_htlc_base) {
14694 LDKPublicKey per_commitment_point_ref;
14695 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14696 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14697 LDKPublicKey broadcaster_delayed_payment_base_ref;
14698 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
14699 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
14700 LDKPublicKey broadcaster_htlc_base_ref;
14701 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
14702 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
14703 LDKPublicKey countersignatory_revocation_base_ref;
14704 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
14705 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
14706 LDKPublicKey countersignatory_htlc_base_ref;
14707 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
14708 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
14709 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14710 *ret_conv = TxCreationKeys_derive_new(per_commitment_point_ref, broadcaster_delayed_payment_base_ref, broadcaster_htlc_base_ref, countersignatory_revocation_base_ref, countersignatory_htlc_base_ref);
14711 return (long)ret_conv;
14714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1from_1channel_1static_1keys(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int64_t broadcaster_keys, int64_t countersignatory_keys) {
14715 LDKPublicKey per_commitment_point_ref;
14716 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14717 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14718 LDKChannelPublicKeys broadcaster_keys_conv;
14719 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
14720 broadcaster_keys_conv.is_owned = false;
14721 LDKChannelPublicKeys countersignatory_keys_conv;
14722 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
14723 countersignatory_keys_conv.is_owned = false;
14724 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14725 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
14726 return (long)ret_conv;
14729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv *env, jclass clz, int8_tArray revocation_key, int16_t contest_delay, int8_tArray broadcaster_delayed_payment_key) {
14730 LDKPublicKey revocation_key_ref;
14731 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14732 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14733 LDKPublicKey broadcaster_delayed_payment_key_ref;
14734 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14735 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14736 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
14737 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14738 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14739 CVec_u8Z_free(arg_var);
14743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14744 LDKHTLCOutputInCommitment this_ptr_conv;
14745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14747 HTLCOutputInCommitment_free(this_ptr_conv);
14750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14751 LDKHTLCOutputInCommitment orig_conv;
14752 orig_conv.inner = (void*)(orig & (~1));
14753 orig_conv.is_owned = false;
14754 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
14755 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14756 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14757 long ret_ref = (long)ret_var.inner;
14758 if (ret_var.is_owned) {
14764 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
14765 LDKHTLCOutputInCommitment this_ptr_conv;
14766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14767 this_ptr_conv.is_owned = false;
14768 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
14772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14773 LDKHTLCOutputInCommitment this_ptr_conv;
14774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14775 this_ptr_conv.is_owned = false;
14776 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
14779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14780 LDKHTLCOutputInCommitment this_ptr_conv;
14781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14782 this_ptr_conv.is_owned = false;
14783 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
14787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14788 LDKHTLCOutputInCommitment this_ptr_conv;
14789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14790 this_ptr_conv.is_owned = false;
14791 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
14794 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
14795 LDKHTLCOutputInCommitment this_ptr_conv;
14796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14797 this_ptr_conv.is_owned = false;
14798 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
14802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14803 LDKHTLCOutputInCommitment this_ptr_conv;
14804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14805 this_ptr_conv.is_owned = false;
14806 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
14809 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14810 LDKHTLCOutputInCommitment this_ptr_conv;
14811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14812 this_ptr_conv.is_owned = false;
14813 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14814 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
14818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14819 LDKHTLCOutputInCommitment this_ptr_conv;
14820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14821 this_ptr_conv.is_owned = false;
14822 LDKThirtyTwoBytes val_ref;
14823 CHECK((*env)->GetArrayLength(env, val) == 32);
14824 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14825 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
14828 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
14829 LDKHTLCOutputInCommitment obj_conv;
14830 obj_conv.inner = (void*)(obj & (~1));
14831 obj_conv.is_owned = false;
14832 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
14833 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14834 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14835 CVec_u8Z_free(arg_var);
14839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14840 LDKu8slice ser_ref;
14841 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14842 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14843 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
14844 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14845 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14846 long ret_ref = (long)ret_var.inner;
14847 if (ret_var.is_owned) {
14850 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14854 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
14855 LDKHTLCOutputInCommitment htlc_conv;
14856 htlc_conv.inner = (void*)(htlc & (~1));
14857 htlc_conv.is_owned = false;
14858 LDKTxCreationKeys keys_conv;
14859 keys_conv.inner = (void*)(keys & (~1));
14860 keys_conv.is_owned = false;
14861 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
14862 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14863 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14864 CVec_u8Z_free(arg_var);
14868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
14869 LDKPublicKey broadcaster_ref;
14870 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
14871 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
14872 LDKPublicKey countersignatory_ref;
14873 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
14874 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
14875 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
14876 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14877 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14878 CVec_u8Z_free(arg_var);
14882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
14883 unsigned char prev_hash_arr[32];
14884 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
14885 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
14886 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
14887 LDKHTLCOutputInCommitment htlc_conv;
14888 htlc_conv.inner = (void*)(htlc & (~1));
14889 htlc_conv.is_owned = false;
14890 LDKPublicKey broadcaster_delayed_payment_key_ref;
14891 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14892 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14893 LDKPublicKey revocation_key_ref;
14894 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14895 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14896 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
14897 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14898 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14899 Transaction_free(arg_var);
14903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14904 LDKChannelTransactionParameters this_ptr_conv;
14905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14907 ChannelTransactionParameters_free(this_ptr_conv);
14910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14911 LDKChannelTransactionParameters orig_conv;
14912 orig_conv.inner = (void*)(orig & (~1));
14913 orig_conv.is_owned = false;
14914 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
14915 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14916 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14917 long ret_ref = (long)ret_var.inner;
14918 if (ret_var.is_owned) {
14924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
14925 LDKChannelTransactionParameters this_ptr_conv;
14926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14927 this_ptr_conv.is_owned = false;
14928 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
14929 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14930 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14931 long ret_ref = (long)ret_var.inner;
14932 if (ret_var.is_owned) {
14938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14939 LDKChannelTransactionParameters this_ptr_conv;
14940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14941 this_ptr_conv.is_owned = false;
14942 LDKChannelPublicKeys val_conv;
14943 val_conv.inner = (void*)(val & (~1));
14944 val_conv.is_owned = (val & 1) || (val == 0);
14945 val_conv = ChannelPublicKeys_clone(&val_conv);
14946 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
14949 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14950 LDKChannelTransactionParameters this_ptr_conv;
14951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14952 this_ptr_conv.is_owned = false;
14953 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
14957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
14958 LDKChannelTransactionParameters this_ptr_conv;
14959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14960 this_ptr_conv.is_owned = false;
14961 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
14964 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
14965 LDKChannelTransactionParameters this_ptr_conv;
14966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14967 this_ptr_conv.is_owned = false;
14968 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
14972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14973 LDKChannelTransactionParameters this_ptr_conv;
14974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14975 this_ptr_conv.is_owned = false;
14976 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
14979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
14980 LDKChannelTransactionParameters this_ptr_conv;
14981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14982 this_ptr_conv.is_owned = false;
14983 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
14984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14986 long ret_ref = (long)ret_var.inner;
14987 if (ret_var.is_owned) {
14993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14994 LDKChannelTransactionParameters this_ptr_conv;
14995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14996 this_ptr_conv.is_owned = false;
14997 LDKCounterpartyChannelTransactionParameters val_conv;
14998 val_conv.inner = (void*)(val & (~1));
14999 val_conv.is_owned = (val & 1) || (val == 0);
15000 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
15001 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
15004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
15005 LDKChannelTransactionParameters this_ptr_conv;
15006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15007 this_ptr_conv.is_owned = false;
15008 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
15009 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15010 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15011 long ret_ref = (long)ret_var.inner;
15012 if (ret_var.is_owned) {
15018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15019 LDKChannelTransactionParameters this_ptr_conv;
15020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15021 this_ptr_conv.is_owned = false;
15022 LDKOutPoint val_conv;
15023 val_conv.inner = (void*)(val & (~1));
15024 val_conv.is_owned = (val & 1) || (val == 0);
15025 val_conv = OutPoint_clone(&val_conv);
15026 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
15029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg) {
15030 LDKChannelPublicKeys holder_pubkeys_arg_conv;
15031 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
15032 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
15033 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
15034 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
15035 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
15036 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
15037 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
15038 LDKOutPoint funding_outpoint_arg_conv;
15039 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
15040 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
15041 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
15042 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv);
15043 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15044 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15045 long ret_ref = (long)ret_var.inner;
15046 if (ret_var.is_owned) {
15052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15053 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15056 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
15059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15060 LDKCounterpartyChannelTransactionParameters orig_conv;
15061 orig_conv.inner = (void*)(orig & (~1));
15062 orig_conv.is_owned = false;
15063 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
15064 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15065 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15066 long ret_ref = (long)ret_var.inner;
15067 if (ret_var.is_owned) {
15073 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
15074 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15076 this_ptr_conv.is_owned = false;
15077 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
15078 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15079 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15080 long ret_ref = (long)ret_var.inner;
15081 if (ret_var.is_owned) {
15087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15088 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15090 this_ptr_conv.is_owned = false;
15091 LDKChannelPublicKeys val_conv;
15092 val_conv.inner = (void*)(val & (~1));
15093 val_conv.is_owned = (val & 1) || (val == 0);
15094 val_conv = ChannelPublicKeys_clone(&val_conv);
15095 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
15098 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15099 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15101 this_ptr_conv.is_owned = false;
15102 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
15106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15107 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15109 this_ptr_conv.is_owned = false;
15110 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
15113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t pubkeys_arg, int16_t selected_contest_delay_arg) {
15114 LDKChannelPublicKeys pubkeys_arg_conv;
15115 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
15116 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
15117 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
15118 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
15119 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15120 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15121 long ret_ref = (long)ret_var.inner;
15122 if (ret_var.is_owned) {
15128 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
15129 LDKChannelTransactionParameters this_arg_conv;
15130 this_arg_conv.inner = (void*)(this_arg & (~1));
15131 this_arg_conv.is_owned = false;
15132 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
15136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15137 LDKChannelTransactionParameters this_arg_conv;
15138 this_arg_conv.inner = (void*)(this_arg & (~1));
15139 this_arg_conv.is_owned = false;
15140 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
15141 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15142 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15143 long ret_ref = (long)ret_var.inner;
15144 if (ret_var.is_owned) {
15150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15151 LDKChannelTransactionParameters this_arg_conv;
15152 this_arg_conv.inner = (void*)(this_arg & (~1));
15153 this_arg_conv.is_owned = false;
15154 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
15155 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15156 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15157 long ret_ref = (long)ret_var.inner;
15158 if (ret_var.is_owned) {
15164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15165 LDKCounterpartyChannelTransactionParameters obj_conv;
15166 obj_conv.inner = (void*)(obj & (~1));
15167 obj_conv.is_owned = false;
15168 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
15169 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15170 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15171 CVec_u8Z_free(arg_var);
15175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15176 LDKu8slice ser_ref;
15177 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15178 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15179 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
15180 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15181 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15182 long ret_ref = (long)ret_var.inner;
15183 if (ret_var.is_owned) {
15186 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15190 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15191 LDKChannelTransactionParameters obj_conv;
15192 obj_conv.inner = (void*)(obj & (~1));
15193 obj_conv.is_owned = false;
15194 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
15195 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15196 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15197 CVec_u8Z_free(arg_var);
15201 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15202 LDKu8slice ser_ref;
15203 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15204 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15205 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
15206 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15207 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15208 long ret_ref = (long)ret_var.inner;
15209 if (ret_var.is_owned) {
15212 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15217 LDKDirectedChannelTransactionParameters this_ptr_conv;
15218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15220 DirectedChannelTransactionParameters_free(this_ptr_conv);
15223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15224 LDKDirectedChannelTransactionParameters this_arg_conv;
15225 this_arg_conv.inner = (void*)(this_arg & (~1));
15226 this_arg_conv.is_owned = false;
15227 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
15228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15230 long ret_ref = (long)ret_var.inner;
15231 if (ret_var.is_owned) {
15237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15238 LDKDirectedChannelTransactionParameters this_arg_conv;
15239 this_arg_conv.inner = (void*)(this_arg & (~1));
15240 this_arg_conv.is_owned = false;
15241 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
15242 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15243 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15244 long ret_ref = (long)ret_var.inner;
15245 if (ret_var.is_owned) {
15251 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15252 LDKDirectedChannelTransactionParameters this_arg_conv;
15253 this_arg_conv.inner = (void*)(this_arg & (~1));
15254 this_arg_conv.is_owned = false;
15255 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
15259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
15260 LDKDirectedChannelTransactionParameters this_arg_conv;
15261 this_arg_conv.inner = (void*)(this_arg & (~1));
15262 this_arg_conv.is_owned = false;
15263 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
15267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
15268 LDKDirectedChannelTransactionParameters this_arg_conv;
15269 this_arg_conv.inner = (void*)(this_arg & (~1));
15270 this_arg_conv.is_owned = false;
15271 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
15272 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15273 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15274 long ret_ref = (long)ret_var.inner;
15275 if (ret_var.is_owned) {
15281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15282 LDKHolderCommitmentTransaction this_ptr_conv;
15283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15285 HolderCommitmentTransaction_free(this_ptr_conv);
15288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15289 LDKHolderCommitmentTransaction orig_conv;
15290 orig_conv.inner = (void*)(orig & (~1));
15291 orig_conv.is_owned = false;
15292 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
15293 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15294 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15295 long ret_ref = (long)ret_var.inner;
15296 if (ret_var.is_owned) {
15302 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
15303 LDKHolderCommitmentTransaction this_ptr_conv;
15304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15305 this_ptr_conv.is_owned = false;
15306 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15307 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
15311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15312 LDKHolderCommitmentTransaction this_ptr_conv;
15313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15314 this_ptr_conv.is_owned = false;
15315 LDKSignature val_ref;
15316 CHECK((*env)->GetArrayLength(env, val) == 64);
15317 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15318 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
15321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15322 LDKHolderCommitmentTransaction this_ptr_conv;
15323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15324 this_ptr_conv.is_owned = false;
15325 LDKCVec_SignatureZ val_constr;
15326 val_constr.datalen = (*env)->GetArrayLength(env, val);
15327 if (val_constr.datalen > 0)
15328 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15330 val_constr.data = NULL;
15331 for (size_t i = 0; i < val_constr.datalen; i++) {
15332 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
15333 LDKSignature arr_conv_8_ref;
15334 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15335 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15336 val_constr.data[i] = arr_conv_8_ref;
15338 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
15341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15342 LDKHolderCommitmentTransaction obj_conv;
15343 obj_conv.inner = (void*)(obj & (~1));
15344 obj_conv.is_owned = false;
15345 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
15346 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15347 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15348 CVec_u8Z_free(arg_var);
15352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15353 LDKu8slice ser_ref;
15354 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15355 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15356 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
15357 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15358 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15359 long ret_ref = (long)ret_var.inner;
15360 if (ret_var.is_owned) {
15363 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new(JNIEnv *env, jclass clz, int64_t commitment_tx, int8_tArray counterparty_sig, jobjectArray counterparty_htlc_sigs, int8_tArray holder_funding_key, int8_tArray counterparty_funding_key) {
15368 LDKCommitmentTransaction commitment_tx_conv;
15369 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
15370 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
15371 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
15372 LDKSignature counterparty_sig_ref;
15373 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
15374 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
15375 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
15376 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
15377 if (counterparty_htlc_sigs_constr.datalen > 0)
15378 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15380 counterparty_htlc_sigs_constr.data = NULL;
15381 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
15382 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
15383 LDKSignature arr_conv_8_ref;
15384 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15385 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15386 counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref;
15388 LDKPublicKey holder_funding_key_ref;
15389 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
15390 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
15391 LDKPublicKey counterparty_funding_key_ref;
15392 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
15393 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
15394 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
15395 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15396 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15397 long ret_ref = (long)ret_var.inner;
15398 if (ret_var.is_owned) {
15404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15405 LDKBuiltCommitmentTransaction this_ptr_conv;
15406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15408 BuiltCommitmentTransaction_free(this_ptr_conv);
15411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15412 LDKBuiltCommitmentTransaction orig_conv;
15413 orig_conv.inner = (void*)(orig & (~1));
15414 orig_conv.is_owned = false;
15415 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
15416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15418 long ret_ref = (long)ret_var.inner;
15419 if (ret_var.is_owned) {
15425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
15426 LDKBuiltCommitmentTransaction this_ptr_conv;
15427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15428 this_ptr_conv.is_owned = false;
15429 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
15430 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15431 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15432 Transaction_free(arg_var);
15436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15437 LDKBuiltCommitmentTransaction this_ptr_conv;
15438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15439 this_ptr_conv.is_owned = false;
15440 LDKTransaction val_ref;
15441 val_ref.datalen = (*env)->GetArrayLength(env, val);
15442 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
15443 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
15444 val_ref.data_is_owned = true;
15445 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
15448 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
15449 LDKBuiltCommitmentTransaction this_ptr_conv;
15450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15451 this_ptr_conv.is_owned = false;
15452 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15453 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
15457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15458 LDKBuiltCommitmentTransaction this_ptr_conv;
15459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15460 this_ptr_conv.is_owned = false;
15461 LDKThirtyTwoBytes val_ref;
15462 CHECK((*env)->GetArrayLength(env, val) == 32);
15463 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15464 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
15467 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
15468 LDKTransaction transaction_arg_ref;
15469 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
15470 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
15471 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
15472 transaction_arg_ref.data_is_owned = true;
15473 LDKThirtyTwoBytes txid_arg_ref;
15474 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
15475 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
15476 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
15477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15479 long ret_ref = (long)ret_var.inner;
15480 if (ret_var.is_owned) {
15486 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15487 LDKBuiltCommitmentTransaction obj_conv;
15488 obj_conv.inner = (void*)(obj & (~1));
15489 obj_conv.is_owned = false;
15490 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
15491 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15492 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15493 CVec_u8Z_free(arg_var);
15497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15498 LDKu8slice ser_ref;
15499 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15500 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15501 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
15502 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15503 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15504 long ret_ref = (long)ret_var.inner;
15505 if (ret_var.is_owned) {
15508 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
15513 LDKBuiltCommitmentTransaction this_arg_conv;
15514 this_arg_conv.inner = (void*)(this_arg & (~1));
15515 this_arg_conv.is_owned = false;
15516 LDKu8slice funding_redeemscript_ref;
15517 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15518 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15519 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15520 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
15521 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
15526 LDKBuiltCommitmentTransaction this_arg_conv;
15527 this_arg_conv.inner = (void*)(this_arg & (~1));
15528 this_arg_conv.is_owned = false;
15529 unsigned char funding_key_arr[32];
15530 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
15531 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
15532 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
15533 LDKu8slice funding_redeemscript_ref;
15534 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15535 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15536 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15537 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
15538 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15543 LDKCommitmentTransaction this_ptr_conv;
15544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15546 CommitmentTransaction_free(this_ptr_conv);
15549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15550 LDKCommitmentTransaction orig_conv;
15551 orig_conv.inner = (void*)(orig & (~1));
15552 orig_conv.is_owned = false;
15553 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
15554 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15555 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15556 long ret_ref = (long)ret_var.inner;
15557 if (ret_var.is_owned) {
15563 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15564 LDKCommitmentTransaction obj_conv;
15565 obj_conv.inner = (void*)(obj & (~1));
15566 obj_conv.is_owned = false;
15567 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
15568 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15569 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15570 CVec_u8Z_free(arg_var);
15574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15575 LDKu8slice ser_ref;
15576 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15577 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15578 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
15579 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15580 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15581 long ret_ref = (long)ret_var.inner;
15582 if (ret_var.is_owned) {
15585 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
15590 LDKCommitmentTransaction this_arg_conv;
15591 this_arg_conv.inner = (void*)(this_arg & (~1));
15592 this_arg_conv.is_owned = false;
15593 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
15597 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15598 LDKCommitmentTransaction this_arg_conv;
15599 this_arg_conv.inner = (void*)(this_arg & (~1));
15600 this_arg_conv.is_owned = false;
15601 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
15605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15606 LDKCommitmentTransaction this_arg_conv;
15607 this_arg_conv.inner = (void*)(this_arg & (~1));
15608 this_arg_conv.is_owned = false;
15609 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
15613 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
15614 LDKCommitmentTransaction this_arg_conv;
15615 this_arg_conv.inner = (void*)(this_arg & (~1));
15616 this_arg_conv.is_owned = false;
15617 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
15621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
15622 LDKCommitmentTransaction this_arg_conv;
15623 this_arg_conv.inner = (void*)(this_arg & (~1));
15624 this_arg_conv.is_owned = false;
15625 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
15626 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15627 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15628 long ret_ref = (long)ret_var.inner;
15629 if (ret_var.is_owned) {
15635 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters, int64_t broadcaster_keys, int64_t countersignatory_keys) {
15636 LDKCommitmentTransaction this_arg_conv;
15637 this_arg_conv.inner = (void*)(this_arg & (~1));
15638 this_arg_conv.is_owned = false;
15639 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15640 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15641 channel_parameters_conv.is_owned = false;
15642 LDKChannelPublicKeys broadcaster_keys_conv;
15643 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
15644 broadcaster_keys_conv.is_owned = false;
15645 LDKChannelPublicKeys countersignatory_keys_conv;
15646 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
15647 countersignatory_keys_conv.is_owned = false;
15648 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15649 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
15650 return (long)ret_conv;
15653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15654 LDKTrustedCommitmentTransaction this_ptr_conv;
15655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15657 TrustedCommitmentTransaction_free(this_ptr_conv);
15660 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
15661 LDKTrustedCommitmentTransaction this_arg_conv;
15662 this_arg_conv.inner = (void*)(this_arg & (~1));
15663 this_arg_conv.is_owned = false;
15664 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15665 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
15669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
15670 LDKTrustedCommitmentTransaction this_arg_conv;
15671 this_arg_conv.inner = (void*)(this_arg & (~1));
15672 this_arg_conv.is_owned = false;
15673 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
15674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15676 long ret_ref = (long)ret_var.inner;
15677 if (ret_var.is_owned) {
15683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
15684 LDKTrustedCommitmentTransaction this_arg_conv;
15685 this_arg_conv.inner = (void*)(this_arg & (~1));
15686 this_arg_conv.is_owned = false;
15687 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
15688 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15689 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15690 long ret_ref = (long)ret_var.inner;
15691 if (ret_var.is_owned) {
15697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters) {
15698 LDKTrustedCommitmentTransaction this_arg_conv;
15699 this_arg_conv.inner = (void*)(this_arg & (~1));
15700 this_arg_conv.is_owned = false;
15701 unsigned char htlc_base_key_arr[32];
15702 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
15703 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
15704 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
15705 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15706 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15707 channel_parameters_conv.is_owned = false;
15708 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15709 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
15710 return (long)ret_conv;
15713 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1commitment_1transaction_1number_1obscure_1factor(JNIEnv *env, jclass clz, int8_tArray broadcaster_payment_basepoint, int8_tArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
15714 LDKPublicKey broadcaster_payment_basepoint_ref;
15715 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
15716 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
15717 LDKPublicKey countersignatory_payment_basepoint_ref;
15718 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
15719 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
15720 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
15724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15725 LDKInitFeatures this_ptr_conv;
15726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15728 InitFeatures_free(this_ptr_conv);
15731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15732 LDKNodeFeatures this_ptr_conv;
15733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15735 NodeFeatures_free(this_ptr_conv);
15738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15739 LDKChannelFeatures this_ptr_conv;
15740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15742 ChannelFeatures_free(this_ptr_conv);
15745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15746 LDKRouteHop this_ptr_conv;
15747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15749 RouteHop_free(this_ptr_conv);
15752 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15753 LDKRouteHop orig_conv;
15754 orig_conv.inner = (void*)(orig & (~1));
15755 orig_conv.is_owned = false;
15756 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
15757 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15758 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15759 long ret_ref = (long)ret_var.inner;
15760 if (ret_var.is_owned) {
15766 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15767 LDKRouteHop this_ptr_conv;
15768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15769 this_ptr_conv.is_owned = false;
15770 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
15771 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
15775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15776 LDKRouteHop this_ptr_conv;
15777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15778 this_ptr_conv.is_owned = false;
15779 LDKPublicKey val_ref;
15780 CHECK((*env)->GetArrayLength(env, val) == 33);
15781 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15782 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
15785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15786 LDKRouteHop this_ptr_conv;
15787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15788 this_ptr_conv.is_owned = false;
15789 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
15790 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15791 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15792 long ret_ref = (long)ret_var.inner;
15793 if (ret_var.is_owned) {
15799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15800 LDKRouteHop this_ptr_conv;
15801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15802 this_ptr_conv.is_owned = false;
15803 LDKNodeFeatures val_conv;
15804 val_conv.inner = (void*)(val & (~1));
15805 val_conv.is_owned = (val & 1) || (val == 0);
15806 // Warning: we need a move here but no clone is available for LDKNodeFeatures
15807 RouteHop_set_node_features(&this_ptr_conv, val_conv);
15810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15811 LDKRouteHop this_ptr_conv;
15812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15813 this_ptr_conv.is_owned = false;
15814 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
15818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15819 LDKRouteHop this_ptr_conv;
15820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15821 this_ptr_conv.is_owned = false;
15822 RouteHop_set_short_channel_id(&this_ptr_conv, val);
15825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15826 LDKRouteHop this_ptr_conv;
15827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15828 this_ptr_conv.is_owned = false;
15829 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
15830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15832 long ret_ref = (long)ret_var.inner;
15833 if (ret_var.is_owned) {
15839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15840 LDKRouteHop this_ptr_conv;
15841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15842 this_ptr_conv.is_owned = false;
15843 LDKChannelFeatures val_conv;
15844 val_conv.inner = (void*)(val & (~1));
15845 val_conv.is_owned = (val & 1) || (val == 0);
15846 // Warning: we need a move here but no clone is available for LDKChannelFeatures
15847 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
15850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15851 LDKRouteHop this_ptr_conv;
15852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15853 this_ptr_conv.is_owned = false;
15854 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
15858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15859 LDKRouteHop this_ptr_conv;
15860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15861 this_ptr_conv.is_owned = false;
15862 RouteHop_set_fee_msat(&this_ptr_conv, val);
15865 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15866 LDKRouteHop this_ptr_conv;
15867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15868 this_ptr_conv.is_owned = false;
15869 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
15873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15874 LDKRouteHop this_ptr_conv;
15875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15876 this_ptr_conv.is_owned = false;
15877 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
15880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv *env, jclass clz, int8_tArray pubkey_arg, int64_t node_features_arg, int64_t short_channel_id_arg, int64_t channel_features_arg, int64_t fee_msat_arg, int32_t cltv_expiry_delta_arg) {
15881 LDKPublicKey pubkey_arg_ref;
15882 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
15883 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
15884 LDKNodeFeatures node_features_arg_conv;
15885 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
15886 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
15887 // Warning: we need a move here but no clone is available for LDKNodeFeatures
15888 LDKChannelFeatures channel_features_arg_conv;
15889 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
15890 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
15891 // Warning: we need a move here but no clone is available for LDKChannelFeatures
15892 LDKRouteHop ret_var = RouteHop_new(pubkey_arg_ref, node_features_arg_conv, short_channel_id_arg, channel_features_arg_conv, fee_msat_arg, cltv_expiry_delta_arg);
15893 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15894 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15895 long ret_ref = (long)ret_var.inner;
15896 if (ret_var.is_owned) {
15902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15903 LDKRoute this_ptr_conv;
15904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15906 Route_free(this_ptr_conv);
15909 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15910 LDKRoute orig_conv;
15911 orig_conv.inner = (void*)(orig & (~1));
15912 orig_conv.is_owned = false;
15913 LDKRoute ret_var = Route_clone(&orig_conv);
15914 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15915 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15916 long ret_ref = (long)ret_var.inner;
15917 if (ret_var.is_owned) {
15923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15924 LDKRoute this_ptr_conv;
15925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15926 this_ptr_conv.is_owned = false;
15927 LDKCVec_CVec_RouteHopZZ val_constr;
15928 val_constr.datalen = (*env)->GetArrayLength(env, val);
15929 if (val_constr.datalen > 0)
15930 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15932 val_constr.data = NULL;
15933 for (size_t m = 0; m < val_constr.datalen; m++) {
15934 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
15935 LDKCVec_RouteHopZ arr_conv_12_constr;
15936 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15937 if (arr_conv_12_constr.datalen > 0)
15938 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15940 arr_conv_12_constr.data = NULL;
15941 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15942 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15943 int64_t arr_conv_10 = arr_conv_12_vals[k];
15944 LDKRouteHop arr_conv_10_conv;
15945 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15946 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15947 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15948 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15950 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15951 val_constr.data[m] = arr_conv_12_constr;
15953 Route_set_paths(&this_ptr_conv, val_constr);
15956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
15957 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
15958 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
15959 if (paths_arg_constr.datalen > 0)
15960 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15962 paths_arg_constr.data = NULL;
15963 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
15964 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
15965 LDKCVec_RouteHopZ arr_conv_12_constr;
15966 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15967 if (arr_conv_12_constr.datalen > 0)
15968 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15970 arr_conv_12_constr.data = NULL;
15971 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15972 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15973 int64_t arr_conv_10 = arr_conv_12_vals[k];
15974 LDKRouteHop arr_conv_10_conv;
15975 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15976 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15977 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15978 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15980 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15981 paths_arg_constr.data[m] = arr_conv_12_constr;
15983 LDKRoute ret_var = Route_new(paths_arg_constr);
15984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15986 long ret_ref = (long)ret_var.inner;
15987 if (ret_var.is_owned) {
15993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
15995 obj_conv.inner = (void*)(obj & (~1));
15996 obj_conv.is_owned = false;
15997 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
15998 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15999 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16000 CVec_u8Z_free(arg_var);
16004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16005 LDKu8slice ser_ref;
16006 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16007 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16008 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
16009 *ret_conv = Route_read(ser_ref);
16010 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16011 return (long)ret_conv;
16014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16015 LDKRouteHint this_ptr_conv;
16016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16018 RouteHint_free(this_ptr_conv);
16021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16022 LDKRouteHint orig_conv;
16023 orig_conv.inner = (void*)(orig & (~1));
16024 orig_conv.is_owned = false;
16025 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
16026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16028 long ret_ref = (long)ret_var.inner;
16029 if (ret_var.is_owned) {
16035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16036 LDKRouteHint this_ptr_conv;
16037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16038 this_ptr_conv.is_owned = false;
16039 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16040 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
16044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16045 LDKRouteHint this_ptr_conv;
16046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16047 this_ptr_conv.is_owned = false;
16048 LDKPublicKey val_ref;
16049 CHECK((*env)->GetArrayLength(env, val) == 33);
16050 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16051 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
16054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16055 LDKRouteHint this_ptr_conv;
16056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16057 this_ptr_conv.is_owned = false;
16058 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
16062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16063 LDKRouteHint this_ptr_conv;
16064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16065 this_ptr_conv.is_owned = false;
16066 RouteHint_set_short_channel_id(&this_ptr_conv, val);
16069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16070 LDKRouteHint this_ptr_conv;
16071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16072 this_ptr_conv.is_owned = false;
16073 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
16074 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16075 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16076 long ret_ref = (long)ret_var.inner;
16077 if (ret_var.is_owned) {
16083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16084 LDKRouteHint this_ptr_conv;
16085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16086 this_ptr_conv.is_owned = false;
16087 LDKRoutingFees val_conv;
16088 val_conv.inner = (void*)(val & (~1));
16089 val_conv.is_owned = (val & 1) || (val == 0);
16090 val_conv = RoutingFees_clone(&val_conv);
16091 RouteHint_set_fees(&this_ptr_conv, val_conv);
16094 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16095 LDKRouteHint this_ptr_conv;
16096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16097 this_ptr_conv.is_owned = false;
16098 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
16102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16103 LDKRouteHint this_ptr_conv;
16104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16105 this_ptr_conv.is_owned = false;
16106 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
16109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16110 LDKRouteHint this_ptr_conv;
16111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16112 this_ptr_conv.is_owned = false;
16113 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
16117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16118 LDKRouteHint this_ptr_conv;
16119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16120 this_ptr_conv.is_owned = false;
16121 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
16124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg) {
16125 LDKPublicKey src_node_id_arg_ref;
16126 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
16127 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
16128 LDKRoutingFees fees_arg_conv;
16129 fees_arg_conv.inner = (void*)(fees_arg & (~1));
16130 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
16131 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
16132 LDKRouteHint ret_var = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
16133 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16134 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16135 long ret_ref = (long)ret_var.inner;
16136 if (ret_var.is_owned) {
16142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray target, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
16143 LDKPublicKey our_node_id_ref;
16144 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
16145 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
16146 LDKNetworkGraph network_conv;
16147 network_conv.inner = (void*)(network & (~1));
16148 network_conv.is_owned = false;
16149 LDKPublicKey target_ref;
16150 CHECK((*env)->GetArrayLength(env, target) == 33);
16151 (*env)->GetByteArrayRegion(env, target, 0, 33, target_ref.compressed_form);
16152 LDKCVec_ChannelDetailsZ first_hops_constr;
16153 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
16154 if (first_hops_constr.datalen > 0)
16155 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16157 first_hops_constr.data = NULL;
16158 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
16159 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
16160 int64_t arr_conv_16 = first_hops_vals[q];
16161 LDKChannelDetails arr_conv_16_conv;
16162 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
16163 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
16164 first_hops_constr.data[q] = arr_conv_16_conv;
16166 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
16167 LDKCVec_RouteHintZ last_hops_constr;
16168 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
16169 if (last_hops_constr.datalen > 0)
16170 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16172 last_hops_constr.data = NULL;
16173 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
16174 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
16175 int64_t arr_conv_11 = last_hops_vals[l];
16176 LDKRouteHint arr_conv_11_conv;
16177 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
16178 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
16179 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
16180 last_hops_constr.data[l] = arr_conv_11_conv;
16182 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
16183 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16184 if (logger_conv.free == LDKLogger_JCalls_free) {
16185 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16186 LDKLogger_JCalls_clone(logger_conv.this_arg);
16188 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16189 *ret_conv = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
16190 FREE(first_hops_constr.data);
16191 return (long)ret_conv;
16194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16195 LDKNetworkGraph this_ptr_conv;
16196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16197 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16198 NetworkGraph_free(this_ptr_conv);
16201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16202 LDKLockedNetworkGraph this_ptr_conv;
16203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16204 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16205 LockedNetworkGraph_free(this_ptr_conv);
16208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16209 LDKNetGraphMsgHandler this_ptr_conv;
16210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16212 NetGraphMsgHandler_free(this_ptr_conv);
16215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
16216 LDKThirtyTwoBytes genesis_hash_ref;
16217 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
16218 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
16219 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16220 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16221 if (logger_conv.free == LDKLogger_JCalls_free) {
16222 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16223 LDKLogger_JCalls_clone(logger_conv.this_arg);
16225 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
16226 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16227 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16228 long ret_ref = (long)ret_var.inner;
16229 if (ret_var.is_owned) {
16235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
16236 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16237 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16238 if (logger_conv.free == LDKLogger_JCalls_free) {
16239 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16240 LDKLogger_JCalls_clone(logger_conv.this_arg);
16242 LDKNetworkGraph network_graph_conv;
16243 network_graph_conv.inner = (void*)(network_graph & (~1));
16244 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
16245 // Warning: we need a move here but no clone is available for LDKNetworkGraph
16246 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
16247 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16248 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16249 long ret_ref = (long)ret_var.inner;
16250 if (ret_var.is_owned) {
16256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16257 LDKNetGraphMsgHandler this_arg_conv;
16258 this_arg_conv.inner = (void*)(this_arg & (~1));
16259 this_arg_conv.is_owned = false;
16260 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
16261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16263 long ret_ref = (long)ret_var.inner;
16264 if (ret_var.is_owned) {
16270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16271 LDKLockedNetworkGraph this_arg_conv;
16272 this_arg_conv.inner = (void*)(this_arg & (~1));
16273 this_arg_conv.is_owned = false;
16274 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
16275 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16276 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16277 long ret_ref = (long)ret_var.inner;
16278 if (ret_var.is_owned) {
16284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16285 LDKNetGraphMsgHandler this_arg_conv;
16286 this_arg_conv.inner = (void*)(this_arg & (~1));
16287 this_arg_conv.is_owned = false;
16288 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16289 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
16293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16294 LDKNetGraphMsgHandler this_arg_conv;
16295 this_arg_conv.inner = (void*)(this_arg & (~1));
16296 this_arg_conv.is_owned = false;
16297 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16298 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
16302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16303 LDKDirectionalChannelInfo this_ptr_conv;
16304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16306 DirectionalChannelInfo_free(this_ptr_conv);
16309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16310 LDKDirectionalChannelInfo orig_conv;
16311 orig_conv.inner = (void*)(orig & (~1));
16312 orig_conv.is_owned = false;
16313 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
16314 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16315 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16316 long ret_ref = (long)ret_var.inner;
16317 if (ret_var.is_owned) {
16323 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16324 LDKDirectionalChannelInfo this_ptr_conv;
16325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16326 this_ptr_conv.is_owned = false;
16327 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
16331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16332 LDKDirectionalChannelInfo this_ptr_conv;
16333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16334 this_ptr_conv.is_owned = false;
16335 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
16338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
16339 LDKDirectionalChannelInfo this_ptr_conv;
16340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16341 this_ptr_conv.is_owned = false;
16342 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
16346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16347 LDKDirectionalChannelInfo this_ptr_conv;
16348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16349 this_ptr_conv.is_owned = false;
16350 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
16353 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16354 LDKDirectionalChannelInfo this_ptr_conv;
16355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16356 this_ptr_conv.is_owned = false;
16357 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
16361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16362 LDKDirectionalChannelInfo this_ptr_conv;
16363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16364 this_ptr_conv.is_owned = false;
16365 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
16368 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16369 LDKDirectionalChannelInfo this_ptr_conv;
16370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16371 this_ptr_conv.is_owned = false;
16372 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
16376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16377 LDKDirectionalChannelInfo this_ptr_conv;
16378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16379 this_ptr_conv.is_owned = false;
16380 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
16383 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16384 LDKDirectionalChannelInfo this_ptr_conv;
16385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16386 this_ptr_conv.is_owned = false;
16387 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
16388 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16389 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16390 long ret_ref = (long)ret_var.inner;
16391 if (ret_var.is_owned) {
16397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16398 LDKDirectionalChannelInfo this_ptr_conv;
16399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16400 this_ptr_conv.is_owned = false;
16401 LDKRoutingFees val_conv;
16402 val_conv.inner = (void*)(val & (~1));
16403 val_conv.is_owned = (val & 1) || (val == 0);
16404 val_conv = RoutingFees_clone(&val_conv);
16405 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
16408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16409 LDKDirectionalChannelInfo this_ptr_conv;
16410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16411 this_ptr_conv.is_owned = false;
16412 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
16413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16415 long ret_ref = (long)ret_var.inner;
16416 if (ret_var.is_owned) {
16422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16423 LDKDirectionalChannelInfo this_ptr_conv;
16424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16425 this_ptr_conv.is_owned = false;
16426 LDKChannelUpdate val_conv;
16427 val_conv.inner = (void*)(val & (~1));
16428 val_conv.is_owned = (val & 1) || (val == 0);
16429 val_conv = ChannelUpdate_clone(&val_conv);
16430 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
16433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16434 LDKDirectionalChannelInfo obj_conv;
16435 obj_conv.inner = (void*)(obj & (~1));
16436 obj_conv.is_owned = false;
16437 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
16438 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16439 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16440 CVec_u8Z_free(arg_var);
16444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16445 LDKu8slice ser_ref;
16446 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16447 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16448 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
16449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16451 long ret_ref = (long)ret_var.inner;
16452 if (ret_var.is_owned) {
16455 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16460 LDKChannelInfo this_ptr_conv;
16461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16462 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16463 ChannelInfo_free(this_ptr_conv);
16466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16467 LDKChannelInfo this_ptr_conv;
16468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16469 this_ptr_conv.is_owned = false;
16470 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
16471 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16472 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16473 long ret_ref = (long)ret_var.inner;
16474 if (ret_var.is_owned) {
16480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16481 LDKChannelInfo this_ptr_conv;
16482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16483 this_ptr_conv.is_owned = false;
16484 LDKChannelFeatures val_conv;
16485 val_conv.inner = (void*)(val & (~1));
16486 val_conv.is_owned = (val & 1) || (val == 0);
16487 // Warning: we need a move here but no clone is available for LDKChannelFeatures
16488 ChannelInfo_set_features(&this_ptr_conv, val_conv);
16491 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16492 LDKChannelInfo this_ptr_conv;
16493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16494 this_ptr_conv.is_owned = false;
16495 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16496 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
16500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16501 LDKChannelInfo this_ptr_conv;
16502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16503 this_ptr_conv.is_owned = false;
16504 LDKPublicKey val_ref;
16505 CHECK((*env)->GetArrayLength(env, val) == 33);
16506 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16507 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
16510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
16511 LDKChannelInfo this_ptr_conv;
16512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16513 this_ptr_conv.is_owned = false;
16514 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
16515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16517 long ret_ref = (long)ret_var.inner;
16518 if (ret_var.is_owned) {
16524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16525 LDKChannelInfo this_ptr_conv;
16526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16527 this_ptr_conv.is_owned = false;
16528 LDKDirectionalChannelInfo val_conv;
16529 val_conv.inner = (void*)(val & (~1));
16530 val_conv.is_owned = (val & 1) || (val == 0);
16531 val_conv = DirectionalChannelInfo_clone(&val_conv);
16532 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
16535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
16536 LDKChannelInfo this_ptr_conv;
16537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16538 this_ptr_conv.is_owned = false;
16539 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16540 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
16544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16545 LDKChannelInfo this_ptr_conv;
16546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16547 this_ptr_conv.is_owned = false;
16548 LDKPublicKey val_ref;
16549 CHECK((*env)->GetArrayLength(env, val) == 33);
16550 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16551 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
16554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16555 LDKChannelInfo this_ptr_conv;
16556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16557 this_ptr_conv.is_owned = false;
16558 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
16559 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16560 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16561 long ret_ref = (long)ret_var.inner;
16562 if (ret_var.is_owned) {
16568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16569 LDKChannelInfo this_ptr_conv;
16570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16571 this_ptr_conv.is_owned = false;
16572 LDKDirectionalChannelInfo val_conv;
16573 val_conv.inner = (void*)(val & (~1));
16574 val_conv.is_owned = (val & 1) || (val == 0);
16575 val_conv = DirectionalChannelInfo_clone(&val_conv);
16576 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
16579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16580 LDKChannelInfo this_ptr_conv;
16581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16582 this_ptr_conv.is_owned = false;
16583 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
16584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16586 long ret_ref = (long)ret_var.inner;
16587 if (ret_var.is_owned) {
16593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16594 LDKChannelInfo this_ptr_conv;
16595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16596 this_ptr_conv.is_owned = false;
16597 LDKChannelAnnouncement val_conv;
16598 val_conv.inner = (void*)(val & (~1));
16599 val_conv.is_owned = (val & 1) || (val == 0);
16600 val_conv = ChannelAnnouncement_clone(&val_conv);
16601 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
16604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16605 LDKChannelInfo obj_conv;
16606 obj_conv.inner = (void*)(obj & (~1));
16607 obj_conv.is_owned = false;
16608 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
16609 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16610 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16611 CVec_u8Z_free(arg_var);
16615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16616 LDKu8slice ser_ref;
16617 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16618 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16619 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
16620 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16621 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16622 long ret_ref = (long)ret_var.inner;
16623 if (ret_var.is_owned) {
16626 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16631 LDKRoutingFees this_ptr_conv;
16632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16634 RoutingFees_free(this_ptr_conv);
16637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16638 LDKRoutingFees orig_conv;
16639 orig_conv.inner = (void*)(orig & (~1));
16640 orig_conv.is_owned = false;
16641 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
16642 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16643 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16644 long ret_ref = (long)ret_var.inner;
16645 if (ret_var.is_owned) {
16651 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16652 LDKRoutingFees this_ptr_conv;
16653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16654 this_ptr_conv.is_owned = false;
16655 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
16659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16660 LDKRoutingFees this_ptr_conv;
16661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16662 this_ptr_conv.is_owned = false;
16663 RoutingFees_set_base_msat(&this_ptr_conv, val);
16666 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
16667 LDKRoutingFees this_ptr_conv;
16668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16669 this_ptr_conv.is_owned = false;
16670 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
16674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16675 LDKRoutingFees this_ptr_conv;
16676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16677 this_ptr_conv.is_owned = false;
16678 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
16681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv *env, jclass clz, int32_t base_msat_arg, int32_t proportional_millionths_arg) {
16682 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
16683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16685 long ret_ref = (long)ret_var.inner;
16686 if (ret_var.is_owned) {
16692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16693 LDKu8slice ser_ref;
16694 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16695 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16696 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16697 *ret_conv = RoutingFees_read(ser_ref);
16698 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16699 return (long)ret_conv;
16702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
16703 LDKRoutingFees obj_conv;
16704 obj_conv.inner = (void*)(obj & (~1));
16705 obj_conv.is_owned = false;
16706 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
16707 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16708 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16709 CVec_u8Z_free(arg_var);
16713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16714 LDKNodeAnnouncementInfo this_ptr_conv;
16715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16717 NodeAnnouncementInfo_free(this_ptr_conv);
16720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16721 LDKNodeAnnouncementInfo orig_conv;
16722 orig_conv.inner = (void*)(orig & (~1));
16723 orig_conv.is_owned = false;
16724 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
16725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16727 long ret_ref = (long)ret_var.inner;
16728 if (ret_var.is_owned) {
16734 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16735 LDKNodeAnnouncementInfo this_ptr_conv;
16736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16737 this_ptr_conv.is_owned = false;
16738 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
16739 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16740 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16741 long ret_ref = (long)ret_var.inner;
16742 if (ret_var.is_owned) {
16748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16749 LDKNodeAnnouncementInfo this_ptr_conv;
16750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16751 this_ptr_conv.is_owned = false;
16752 LDKNodeFeatures val_conv;
16753 val_conv.inner = (void*)(val & (~1));
16754 val_conv.is_owned = (val & 1) || (val == 0);
16755 // Warning: we need a move here but no clone is available for LDKNodeFeatures
16756 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
16759 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16760 LDKNodeAnnouncementInfo this_ptr_conv;
16761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16762 this_ptr_conv.is_owned = false;
16763 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
16767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16768 LDKNodeAnnouncementInfo this_ptr_conv;
16769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16770 this_ptr_conv.is_owned = false;
16771 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
16774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
16775 LDKNodeAnnouncementInfo this_ptr_conv;
16776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16777 this_ptr_conv.is_owned = false;
16778 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
16779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
16783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16784 LDKNodeAnnouncementInfo this_ptr_conv;
16785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16786 this_ptr_conv.is_owned = false;
16787 LDKThreeBytes val_ref;
16788 CHECK((*env)->GetArrayLength(env, val) == 3);
16789 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
16790 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
16793 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
16794 LDKNodeAnnouncementInfo this_ptr_conv;
16795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16796 this_ptr_conv.is_owned = false;
16797 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16798 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
16802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16803 LDKNodeAnnouncementInfo this_ptr_conv;
16804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16805 this_ptr_conv.is_owned = false;
16806 LDKThirtyTwoBytes val_ref;
16807 CHECK((*env)->GetArrayLength(env, val) == 32);
16808 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16809 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
16812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16813 LDKNodeAnnouncementInfo this_ptr_conv;
16814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16815 this_ptr_conv.is_owned = false;
16816 LDKCVec_NetAddressZ val_constr;
16817 val_constr.datalen = (*env)->GetArrayLength(env, val);
16818 if (val_constr.datalen > 0)
16819 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16821 val_constr.data = NULL;
16822 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16823 for (size_t m = 0; m < val_constr.datalen; m++) {
16824 int64_t arr_conv_12 = val_vals[m];
16825 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
16826 FREE((void*)arr_conv_12);
16827 val_constr.data[m] = arr_conv_12_conv;
16829 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16830 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
16833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16834 LDKNodeAnnouncementInfo this_ptr_conv;
16835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16836 this_ptr_conv.is_owned = false;
16837 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
16838 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16839 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16840 long ret_ref = (long)ret_var.inner;
16841 if (ret_var.is_owned) {
16847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16848 LDKNodeAnnouncementInfo this_ptr_conv;
16849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16850 this_ptr_conv.is_owned = false;
16851 LDKNodeAnnouncement val_conv;
16852 val_conv.inner = (void*)(val & (~1));
16853 val_conv.is_owned = (val & 1) || (val == 0);
16854 val_conv = NodeAnnouncement_clone(&val_conv);
16855 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
16858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int32_t last_update_arg, int8_tArray rgb_arg, int8_tArray alias_arg, int64_tArray addresses_arg, int64_t announcement_message_arg) {
16859 LDKNodeFeatures features_arg_conv;
16860 features_arg_conv.inner = (void*)(features_arg & (~1));
16861 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16862 // Warning: we need a move here but no clone is available for LDKNodeFeatures
16863 LDKThreeBytes rgb_arg_ref;
16864 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
16865 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
16866 LDKThirtyTwoBytes alias_arg_ref;
16867 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
16868 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
16869 LDKCVec_NetAddressZ addresses_arg_constr;
16870 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
16871 if (addresses_arg_constr.datalen > 0)
16872 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16874 addresses_arg_constr.data = NULL;
16875 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
16876 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
16877 int64_t arr_conv_12 = addresses_arg_vals[m];
16878 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)(((uint64_t)arr_conv_12) & ~1);
16879 FREE((void*)arr_conv_12);
16880 addresses_arg_constr.data[m] = arr_conv_12_conv;
16882 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
16883 LDKNodeAnnouncement announcement_message_arg_conv;
16884 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
16885 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
16886 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
16887 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
16888 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16889 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16890 long ret_ref = (long)ret_var.inner;
16891 if (ret_var.is_owned) {
16897 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16898 LDKNodeAnnouncementInfo obj_conv;
16899 obj_conv.inner = (void*)(obj & (~1));
16900 obj_conv.is_owned = false;
16901 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
16902 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16903 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16904 CVec_u8Z_free(arg_var);
16908 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16909 LDKu8slice ser_ref;
16910 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16911 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16912 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16913 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
16914 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16915 return (long)ret_conv;
16918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16919 LDKNodeInfo this_ptr_conv;
16920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16922 NodeInfo_free(this_ptr_conv);
16925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16926 LDKNodeInfo orig_conv;
16927 orig_conv.inner = (void*)(orig & (~1));
16928 orig_conv.is_owned = false;
16929 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
16930 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16931 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16932 long ret_ref = (long)ret_var.inner;
16933 if (ret_var.is_owned) {
16939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16940 LDKNodeInfo this_ptr_conv;
16941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16942 this_ptr_conv.is_owned = false;
16943 LDKCVec_u64Z val_constr;
16944 val_constr.datalen = (*env)->GetArrayLength(env, val);
16945 if (val_constr.datalen > 0)
16946 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16948 val_constr.data = NULL;
16949 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16950 for (size_t g = 0; g < val_constr.datalen; g++) {
16951 int64_t arr_conv_6 = val_vals[g];
16952 val_constr.data[g] = arr_conv_6;
16954 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16955 NodeInfo_set_channels(&this_ptr_conv, val_constr);
16958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16959 LDKNodeInfo this_ptr_conv;
16960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16961 this_ptr_conv.is_owned = false;
16962 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
16963 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16964 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16965 long ret_ref = (long)ret_var.inner;
16966 if (ret_var.is_owned) {
16972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16973 LDKNodeInfo this_ptr_conv;
16974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16975 this_ptr_conv.is_owned = false;
16976 LDKRoutingFees val_conv;
16977 val_conv.inner = (void*)(val & (~1));
16978 val_conv.is_owned = (val & 1) || (val == 0);
16979 val_conv = RoutingFees_clone(&val_conv);
16980 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
16983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
16984 LDKNodeInfo this_ptr_conv;
16985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16986 this_ptr_conv.is_owned = false;
16987 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
16988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16990 long ret_ref = (long)ret_var.inner;
16991 if (ret_var.is_owned) {
16997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16998 LDKNodeInfo this_ptr_conv;
16999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17000 this_ptr_conv.is_owned = false;
17001 LDKNodeAnnouncementInfo val_conv;
17002 val_conv.inner = (void*)(val & (~1));
17003 val_conv.is_owned = (val & 1) || (val == 0);
17004 val_conv = NodeAnnouncementInfo_clone(&val_conv);
17005 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
17008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv *env, jclass clz, int64_tArray channels_arg, int64_t lowest_inbound_channel_fees_arg, int64_t announcement_info_arg) {
17009 LDKCVec_u64Z channels_arg_constr;
17010 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
17011 if (channels_arg_constr.datalen > 0)
17012 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
17014 channels_arg_constr.data = NULL;
17015 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
17016 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
17017 int64_t arr_conv_6 = channels_arg_vals[g];
17018 channels_arg_constr.data[g] = arr_conv_6;
17020 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
17021 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
17022 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
17023 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
17024 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
17025 LDKNodeAnnouncementInfo announcement_info_arg_conv;
17026 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
17027 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
17028 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
17029 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
17030 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17031 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17032 long ret_ref = (long)ret_var.inner;
17033 if (ret_var.is_owned) {
17039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
17040 LDKNodeInfo obj_conv;
17041 obj_conv.inner = (void*)(obj & (~1));
17042 obj_conv.is_owned = false;
17043 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
17044 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17045 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17046 CVec_u8Z_free(arg_var);
17050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17051 LDKu8slice ser_ref;
17052 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17053 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17054 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17055 *ret_conv = NodeInfo_read(ser_ref);
17056 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17057 return (long)ret_conv;
17060 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
17061 LDKNetworkGraph obj_conv;
17062 obj_conv.inner = (void*)(obj & (~1));
17063 obj_conv.is_owned = false;
17064 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
17065 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17066 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17067 CVec_u8Z_free(arg_var);
17071 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17072 LDKu8slice ser_ref;
17073 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17074 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17075 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17076 *ret_conv = NetworkGraph_read(ser_ref);
17077 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17078 return (long)ret_conv;
17081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
17082 LDKThirtyTwoBytes genesis_hash_ref;
17083 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
17084 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
17085 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
17086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17088 long ret_ref = (long)ret_var.inner;
17089 if (ret_var.is_owned) {
17095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17096 LDKNetworkGraph this_arg_conv;
17097 this_arg_conv.inner = (void*)(this_arg & (~1));
17098 this_arg_conv.is_owned = false;
17099 LDKNodeAnnouncement msg_conv;
17100 msg_conv.inner = (void*)(msg & (~1));
17101 msg_conv.is_owned = false;
17102 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17103 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
17104 return (long)ret_conv;
17107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17108 LDKNetworkGraph this_arg_conv;
17109 this_arg_conv.inner = (void*)(this_arg & (~1));
17110 this_arg_conv.is_owned = false;
17111 LDKUnsignedNodeAnnouncement msg_conv;
17112 msg_conv.inner = (void*)(msg & (~1));
17113 msg_conv.is_owned = false;
17114 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17115 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
17116 return (long)ret_conv;
17119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
17120 LDKNetworkGraph this_arg_conv;
17121 this_arg_conv.inner = (void*)(this_arg & (~1));
17122 this_arg_conv.is_owned = false;
17123 LDKChannelAnnouncement msg_conv;
17124 msg_conv.inner = (void*)(msg & (~1));
17125 msg_conv.is_owned = false;
17126 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17127 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17128 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17129 return (long)ret_conv;
17132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int64_t chain_access) {
17133 LDKNetworkGraph this_arg_conv;
17134 this_arg_conv.inner = (void*)(this_arg & (~1));
17135 this_arg_conv.is_owned = false;
17136 LDKUnsignedChannelAnnouncement msg_conv;
17137 msg_conv.inner = (void*)(msg & (~1));
17138 msg_conv.is_owned = false;
17139 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17140 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17141 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17142 return (long)ret_conv;
17145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, jboolean is_permanent) {
17146 LDKNetworkGraph this_arg_conv;
17147 this_arg_conv.inner = (void*)(this_arg & (~1));
17148 this_arg_conv.is_owned = false;
17149 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
17152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17153 LDKNetworkGraph this_arg_conv;
17154 this_arg_conv.inner = (void*)(this_arg & (~1));
17155 this_arg_conv.is_owned = false;
17156 LDKChannelUpdate msg_conv;
17157 msg_conv.inner = (void*)(msg & (~1));
17158 msg_conv.is_owned = false;
17159 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17160 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
17161 return (long)ret_conv;
17164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17165 LDKNetworkGraph this_arg_conv;
17166 this_arg_conv.inner = (void*)(this_arg & (~1));
17167 this_arg_conv.is_owned = false;
17168 LDKUnsignedChannelUpdate msg_conv;
17169 msg_conv.inner = (void*)(msg & (~1));
17170 msg_conv.is_owned = false;
17171 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17172 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
17173 return (long)ret_conv;