2 // On OSX jlong (ie long long) is not equivalent to int64_t, so we override here
4 #include "org_ldk_impl_bindings.h"
10 #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
12 // Always run a, then assert it is true:
13 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
14 // Assert a is true or do nothing
15 #define CHECK(a) DO_ASSERT(a)
17 void __attribute__((constructor)) debug_log_version() {
18 if (check_get_ldk_version() == NULL)
19 DEBUG_PRINT("LDK version did not match the header we built against\n");
20 if (check_get_ldk_bindings_version() == NULL)
21 DEBUG_PRINT("LDK C Bindings version did not match the header we built against\n");
22 DEBUG_PRINT("Loaded LDK-Java Bindings with LDK %s and LDK-C-Bindings %s\n", check_get_ldk_version(), check_get_ldk_bindings_version());
25 // Running a leak check across all the allocations and frees of the JDK is a mess,
26 // so instead we implement our own naive leak checker here, relying on the -wrap
27 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
28 // and free'd in Rust or C across the generated bindings shared library.
33 static mtx_t allocation_mtx;
35 void __attribute__((constructor)) init_mtx() {
36 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
40 typedef struct allocation {
41 struct allocation* next;
43 const char* struct_name;
46 unsigned long alloc_len;
48 static allocation* allocation_ll = NULL;
50 void* __real_malloc(size_t len);
51 void* __real_calloc(size_t nmemb, size_t len);
52 static void new_allocation(void* res, const char* struct_name, size_t len) {
53 allocation* new_alloc = __real_malloc(sizeof(allocation));
55 new_alloc->struct_name = struct_name;
56 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
57 new_alloc->alloc_len = len;
58 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
59 new_alloc->next = allocation_ll;
60 allocation_ll = new_alloc;
61 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
63 static void* MALLOC(size_t len, const char* struct_name) {
64 void* res = __real_malloc(len);
65 new_allocation(res, struct_name, len);
68 void __real_free(void* ptr);
69 static void alloc_freed(void* ptr) {
71 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
72 allocation* it = allocation_ll;
73 while (it->ptr != ptr) {
74 p = it; it = it->next;
76 DEBUG_PRINT("Tried to free unknown pointer %p at:\n", ptr);
78 int bt_len = backtrace(bt, BT_MAX);
79 backtrace_symbols_fd(bt, bt_len, STDERR_FILENO);
81 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
82 return; // addrsan should catch malloc-unknown and print more info than we have
85 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
86 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
87 DO_ASSERT(it->ptr == ptr);
90 static void FREE(void* ptr) {
91 if ((uint64_t)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
96 void* __wrap_malloc(size_t len) {
97 void* res = __real_malloc(len);
98 new_allocation(res, "malloc call", len);
101 void* __wrap_calloc(size_t nmemb, size_t len) {
102 void* res = __real_calloc(nmemb, len);
103 new_allocation(res, "calloc call", len);
106 void __wrap_free(void* ptr) {
107 if (ptr == NULL) return;
112 void* __real_realloc(void* ptr, size_t newlen);
113 void* __wrap_realloc(void* ptr, size_t len) {
114 if (ptr != NULL) alloc_freed(ptr);
115 void* res = __real_realloc(ptr, len);
116 new_allocation(res, "realloc call", len);
119 void __wrap_reallocarray(void* ptr, size_t new_sz) {
120 // Rust doesn't seem to use reallocarray currently
124 void __attribute__((destructor)) check_leaks() {
125 unsigned long alloc_count = 0;
126 unsigned long alloc_size = 0;
127 DEBUG_PRINT("The following LDK-allocated blocks still remain.\n");
128 DEBUG_PRINT("Note that this is only accurate if System.gc(); System.runFinalization()\n");
129 DEBUG_PRINT("was called prior to exit after all LDK objects were out of scope.\n");
130 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
131 DEBUG_PRINT("%s %p (%lu bytes) remains:\n", a->struct_name, a->ptr, a->alloc_len);
132 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
135 alloc_size += a->alloc_len;
137 DEBUG_PRINT("%lu allocations remained for %lu bytes.\n", alloc_count, alloc_size);
138 DEBUG_PRINT("Note that this is only accurate if System.gc(); System.runFinalization()\n");
139 DEBUG_PRINT("was called prior to exit after all LDK objects were out of scope.\n");
142 static jmethodID ordinal_meth = NULL;
143 static jmethodID slicedef_meth = NULL;
144 static jclass slicedef_cls = NULL;
145 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
146 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
147 CHECK(ordinal_meth != NULL);
148 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
149 CHECK(slicedef_meth != NULL);
150 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
151 CHECK(slicedef_cls != NULL);
154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
155 return *((bool*)ptr);
157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
158 return *((long*)ptr);
160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
163 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
164 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
165 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
168 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
169 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
170 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
171 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
174 JNIEXPORT int64_t impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
175 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
176 vec->datalen = (*env)->GetArrayLength(env, bytes);
177 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
178 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
179 return (uint64_t)vec;
181 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
182 LDKTransaction *txdata = (LDKTransaction*)ptr;
184 slice.data = txdata->data;
185 slice.datalen = txdata->datalen;
186 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (uint64_t)&slice);
188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
189 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
190 txdata->datalen = (*env)->GetArrayLength(env, bytes);
191 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
192 txdata->data_is_owned = false;
193 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
194 return (uint64_t)txdata;
196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
197 LDKTransaction *tx = (LDKTransaction*)ptr;
198 tx->data_is_owned = true;
199 Transaction_free(*tx);
202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
203 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
204 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
205 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
206 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
207 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
208 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
209 return (uint64_t)vec->datalen;
211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
212 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
213 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
214 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
215 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
216 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
217 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
220 return (uint64_t)vec;
223 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
224 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
225 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
226 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
228 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
229 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
230 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
232 typedef jlongArray int64_tArray;
233 typedef jbyteArray int8_tArray;
235 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
236 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
237 char* conv_buf = MALLOC(len + 1, "str conv buf");
238 memcpy(conv_buf, chars, len);
240 jstring ret = (*env)->NewStringUTF(env, conv_buf);
244 static inline LDKStr java_to_owned_str(JNIEnv *env, jstring str) {
245 uint64_t str_len = (*env)->GetStringUTFLength(env, str);
246 char* newchars = MALLOC(str_len + 1, "String chars");
247 const char* jchars = (*env)->GetStringUTFChars(env, str, NULL);
248 memcpy(newchars, jchars, str_len);
249 newchars[str_len] = 0;
250 (*env)->ReleaseStringUTFChars(env, str, jchars);
254 .chars_is_owned = true
259 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
260 return str_ref_to_java(env, "v0.0.99.1-7-gf7a4eb8-dirty", strlen("v0.0.99.1-7-gf7a4eb8-dirty"));
262 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
263 return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
265 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1version(JNIEnv *env, jclass _c) {
266 return str_ref_to_java(env, check_get_ldk_version(), strlen(check_get_ldk_version()));
268 static jclass arr_of_B_clz = NULL;
269 static jclass arr_of_J_clz = NULL;
270 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
271 arr_of_B_clz = (*env)->FindClass(env, "[B");
272 CHECK(arr_of_B_clz != NULL);
273 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
274 arr_of_J_clz = (*env)->FindClass(env, "[J");
275 CHECK(arr_of_J_clz != NULL);
276 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
278 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
279 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
280 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
281 case 0: return LDKAccessError_UnknownChain;
282 case 1: return LDKAccessError_UnknownTx;
286 static jclass AccessError_class = NULL;
287 static jfieldID AccessError_LDKAccessError_UnknownChain = NULL;
288 static jfieldID AccessError_LDKAccessError_UnknownTx = NULL;
289 JNIEXPORT void JNICALL Java_org_ldk_enums_AccessError_init (JNIEnv *env, jclass clz) {
290 AccessError_class = (*env)->NewGlobalRef(env, clz);
291 CHECK(AccessError_class != NULL);
292 AccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/AccessError;");
293 CHECK(AccessError_LDKAccessError_UnknownChain != NULL);
294 AccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, AccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/AccessError;");
295 CHECK(AccessError_LDKAccessError_UnknownTx != NULL);
297 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
299 case LDKAccessError_UnknownChain:
300 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownChain);
301 case LDKAccessError_UnknownTx:
302 return (*env)->GetStaticObjectField(env, AccessError_class, AccessError_LDKAccessError_UnknownTx);
307 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
308 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
309 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
310 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
314 static jclass ChannelMonitorUpdateErr_class = NULL;
315 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
316 static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
317 JNIEXPORT void JNICALL Java_org_ldk_enums_ChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
318 ChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
319 CHECK(ChannelMonitorUpdateErr_class != NULL);
320 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
321 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
322 ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, ChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/ChannelMonitorUpdateErr;");
323 CHECK(ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
325 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
327 case LDKChannelMonitorUpdateErr_TemporaryFailure:
328 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
329 case LDKChannelMonitorUpdateErr_PermanentFailure:
330 return (*env)->GetStaticObjectField(env, ChannelMonitorUpdateErr_class, ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
335 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
336 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
337 case 0: return LDKConfirmationTarget_Background;
338 case 1: return LDKConfirmationTarget_Normal;
339 case 2: return LDKConfirmationTarget_HighPriority;
343 static jclass ConfirmationTarget_class = NULL;
344 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL;
345 static jfieldID ConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
346 static jfieldID ConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
347 JNIEXPORT void JNICALL Java_org_ldk_enums_ConfirmationTarget_init (JNIEnv *env, jclass clz) {
348 ConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
349 CHECK(ConfirmationTarget_class != NULL);
350 ConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/ConfirmationTarget;");
351 CHECK(ConfirmationTarget_LDKConfirmationTarget_Background != NULL);
352 ConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/ConfirmationTarget;");
353 CHECK(ConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
354 ConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, ConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/ConfirmationTarget;");
355 CHECK(ConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
357 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
359 case LDKConfirmationTarget_Background:
360 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Background);
361 case LDKConfirmationTarget_Normal:
362 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_Normal);
363 case LDKConfirmationTarget_HighPriority:
364 return (*env)->GetStaticObjectField(env, ConfirmationTarget_class, ConfirmationTarget_LDKConfirmationTarget_HighPriority);
369 static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) {
370 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
371 case 0: return LDKCreationError_DescriptionTooLong;
372 case 1: return LDKCreationError_RouteTooLong;
373 case 2: return LDKCreationError_TimestampOutOfBounds;
374 case 3: return LDKCreationError_ExpiryTimeOutOfBounds;
378 static jclass CreationError_class = NULL;
379 static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL;
380 static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL;
381 static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL;
382 static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL;
383 JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) {
384 CreationError_class = (*env)->NewGlobalRef(env, clz);
385 CHECK(CreationError_class != NULL);
386 CreationError_LDKCreationError_DescriptionTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_DescriptionTooLong", "Lorg/ldk/enums/CreationError;");
387 CHECK(CreationError_LDKCreationError_DescriptionTooLong != NULL);
388 CreationError_LDKCreationError_RouteTooLong = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_RouteTooLong", "Lorg/ldk/enums/CreationError;");
389 CHECK(CreationError_LDKCreationError_RouteTooLong != NULL);
390 CreationError_LDKCreationError_TimestampOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_TimestampOutOfBounds", "Lorg/ldk/enums/CreationError;");
391 CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL);
392 CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;");
393 CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL);
395 static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) {
397 case LDKCreationError_DescriptionTooLong:
398 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_DescriptionTooLong);
399 case LDKCreationError_RouteTooLong:
400 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_RouteTooLong);
401 case LDKCreationError_TimestampOutOfBounds:
402 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds);
403 case LDKCreationError_ExpiryTimeOutOfBounds:
404 return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds);
409 static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) {
410 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
411 case 0: return LDKCurrency_Bitcoin;
412 case 1: return LDKCurrency_BitcoinTestnet;
413 case 2: return LDKCurrency_Regtest;
414 case 3: return LDKCurrency_Simnet;
415 case 4: return LDKCurrency_Signet;
419 static jclass Currency_class = NULL;
420 static jfieldID Currency_LDKCurrency_Bitcoin = NULL;
421 static jfieldID Currency_LDKCurrency_BitcoinTestnet = NULL;
422 static jfieldID Currency_LDKCurrency_Regtest = NULL;
423 static jfieldID Currency_LDKCurrency_Simnet = NULL;
424 static jfieldID Currency_LDKCurrency_Signet = NULL;
425 JNIEXPORT void JNICALL Java_org_ldk_enums_Currency_init (JNIEnv *env, jclass clz) {
426 Currency_class = (*env)->NewGlobalRef(env, clz);
427 CHECK(Currency_class != NULL);
428 Currency_LDKCurrency_Bitcoin = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Bitcoin", "Lorg/ldk/enums/Currency;");
429 CHECK(Currency_LDKCurrency_Bitcoin != NULL);
430 Currency_LDKCurrency_BitcoinTestnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_BitcoinTestnet", "Lorg/ldk/enums/Currency;");
431 CHECK(Currency_LDKCurrency_BitcoinTestnet != NULL);
432 Currency_LDKCurrency_Regtest = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Regtest", "Lorg/ldk/enums/Currency;");
433 CHECK(Currency_LDKCurrency_Regtest != NULL);
434 Currency_LDKCurrency_Simnet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Simnet", "Lorg/ldk/enums/Currency;");
435 CHECK(Currency_LDKCurrency_Simnet != NULL);
436 Currency_LDKCurrency_Signet = (*env)->GetStaticFieldID(env, Currency_class, "LDKCurrency_Signet", "Lorg/ldk/enums/Currency;");
437 CHECK(Currency_LDKCurrency_Signet != NULL);
439 static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) {
441 case LDKCurrency_Bitcoin:
442 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Bitcoin);
443 case LDKCurrency_BitcoinTestnet:
444 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_BitcoinTestnet);
445 case LDKCurrency_Regtest:
446 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Regtest);
447 case LDKCurrency_Simnet:
448 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Simnet);
449 case LDKCurrency_Signet:
450 return (*env)->GetStaticObjectField(env, Currency_class, Currency_LDKCurrency_Signet);
455 static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) {
456 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
457 case 0: return LDKIOError_NotFound;
458 case 1: return LDKIOError_PermissionDenied;
459 case 2: return LDKIOError_ConnectionRefused;
460 case 3: return LDKIOError_ConnectionReset;
461 case 4: return LDKIOError_ConnectionAborted;
462 case 5: return LDKIOError_NotConnected;
463 case 6: return LDKIOError_AddrInUse;
464 case 7: return LDKIOError_AddrNotAvailable;
465 case 8: return LDKIOError_BrokenPipe;
466 case 9: return LDKIOError_AlreadyExists;
467 case 10: return LDKIOError_WouldBlock;
468 case 11: return LDKIOError_InvalidInput;
469 case 12: return LDKIOError_InvalidData;
470 case 13: return LDKIOError_TimedOut;
471 case 14: return LDKIOError_WriteZero;
472 case 15: return LDKIOError_Interrupted;
473 case 16: return LDKIOError_Other;
474 case 17: return LDKIOError_UnexpectedEof;
478 static jclass IOError_class = NULL;
479 static jfieldID IOError_LDKIOError_NotFound = NULL;
480 static jfieldID IOError_LDKIOError_PermissionDenied = NULL;
481 static jfieldID IOError_LDKIOError_ConnectionRefused = NULL;
482 static jfieldID IOError_LDKIOError_ConnectionReset = NULL;
483 static jfieldID IOError_LDKIOError_ConnectionAborted = NULL;
484 static jfieldID IOError_LDKIOError_NotConnected = NULL;
485 static jfieldID IOError_LDKIOError_AddrInUse = NULL;
486 static jfieldID IOError_LDKIOError_AddrNotAvailable = NULL;
487 static jfieldID IOError_LDKIOError_BrokenPipe = NULL;
488 static jfieldID IOError_LDKIOError_AlreadyExists = NULL;
489 static jfieldID IOError_LDKIOError_WouldBlock = NULL;
490 static jfieldID IOError_LDKIOError_InvalidInput = NULL;
491 static jfieldID IOError_LDKIOError_InvalidData = NULL;
492 static jfieldID IOError_LDKIOError_TimedOut = NULL;
493 static jfieldID IOError_LDKIOError_WriteZero = NULL;
494 static jfieldID IOError_LDKIOError_Interrupted = NULL;
495 static jfieldID IOError_LDKIOError_Other = NULL;
496 static jfieldID IOError_LDKIOError_UnexpectedEof = NULL;
497 JNIEXPORT void JNICALL Java_org_ldk_enums_IOError_init (JNIEnv *env, jclass clz) {
498 IOError_class = (*env)->NewGlobalRef(env, clz);
499 CHECK(IOError_class != NULL);
500 IOError_LDKIOError_NotFound = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotFound", "Lorg/ldk/enums/IOError;");
501 CHECK(IOError_LDKIOError_NotFound != NULL);
502 IOError_LDKIOError_PermissionDenied = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_PermissionDenied", "Lorg/ldk/enums/IOError;");
503 CHECK(IOError_LDKIOError_PermissionDenied != NULL);
504 IOError_LDKIOError_ConnectionRefused = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionRefused", "Lorg/ldk/enums/IOError;");
505 CHECK(IOError_LDKIOError_ConnectionRefused != NULL);
506 IOError_LDKIOError_ConnectionReset = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionReset", "Lorg/ldk/enums/IOError;");
507 CHECK(IOError_LDKIOError_ConnectionReset != NULL);
508 IOError_LDKIOError_ConnectionAborted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_ConnectionAborted", "Lorg/ldk/enums/IOError;");
509 CHECK(IOError_LDKIOError_ConnectionAborted != NULL);
510 IOError_LDKIOError_NotConnected = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_NotConnected", "Lorg/ldk/enums/IOError;");
511 CHECK(IOError_LDKIOError_NotConnected != NULL);
512 IOError_LDKIOError_AddrInUse = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrInUse", "Lorg/ldk/enums/IOError;");
513 CHECK(IOError_LDKIOError_AddrInUse != NULL);
514 IOError_LDKIOError_AddrNotAvailable = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AddrNotAvailable", "Lorg/ldk/enums/IOError;");
515 CHECK(IOError_LDKIOError_AddrNotAvailable != NULL);
516 IOError_LDKIOError_BrokenPipe = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_BrokenPipe", "Lorg/ldk/enums/IOError;");
517 CHECK(IOError_LDKIOError_BrokenPipe != NULL);
518 IOError_LDKIOError_AlreadyExists = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_AlreadyExists", "Lorg/ldk/enums/IOError;");
519 CHECK(IOError_LDKIOError_AlreadyExists != NULL);
520 IOError_LDKIOError_WouldBlock = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WouldBlock", "Lorg/ldk/enums/IOError;");
521 CHECK(IOError_LDKIOError_WouldBlock != NULL);
522 IOError_LDKIOError_InvalidInput = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidInput", "Lorg/ldk/enums/IOError;");
523 CHECK(IOError_LDKIOError_InvalidInput != NULL);
524 IOError_LDKIOError_InvalidData = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_InvalidData", "Lorg/ldk/enums/IOError;");
525 CHECK(IOError_LDKIOError_InvalidData != NULL);
526 IOError_LDKIOError_TimedOut = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_TimedOut", "Lorg/ldk/enums/IOError;");
527 CHECK(IOError_LDKIOError_TimedOut != NULL);
528 IOError_LDKIOError_WriteZero = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_WriteZero", "Lorg/ldk/enums/IOError;");
529 CHECK(IOError_LDKIOError_WriteZero != NULL);
530 IOError_LDKIOError_Interrupted = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Interrupted", "Lorg/ldk/enums/IOError;");
531 CHECK(IOError_LDKIOError_Interrupted != NULL);
532 IOError_LDKIOError_Other = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_Other", "Lorg/ldk/enums/IOError;");
533 CHECK(IOError_LDKIOError_Other != NULL);
534 IOError_LDKIOError_UnexpectedEof = (*env)->GetStaticFieldID(env, IOError_class, "LDKIOError_UnexpectedEof", "Lorg/ldk/enums/IOError;");
535 CHECK(IOError_LDKIOError_UnexpectedEof != NULL);
537 static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) {
539 case LDKIOError_NotFound:
540 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotFound);
541 case LDKIOError_PermissionDenied:
542 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_PermissionDenied);
543 case LDKIOError_ConnectionRefused:
544 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionRefused);
545 case LDKIOError_ConnectionReset:
546 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionReset);
547 case LDKIOError_ConnectionAborted:
548 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_ConnectionAborted);
549 case LDKIOError_NotConnected:
550 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_NotConnected);
551 case LDKIOError_AddrInUse:
552 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrInUse);
553 case LDKIOError_AddrNotAvailable:
554 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AddrNotAvailable);
555 case LDKIOError_BrokenPipe:
556 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_BrokenPipe);
557 case LDKIOError_AlreadyExists:
558 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_AlreadyExists);
559 case LDKIOError_WouldBlock:
560 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WouldBlock);
561 case LDKIOError_InvalidInput:
562 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidInput);
563 case LDKIOError_InvalidData:
564 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_InvalidData);
565 case LDKIOError_TimedOut:
566 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_TimedOut);
567 case LDKIOError_WriteZero:
568 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_WriteZero);
569 case LDKIOError_Interrupted:
570 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Interrupted);
571 case LDKIOError_Other:
572 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_Other);
573 case LDKIOError_UnexpectedEof:
574 return (*env)->GetStaticObjectField(env, IOError_class, IOError_LDKIOError_UnexpectedEof);
579 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
580 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
581 case 0: return LDKLevel_Trace;
582 case 1: return LDKLevel_Debug;
583 case 2: return LDKLevel_Info;
584 case 3: return LDKLevel_Warn;
585 case 4: return LDKLevel_Error;
589 static jclass Level_class = NULL;
590 static jfieldID Level_LDKLevel_Trace = NULL;
591 static jfieldID Level_LDKLevel_Debug = NULL;
592 static jfieldID Level_LDKLevel_Info = NULL;
593 static jfieldID Level_LDKLevel_Warn = NULL;
594 static jfieldID Level_LDKLevel_Error = NULL;
595 JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) {
596 Level_class = (*env)->NewGlobalRef(env, clz);
597 CHECK(Level_class != NULL);
598 Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;");
599 CHECK(Level_LDKLevel_Trace != NULL);
600 Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;");
601 CHECK(Level_LDKLevel_Debug != NULL);
602 Level_LDKLevel_Info = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Info", "Lorg/ldk/enums/Level;");
603 CHECK(Level_LDKLevel_Info != NULL);
604 Level_LDKLevel_Warn = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Warn", "Lorg/ldk/enums/Level;");
605 CHECK(Level_LDKLevel_Warn != NULL);
606 Level_LDKLevel_Error = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Error", "Lorg/ldk/enums/Level;");
607 CHECK(Level_LDKLevel_Error != NULL);
609 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
612 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace);
614 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Debug);
616 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Info);
618 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Warn);
620 return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Error);
625 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
626 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
627 case 0: return LDKNetwork_Bitcoin;
628 case 1: return LDKNetwork_Testnet;
629 case 2: return LDKNetwork_Regtest;
630 case 3: return LDKNetwork_Signet;
634 static jclass Network_class = NULL;
635 static jfieldID Network_LDKNetwork_Bitcoin = NULL;
636 static jfieldID Network_LDKNetwork_Testnet = NULL;
637 static jfieldID Network_LDKNetwork_Regtest = NULL;
638 static jfieldID Network_LDKNetwork_Signet = NULL;
639 JNIEXPORT void JNICALL Java_org_ldk_enums_Network_init (JNIEnv *env, jclass clz) {
640 Network_class = (*env)->NewGlobalRef(env, clz);
641 CHECK(Network_class != NULL);
642 Network_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/Network;");
643 CHECK(Network_LDKNetwork_Bitcoin != NULL);
644 Network_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/Network;");
645 CHECK(Network_LDKNetwork_Testnet != NULL);
646 Network_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/Network;");
647 CHECK(Network_LDKNetwork_Regtest != NULL);
648 Network_LDKNetwork_Signet = (*env)->GetStaticFieldID(env, Network_class, "LDKNetwork_Signet", "Lorg/ldk/enums/Network;");
649 CHECK(Network_LDKNetwork_Signet != NULL);
651 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
653 case LDKNetwork_Bitcoin:
654 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Bitcoin);
655 case LDKNetwork_Testnet:
656 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Testnet);
657 case LDKNetwork_Regtest:
658 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Regtest);
659 case LDKNetwork_Signet:
660 return (*env)->GetStaticObjectField(env, Network_class, Network_LDKNetwork_Signet);
665 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
666 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
667 case 0: return LDKSecp256k1Error_IncorrectSignature;
668 case 1: return LDKSecp256k1Error_InvalidMessage;
669 case 2: return LDKSecp256k1Error_InvalidPublicKey;
670 case 3: return LDKSecp256k1Error_InvalidSignature;
671 case 4: return LDKSecp256k1Error_InvalidSecretKey;
672 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
673 case 6: return LDKSecp256k1Error_InvalidTweak;
674 case 7: return LDKSecp256k1Error_TweakCheckFailed;
675 case 8: return LDKSecp256k1Error_NotEnoughMemory;
679 static jclass Secp256k1Error_class = NULL;
680 static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
681 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
682 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
683 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
684 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
685 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
686 static jfieldID Secp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
687 static jfieldID Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
688 static jfieldID Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
689 JNIEXPORT void JNICALL Java_org_ldk_enums_Secp256k1Error_init (JNIEnv *env, jclass clz) {
690 Secp256k1Error_class = (*env)->NewGlobalRef(env, clz);
691 CHECK(Secp256k1Error_class != NULL);
692 Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/Secp256k1Error;");
693 CHECK(Secp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
694 Secp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/Secp256k1Error;");
695 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
696 Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/Secp256k1Error;");
697 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
698 Secp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/Secp256k1Error;");
699 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
700 Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/Secp256k1Error;");
701 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
702 Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/Secp256k1Error;");
703 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
704 Secp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/Secp256k1Error;");
705 CHECK(Secp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
706 Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/Secp256k1Error;");
707 CHECK(Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
708 Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, Secp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/Secp256k1Error;");
709 CHECK(Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
711 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
713 case LDKSecp256k1Error_IncorrectSignature:
714 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_IncorrectSignature);
715 case LDKSecp256k1Error_InvalidMessage:
716 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidMessage);
717 case LDKSecp256k1Error_InvalidPublicKey:
718 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
719 case LDKSecp256k1Error_InvalidSignature:
720 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSignature);
721 case LDKSecp256k1Error_InvalidSecretKey:
722 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
723 case LDKSecp256k1Error_InvalidRecoveryId:
724 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
725 case LDKSecp256k1Error_InvalidTweak:
726 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_InvalidTweak);
727 case LDKSecp256k1Error_TweakCheckFailed:
728 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
729 case LDKSecp256k1Error_NotEnoughMemory:
730 return (*env)->GetStaticObjectField(env, Secp256k1Error_class, Secp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
735 static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) {
736 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
737 case 0: return LDKSemanticError_NoPaymentHash;
738 case 1: return LDKSemanticError_MultiplePaymentHashes;
739 case 2: return LDKSemanticError_NoDescription;
740 case 3: return LDKSemanticError_MultipleDescriptions;
741 case 4: return LDKSemanticError_MultiplePaymentSecrets;
742 case 5: return LDKSemanticError_InvalidFeatures;
743 case 6: return LDKSemanticError_InvalidRecoveryId;
744 case 7: return LDKSemanticError_InvalidSignature;
748 static jclass SemanticError_class = NULL;
749 static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL;
750 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
751 static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
752 static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
753 static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
754 static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
755 static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
756 static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
757 JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
758 SemanticError_class = (*env)->NewGlobalRef(env, clz);
759 CHECK(SemanticError_class != NULL);
760 SemanticError_LDKSemanticError_NoPaymentHash = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentHash", "Lorg/ldk/enums/SemanticError;");
761 CHECK(SemanticError_LDKSemanticError_NoPaymentHash != NULL);
762 SemanticError_LDKSemanticError_MultiplePaymentHashes = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentHashes", "Lorg/ldk/enums/SemanticError;");
763 CHECK(SemanticError_LDKSemanticError_MultiplePaymentHashes != NULL);
764 SemanticError_LDKSemanticError_NoDescription = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoDescription", "Lorg/ldk/enums/SemanticError;");
765 CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
766 SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
767 CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
768 SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
769 CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
770 SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
771 CHECK(SemanticError_LDKSemanticError_InvalidFeatures != NULL);
772 SemanticError_LDKSemanticError_InvalidRecoveryId = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidRecoveryId", "Lorg/ldk/enums/SemanticError;");
773 CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
774 SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
775 CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
777 static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
779 case LDKSemanticError_NoPaymentHash:
780 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentHash);
781 case LDKSemanticError_MultiplePaymentHashes:
782 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentHashes);
783 case LDKSemanticError_NoDescription:
784 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
785 case LDKSemanticError_MultipleDescriptions:
786 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
787 case LDKSemanticError_MultiplePaymentSecrets:
788 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
789 case LDKSemanticError_InvalidFeatures:
790 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidFeatures);
791 case LDKSemanticError_InvalidRecoveryId:
792 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
793 case LDKSemanticError_InvalidSignature:
794 return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
799 static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) {
800 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
801 case 0: return LDKSiPrefix_Milli;
802 case 1: return LDKSiPrefix_Micro;
803 case 2: return LDKSiPrefix_Nano;
804 case 3: return LDKSiPrefix_Pico;
808 static jclass SiPrefix_class = NULL;
809 static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL;
810 static jfieldID SiPrefix_LDKSiPrefix_Micro = NULL;
811 static jfieldID SiPrefix_LDKSiPrefix_Nano = NULL;
812 static jfieldID SiPrefix_LDKSiPrefix_Pico = NULL;
813 JNIEXPORT void JNICALL Java_org_ldk_enums_SiPrefix_init (JNIEnv *env, jclass clz) {
814 SiPrefix_class = (*env)->NewGlobalRef(env, clz);
815 CHECK(SiPrefix_class != NULL);
816 SiPrefix_LDKSiPrefix_Milli = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Milli", "Lorg/ldk/enums/SiPrefix;");
817 CHECK(SiPrefix_LDKSiPrefix_Milli != NULL);
818 SiPrefix_LDKSiPrefix_Micro = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Micro", "Lorg/ldk/enums/SiPrefix;");
819 CHECK(SiPrefix_LDKSiPrefix_Micro != NULL);
820 SiPrefix_LDKSiPrefix_Nano = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Nano", "Lorg/ldk/enums/SiPrefix;");
821 CHECK(SiPrefix_LDKSiPrefix_Nano != NULL);
822 SiPrefix_LDKSiPrefix_Pico = (*env)->GetStaticFieldID(env, SiPrefix_class, "LDKSiPrefix_Pico", "Lorg/ldk/enums/SiPrefix;");
823 CHECK(SiPrefix_LDKSiPrefix_Pico != NULL);
825 static inline jclass LDKSiPrefix_to_java(JNIEnv *env, LDKSiPrefix val) {
827 case LDKSiPrefix_Milli:
828 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Milli);
829 case LDKSiPrefix_Micro:
830 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Micro);
831 case LDKSiPrefix_Nano:
832 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Nano);
833 case LDKSiPrefix_Pico:
834 return (*env)->GetStaticObjectField(env, SiPrefix_class, SiPrefix_LDKSiPrefix_Pico);
839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
840 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
841 ret->datalen = (*env)->GetArrayLength(env, elems);
842 if (ret->datalen == 0) {
845 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
846 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
847 for (size_t i = 0; i < ret->datalen; i++) {
848 ret->data[i] = java_elems[i];
850 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
852 return (uint64_t)ret;
854 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
855 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
856 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
859 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
860 return ((LDKCResult_SecretKeyErrorZ*)arg)->result_ok;
862 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
863 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
864 CHECK(val->result_ok);
865 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
866 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
869 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
870 LDKCResult_SecretKeyErrorZ *val = (LDKCResult_SecretKeyErrorZ*)(arg & ~1);
871 CHECK(!val->result_ok);
872 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
876 return ((LDKCResult_PublicKeyErrorZ*)arg)->result_ok;
878 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
879 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
880 CHECK(val->result_ok);
881 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
882 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
885 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
886 LDKCResult_PublicKeyErrorZ *val = (LDKCResult_PublicKeyErrorZ*)(arg & ~1);
887 CHECK(!val->result_ok);
888 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
891 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
892 return ((LDKCResult_TxCreationKeysDecodeErrorZ*)arg)->result_ok;
894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
895 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
896 CHECK(val->result_ok);
897 LDKTxCreationKeys res_var = (*val->contents.result);
898 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
899 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
900 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
904 LDKCResult_TxCreationKeysDecodeErrorZ *val = (LDKCResult_TxCreationKeysDecodeErrorZ*)(arg & ~1);
905 CHECK(!val->result_ok);
906 LDKDecodeError err_var = (*val->contents.err);
907 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
908 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
909 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
912 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
913 return ((LDKCResult_ChannelPublicKeysDecodeErrorZ*)arg)->result_ok;
915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
916 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
917 CHECK(val->result_ok);
918 LDKChannelPublicKeys res_var = (*val->contents.result);
919 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
920 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
921 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelPublicKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
925 LDKCResult_ChannelPublicKeysDecodeErrorZ *val = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(arg & ~1);
926 CHECK(!val->result_ok);
927 LDKDecodeError err_var = (*val->contents.err);
928 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
929 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
930 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
934 return ((LDKCResult_TxCreationKeysErrorZ*)arg)->result_ok;
936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
937 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
938 CHECK(val->result_ok);
939 LDKTxCreationKeys res_var = (*val->contents.result);
940 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
941 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
942 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
945 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
946 LDKCResult_TxCreationKeysErrorZ *val = (LDKCResult_TxCreationKeysErrorZ*)(arg & ~1);
947 CHECK(!val->result_ok);
948 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
951 static jclass LDKCOption_u32Z_Some_class = NULL;
952 static jmethodID LDKCOption_u32Z_Some_meth = NULL;
953 static jclass LDKCOption_u32Z_None_class = NULL;
954 static jmethodID LDKCOption_u32Z_None_meth = NULL;
955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) {
956 LDKCOption_u32Z_Some_class =
957 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;"));
958 CHECK(LDKCOption_u32Z_Some_class != NULL);
959 LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "<init>", "(I)V");
960 CHECK(LDKCOption_u32Z_Some_meth != NULL);
961 LDKCOption_u32Z_None_class =
962 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;"));
963 CHECK(LDKCOption_u32Z_None_class != NULL);
964 LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "<init>", "()V");
965 CHECK(LDKCOption_u32Z_None_meth != NULL);
967 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u32Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
968 LDKCOption_u32Z *obj = (LDKCOption_u32Z*)(ptr & ~1);
970 case LDKCOption_u32Z_Some: {
971 return (*env)->NewObject(env, LDKCOption_u32Z_Some_class, LDKCOption_u32Z_Some_meth, obj->some);
973 case LDKCOption_u32Z_None: {
974 return (*env)->NewObject(env, LDKCOption_u32Z_None_class, LDKCOption_u32Z_None_meth);
979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
980 return ((LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)arg)->result_ok;
982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
983 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
984 CHECK(val->result_ok);
985 LDKHTLCOutputInCommitment res_var = (*val->contents.result);
986 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
987 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
988 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCOutputInCommitmentDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
992 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *val = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(arg & ~1);
993 CHECK(!val->result_ok);
994 LDKDecodeError err_var = (*val->contents.err);
995 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
996 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
997 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1000 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1001 return ((LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
1003 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1004 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
1005 CHECK(val->result_ok);
1006 LDKCounterpartyChannelTransactionParameters res_var = (*val->contents.result);
1007 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1008 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1009 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1012 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1013 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
1014 CHECK(!val->result_ok);
1015 LDKDecodeError err_var = (*val->contents.err);
1016 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1017 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1018 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1022 return ((LDKCResult_ChannelTransactionParametersDecodeErrorZ*)arg)->result_ok;
1024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1025 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
1026 CHECK(val->result_ok);
1027 LDKChannelTransactionParameters res_var = (*val->contents.result);
1028 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1029 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1030 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTransactionParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1034 LDKCResult_ChannelTransactionParametersDecodeErrorZ *val = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(arg & ~1);
1035 CHECK(!val->result_ok);
1036 LDKDecodeError err_var = (*val->contents.err);
1037 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1038 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1039 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1043 return ((LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1046 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1047 CHECK(val->result_ok);
1048 LDKHolderCommitmentTransaction res_var = (*val->contents.result);
1049 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1050 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1051 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HolderCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1055 LDKCResult_HolderCommitmentTransactionDecodeErrorZ *val = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1056 CHECK(!val->result_ok);
1057 LDKDecodeError err_var = (*val->contents.err);
1058 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1059 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1060 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1063 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1064 return ((LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1067 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1068 CHECK(val->result_ok);
1069 LDKBuiltCommitmentTransaction res_var = (*val->contents.result);
1070 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1071 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1072 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1076 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *val = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(arg & ~1);
1077 CHECK(!val->result_ok);
1078 LDKDecodeError err_var = (*val->contents.err);
1079 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1080 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1081 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1084 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1085 return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
1087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1088 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1089 CHECK(val->result_ok);
1090 LDKCommitmentTransaction res_var = (*val->contents.result);
1091 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1092 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1093 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1097 LDKCResult_CommitmentTransactionDecodeErrorZ *val = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(arg & ~1);
1098 CHECK(!val->result_ok);
1099 LDKDecodeError err_var = (*val->contents.err);
1100 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1101 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1102 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1105 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1106 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
1108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1109 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1110 CHECK(val->result_ok);
1111 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
1112 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1113 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1114 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1118 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)(arg & ~1);
1119 CHECK(!val->result_ok);
1120 return *val->contents.err;
1122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1123 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1125 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1126 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1127 CHECK(val->result_ok);
1128 LDKCVec_SignatureZ res_var = (*val->contents.result);
1129 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1131 for (size_t i = 0; i < res_var.datalen; i++) {
1132 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, 64);
1133 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1134 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
1138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1139 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)(arg & ~1);
1140 CHECK(!val->result_ok);
1141 return *val->contents.err;
1143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1144 return ((LDKCResult_NoneErrorZ*)arg)->result_ok;
1146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1147 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1148 CHECK(val->result_ok);
1149 return *val->contents.result;
1151 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1152 LDKCResult_NoneErrorZ *val = (LDKCResult_NoneErrorZ*)(arg & ~1);
1153 CHECK(!val->result_ok);
1154 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
1157 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1158 return ((LDKCResult_RouteHopDecodeErrorZ*)arg)->result_ok;
1160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1161 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1162 CHECK(val->result_ok);
1163 LDKRouteHop res_var = (*val->contents.result);
1164 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1165 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1166 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteHopDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1170 LDKCResult_RouteHopDecodeErrorZ *val = (LDKCResult_RouteHopDecodeErrorZ*)(arg & ~1);
1171 CHECK(!val->result_ok);
1172 LDKDecodeError err_var = (*val->contents.err);
1173 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1174 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1175 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1179 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
1180 ret->datalen = (*env)->GetArrayLength(env, elems);
1181 if (ret->datalen == 0) {
1184 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
1185 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1186 for (size_t i = 0; i < ret->datalen; i++) {
1187 int64_t arr_elem = java_elems[i];
1188 LDKRouteHop arr_elem_conv;
1189 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1190 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1191 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
1192 ret->data[i] = arr_elem_conv;
1194 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1196 return (uint64_t)ret;
1198 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
1199 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
1200 for (size_t i = 0; i < ret.datalen; i++) {
1201 ret.data[i] = RouteHop_clone(&orig->data[i]);
1205 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
1206 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
1207 for (size_t i = 0; i < ret.datalen; i++) {
1208 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
1212 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1213 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
1215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1216 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1217 CHECK(val->result_ok);
1218 LDKRoute res_var = (*val->contents.result);
1219 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1220 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1221 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1225 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)(arg & ~1);
1226 CHECK(!val->result_ok);
1227 LDKDecodeError err_var = (*val->contents.err);
1228 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1229 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1230 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1233 static jclass LDKCOption_u64Z_Some_class = NULL;
1234 static jmethodID LDKCOption_u64Z_Some_meth = NULL;
1235 static jclass LDKCOption_u64Z_None_class = NULL;
1236 static jmethodID LDKCOption_u64Z_None_meth = NULL;
1237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) {
1238 LDKCOption_u64Z_Some_class =
1239 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;"));
1240 CHECK(LDKCOption_u64Z_Some_class != NULL);
1241 LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "<init>", "(J)V");
1242 CHECK(LDKCOption_u64Z_Some_meth != NULL);
1243 LDKCOption_u64Z_None_class =
1244 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;"));
1245 CHECK(LDKCOption_u64Z_None_class != NULL);
1246 LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "<init>", "()V");
1247 CHECK(LDKCOption_u64Z_None_meth != NULL);
1249 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u64Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1250 LDKCOption_u64Z *obj = (LDKCOption_u64Z*)(ptr & ~1);
1252 case LDKCOption_u64Z_Some: {
1253 return (*env)->NewObject(env, LDKCOption_u64Z_Some_class, LDKCOption_u64Z_Some_meth, obj->some);
1255 case LDKCOption_u64Z_None: {
1256 return (*env)->NewObject(env, LDKCOption_u64Z_None_class, LDKCOption_u64Z_None_meth);
1261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1262 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
1263 ret->datalen = (*env)->GetArrayLength(env, elems);
1264 if (ret->datalen == 0) {
1267 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
1268 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1269 for (size_t i = 0; i < ret->datalen; i++) {
1270 int64_t arr_elem = java_elems[i];
1271 LDKChannelDetails arr_elem_conv;
1272 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1273 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1274 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
1275 ret->data[i] = arr_elem_conv;
1277 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1279 return (uint64_t)ret;
1281 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
1282 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
1283 for (size_t i = 0; i < ret.datalen; i++) {
1284 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
1288 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1289 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
1290 ret->datalen = (*env)->GetArrayLength(env, elems);
1291 if (ret->datalen == 0) {
1294 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
1295 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1296 for (size_t i = 0; i < ret->datalen; i++) {
1297 int64_t arr_elem = java_elems[i];
1298 LDKRouteHint arr_elem_conv;
1299 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1300 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1301 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
1302 ret->data[i] = arr_elem_conv;
1304 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1306 return (uint64_t)ret;
1308 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
1309 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
1310 for (size_t i = 0; i < ret.datalen; i++) {
1311 ret.data[i] = RouteHint_clone(&orig->data[i]);
1315 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1316 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
1318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1319 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1320 CHECK(val->result_ok);
1321 LDKRoute res_var = (*val->contents.result);
1322 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1323 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1324 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
1327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1328 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)(arg & ~1);
1329 CHECK(!val->result_ok);
1330 LDKLightningError err_var = (*val->contents.err);
1331 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1332 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1333 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
1336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1337 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1340 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1341 CHECK(val->result_ok);
1342 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
1343 return (uint64_t)res_ref;
1345 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1346 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)(arg & ~1);
1347 CHECK(!val->result_ok);
1348 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
1351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1352 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1354 LDKTransaction b_ref;
1355 b_ref.datalen = (*env)->GetArrayLength(env, b);
1356 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1357 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1358 b_ref.data_is_owned = false;
1360 return (uint64_t)ret;
1362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1363 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1367 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)(ptr & ~1);
1368 LDKTransaction b_var = tuple->b;
1369 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1370 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1373 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1374 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1375 ret->datalen = (*env)->GetArrayLength(env, elems);
1376 if (ret->datalen == 0) {
1379 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1380 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1381 for (size_t i = 0; i < ret->datalen; i++) {
1382 int64_t arr_elem = java_elems[i];
1383 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1);
1384 arr_elem_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)arr_elem) & ~1));
1385 ret->data[i] = arr_elem_conv;
1387 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1389 return (uint64_t)ret;
1391 static inline LDKCVec_C2Tuple_usizeTransactionZZ CVec_C2Tuple_usizeTransactionZZ_clone(const LDKCVec_C2Tuple_usizeTransactionZZ *orig) {
1392 LDKCVec_C2Tuple_usizeTransactionZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * orig->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ clone bytes"), .datalen = orig->datalen };
1393 for (size_t i = 0; i < ret.datalen; i++) {
1394 ret.data[i] = C2Tuple_usizeTransactionZ_clone(&orig->data[i]);
1398 static inline LDKCVec_TxidZ CVec_ThirtyTwoBytesZ_clone(const LDKCVec_TxidZ *orig) {
1399 LDKCVec_TxidZ ret = { .data = MALLOC(sizeof(LDKThirtyTwoBytes) * orig->datalen, "LDKCVec_TxidZ clone bytes"), .datalen = orig->datalen };
1400 for (size_t i = 0; i < ret.datalen; i++) {
1401 ret.data[i] = ThirtyTwoBytes_clone(&orig->data[i]);
1405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1406 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1409 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1410 CHECK(val->result_ok);
1411 return *val->contents.result;
1413 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1414 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(arg & ~1);
1415 CHECK(!val->result_ok);
1416 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1419 static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
1420 static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
1421 static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
1422 static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
1423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
1424 LDKMonitorEvent_HTLCEvent_class =
1425 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
1426 CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
1427 LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
1428 CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
1429 LDKMonitorEvent_CommitmentTxBroadcasted_class =
1430 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
1431 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
1432 LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
1433 CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
1435 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1436 LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
1438 case LDKMonitorEvent_HTLCEvent: {
1439 LDKHTLCUpdate htlc_event_var = obj->htlc_event;
1440 CHECK((((uint64_t)htlc_event_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1441 CHECK((((uint64_t)&htlc_event_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1442 uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
1443 return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
1445 case LDKMonitorEvent_CommitmentTxBroadcasted: {
1446 LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
1447 CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1448 CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1449 uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
1450 return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
1455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1456 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1457 ret->datalen = (*env)->GetArrayLength(env, elems);
1458 if (ret->datalen == 0) {
1461 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1462 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1463 for (size_t i = 0; i < ret->datalen; i++) {
1464 int64_t arr_elem = java_elems[i];
1465 LDKMonitorEvent arr_elem_conv = *(LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1);
1466 arr_elem_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)arr_elem) & ~1));
1467 ret->data[i] = arr_elem_conv;
1469 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1471 return (uint64_t)ret;
1473 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1474 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1475 for (size_t i = 0; i < ret.datalen; i++) {
1476 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1480 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = NULL;
1481 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = NULL;
1482 static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL;
1483 static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL;
1484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) {
1485 LDKCOption_C2Tuple_usizeTransactionZZ_Some_class =
1486 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;"));
1487 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL);
1488 LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "<init>", "(J)V");
1489 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL);
1490 LDKCOption_C2Tuple_usizeTransactionZZ_None_class =
1491 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;"));
1492 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL);
1493 LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "<init>", "()V");
1494 CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL);
1496 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1497 LDKCOption_C2Tuple_usizeTransactionZZ *obj = (LDKCOption_C2Tuple_usizeTransactionZZ*)(ptr & ~1);
1499 case LDKCOption_C2Tuple_usizeTransactionZZ_Some: {
1500 uint64_t some_ref = (uint64_t)(&obj->some) | 1;
1501 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth, some_ref);
1503 case LDKCOption_C2Tuple_usizeTransactionZZ_None: {
1504 return (*env)->NewObject(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, LDKCOption_C2Tuple_usizeTransactionZZ_None_meth);
1509 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
1510 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
1511 static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
1512 static jmethodID LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = NULL;
1513 static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL;
1514 static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL;
1515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
1516 LDKSpendableOutputDescriptor_StaticOutput_class =
1517 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
1518 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
1519 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
1520 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
1521 LDKSpendableOutputDescriptor_DelayedPaymentOutput_class =
1522 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;"));
1523 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL);
1524 LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "<init>", "(J)V");
1525 CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL);
1526 LDKSpendableOutputDescriptor_StaticPaymentOutput_class =
1527 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;"));
1528 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL);
1529 LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "<init>", "(J)V");
1530 CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL);
1532 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1533 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
1535 case LDKSpendableOutputDescriptor_StaticOutput: {
1536 LDKOutPoint outpoint_var = obj->static_output.outpoint;
1537 CHECK((((uint64_t)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1538 CHECK((((uint64_t)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1539 uint64_t outpoint_ref = (uint64_t)outpoint_var.inner & ~1;
1540 uint64_t output_ref = ((uint64_t)&obj->static_output.output) | 1;
1541 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (uint64_t)output_ref);
1543 case LDKSpendableOutputDescriptor_DelayedPaymentOutput: {
1544 LDKDelayedPaymentOutputDescriptor delayed_payment_output_var = obj->delayed_payment_output;
1545 CHECK((((uint64_t)delayed_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1546 CHECK((((uint64_t)&delayed_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1547 uint64_t delayed_payment_output_ref = (uint64_t)delayed_payment_output_var.inner & ~1;
1548 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth, delayed_payment_output_ref);
1550 case LDKSpendableOutputDescriptor_StaticPaymentOutput: {
1551 LDKStaticPaymentOutputDescriptor static_payment_output_var = obj->static_payment_output;
1552 CHECK((((uint64_t)static_payment_output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1553 CHECK((((uint64_t)&static_payment_output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1554 uint64_t static_payment_output_ref = (uint64_t)static_payment_output_var.inner & ~1;
1555 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, LDKSpendableOutputDescriptor_StaticPaymentOutput_meth, static_payment_output_ref);
1560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1561 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
1562 ret->datalen = (*env)->GetArrayLength(env, elems);
1563 if (ret->datalen == 0) {
1566 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
1567 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1568 for (size_t i = 0; i < ret->datalen; i++) {
1569 int64_t arr_elem = java_elems[i];
1570 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1);
1571 arr_elem_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)arr_elem) & ~1));
1572 ret->data[i] = arr_elem_conv;
1574 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1576 return (uint64_t)ret;
1578 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
1579 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
1580 for (size_t i = 0; i < ret.datalen; i++) {
1581 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
1585 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1586 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1587 static jclass LDKErrorAction_IgnoreError_class = NULL;
1588 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1589 static jclass LDKErrorAction_IgnoreAndLog_class = NULL;
1590 static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL;
1591 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1592 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
1594 LDKErrorAction_DisconnectPeer_class =
1595 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1596 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1597 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1598 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1599 LDKErrorAction_IgnoreError_class =
1600 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1601 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1602 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1603 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1604 LDKErrorAction_IgnoreAndLog_class =
1605 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;"));
1606 CHECK(LDKErrorAction_IgnoreAndLog_class != NULL);
1607 LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "<init>", "(Lorg/ldk/enums/Level;)V");
1608 CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL);
1609 LDKErrorAction_SendErrorMessage_class =
1610 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1611 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1612 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1613 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1615 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1616 LDKErrorAction *obj = (LDKErrorAction*)(ptr & ~1);
1618 case LDKErrorAction_DisconnectPeer: {
1619 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1620 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1621 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1622 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1623 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1625 case LDKErrorAction_IgnoreError: {
1626 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1628 case LDKErrorAction_IgnoreAndLog: {
1629 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log);
1630 return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv);
1632 case LDKErrorAction_SendErrorMessage: {
1633 LDKErrorMessage msg_var = obj->send_error_message.msg;
1634 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1635 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1636 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1637 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1642 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1643 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1644 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1645 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1646 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1647 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
1649 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1650 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1651 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1652 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1653 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1654 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1655 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1656 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1657 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1658 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1659 LDKHTLCFailChannelUpdate_NodeFailure_class =
1660 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1661 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1662 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1663 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1665 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1666 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
1668 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1669 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1670 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1671 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1672 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1673 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1675 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1676 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1678 case LDKHTLCFailChannelUpdate_NodeFailure: {
1679 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1680 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1681 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1686 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1687 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1688 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1689 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1690 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1691 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1692 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1693 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1694 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1695 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1696 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1697 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1698 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1699 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1700 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1701 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1702 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1703 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1704 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1705 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1706 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1707 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1708 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1709 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1710 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1711 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1712 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1713 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1714 static jclass LDKMessageSendEvent_SendChannelUpdate_class = NULL;
1715 static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
1716 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1717 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1718 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1719 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1720 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
1721 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
1722 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
1723 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
1724 static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL;
1725 static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL;
1726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
1727 LDKMessageSendEvent_SendAcceptChannel_class =
1728 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1729 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1730 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1731 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1732 LDKMessageSendEvent_SendOpenChannel_class =
1733 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1734 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1735 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1736 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1737 LDKMessageSendEvent_SendFundingCreated_class =
1738 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1739 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1740 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1741 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1742 LDKMessageSendEvent_SendFundingSigned_class =
1743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1744 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1745 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1746 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1747 LDKMessageSendEvent_SendFundingLocked_class =
1748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1749 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1750 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1751 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1752 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1754 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1755 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1756 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1757 LDKMessageSendEvent_UpdateHTLCs_class =
1758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1759 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1760 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1761 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1762 LDKMessageSendEvent_SendRevokeAndACK_class =
1763 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1764 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1765 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1766 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1767 LDKMessageSendEvent_SendClosingSigned_class =
1768 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1769 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1770 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1771 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1772 LDKMessageSendEvent_SendShutdown_class =
1773 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1774 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1775 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1776 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1777 LDKMessageSendEvent_SendChannelReestablish_class =
1778 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1779 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1780 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1781 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1782 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1783 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1784 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1785 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1786 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1787 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1788 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1789 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1790 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1791 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1792 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1793 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1794 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1795 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1796 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1797 LDKMessageSendEvent_SendChannelUpdate_class =
1798 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;"));
1799 CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL);
1800 LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "<init>", "([BJ)V");
1801 CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL);
1802 LDKMessageSendEvent_HandleError_class =
1803 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1804 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1805 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1806 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1807 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1808 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1809 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1810 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1811 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1812 LDKMessageSendEvent_SendChannelRangeQuery_class =
1813 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
1814 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
1815 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
1816 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
1817 LDKMessageSendEvent_SendShortIdsQuery_class =
1818 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
1819 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
1820 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
1821 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
1822 LDKMessageSendEvent_SendReplyChannelRange_class =
1823 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;"));
1824 CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL);
1825 LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "<init>", "([BJ)V");
1826 CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL);
1828 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1829 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
1831 case LDKMessageSendEvent_SendAcceptChannel: {
1832 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1833 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1834 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1835 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1836 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1837 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1838 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1840 case LDKMessageSendEvent_SendOpenChannel: {
1841 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1842 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1843 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1844 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1845 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1846 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1847 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1849 case LDKMessageSendEvent_SendFundingCreated: {
1850 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1851 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1852 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1853 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1854 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1855 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1856 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1858 case LDKMessageSendEvent_SendFundingSigned: {
1859 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1860 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1861 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1862 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1863 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1864 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1865 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1867 case LDKMessageSendEvent_SendFundingLocked: {
1868 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1869 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1870 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1871 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1872 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1873 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1874 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1876 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1877 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1878 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1879 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1880 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1881 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1882 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1883 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1885 case LDKMessageSendEvent_UpdateHTLCs: {
1886 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1887 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1888 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1889 CHECK((((uint64_t)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1890 CHECK((((uint64_t)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1891 uint64_t updates_ref = (uint64_t)updates_var.inner & ~1;
1892 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1894 case LDKMessageSendEvent_SendRevokeAndACK: {
1895 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1896 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1897 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1898 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1899 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1900 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1901 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1903 case LDKMessageSendEvent_SendClosingSigned: {
1904 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1905 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1906 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1907 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1908 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1909 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1910 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1912 case LDKMessageSendEvent_SendShutdown: {
1913 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1914 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1915 LDKShutdown msg_var = obj->send_shutdown.msg;
1916 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1917 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1918 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1919 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1921 case LDKMessageSendEvent_SendChannelReestablish: {
1922 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1923 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1924 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1925 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1926 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1927 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1928 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1930 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1931 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1932 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1933 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1934 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1935 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1936 CHECK((((uint64_t)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1937 CHECK((((uint64_t)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1938 uint64_t update_msg_ref = (uint64_t)update_msg_var.inner & ~1;
1939 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1941 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1942 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1943 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1944 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1945 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1946 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1948 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1949 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1950 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1951 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1952 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1953 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1955 case LDKMessageSendEvent_SendChannelUpdate: {
1956 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1957 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_update.node_id.compressed_form);
1958 LDKChannelUpdate msg_var = obj->send_channel_update.msg;
1959 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1960 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1961 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1962 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelUpdate_class, LDKMessageSendEvent_SendChannelUpdate_meth, node_id_arr, msg_ref);
1964 case LDKMessageSendEvent_HandleError: {
1965 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1966 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1967 uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
1968 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1970 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1971 uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
1972 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1974 case LDKMessageSendEvent_SendChannelRangeQuery: {
1975 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1976 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
1977 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
1978 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1979 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1980 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1981 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
1983 case LDKMessageSendEvent_SendShortIdsQuery: {
1984 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1985 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
1986 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
1987 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1988 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1989 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1990 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
1992 case LDKMessageSendEvent_SendReplyChannelRange: {
1993 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
1994 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_reply_channel_range.node_id.compressed_form);
1995 LDKReplyChannelRange msg_var = obj->send_reply_channel_range.msg;
1996 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1997 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1998 uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
1999 return (*env)->NewObject(env, LDKMessageSendEvent_SendReplyChannelRange_class, LDKMessageSendEvent_SendReplyChannelRange_meth, node_id_arr, msg_ref);
2004 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2005 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
2006 ret->datalen = (*env)->GetArrayLength(env, elems);
2007 if (ret->datalen == 0) {
2010 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
2011 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2012 for (size_t i = 0; i < ret->datalen; i++) {
2013 int64_t arr_elem = java_elems[i];
2014 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1);
2015 arr_elem_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)arr_elem) & ~1));
2016 ret->data[i] = arr_elem_conv;
2018 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2020 return (uint64_t)ret;
2022 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
2023 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
2024 for (size_t i = 0; i < ret.datalen; i++) {
2025 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
2029 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2030 return ((LDKCResult_InitFeaturesDecodeErrorZ*)arg)->result_ok;
2032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2033 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2034 CHECK(val->result_ok);
2035 LDKInitFeatures res_var = (*val->contents.result);
2036 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2037 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2038 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2042 LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1);
2043 CHECK(!val->result_ok);
2044 LDKDecodeError err_var = (*val->contents.err);
2045 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2046 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2047 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2051 return ((LDKCResult_NodeFeaturesDecodeErrorZ*)arg)->result_ok;
2053 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2054 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2055 CHECK(val->result_ok);
2056 LDKNodeFeatures res_var = (*val->contents.result);
2057 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2058 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2059 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2063 LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1);
2064 CHECK(!val->result_ok);
2065 LDKDecodeError err_var = (*val->contents.err);
2066 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2067 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2068 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2071 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2072 return ((LDKCResult_ChannelFeaturesDecodeErrorZ*)arg)->result_ok;
2074 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2075 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2076 CHECK(val->result_ok);
2077 LDKChannelFeatures res_var = (*val->contents.result);
2078 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2079 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2080 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2084 LDKCResult_ChannelFeaturesDecodeErrorZ *val = (LDKCResult_ChannelFeaturesDecodeErrorZ*)(arg & ~1);
2085 CHECK(!val->result_ok);
2086 LDKDecodeError err_var = (*val->contents.err);
2087 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2088 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2089 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2092 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2093 return ((LDKCResult_InvoiceFeaturesDecodeErrorZ*)arg)->result_ok;
2095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2096 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2097 CHECK(val->result_ok);
2098 LDKInvoiceFeatures res_var = (*val->contents.result);
2099 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2100 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2101 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2104 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2105 LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1);
2106 CHECK(!val->result_ok);
2107 LDKDecodeError err_var = (*val->contents.err);
2108 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2109 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2110 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2113 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2114 return ((LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2117 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2118 CHECK(val->result_ok);
2119 LDKDelayedPaymentOutputDescriptor res_var = (*val->contents.result);
2120 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2121 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2122 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2126 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2127 CHECK(!val->result_ok);
2128 LDKDecodeError err_var = (*val->contents.err);
2129 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2130 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2131 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2135 return ((LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2138 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2139 CHECK(val->result_ok);
2140 LDKStaticPaymentOutputDescriptor res_var = (*val->contents.result);
2141 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2142 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2143 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2147 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *val = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(arg & ~1);
2148 CHECK(!val->result_ok);
2149 LDKDecodeError err_var = (*val->contents.err);
2150 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2151 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2152 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2156 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2159 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2160 CHECK(val->result_ok);
2161 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
2164 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2165 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(arg & ~1);
2166 CHECK(!val->result_ok);
2167 LDKDecodeError err_var = (*val->contents.err);
2168 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2169 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2170 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
2174 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
2176 CHECK((*env)->GetArrayLength(env, a) == 64);
2177 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
2179 LDKCVec_SignatureZ b_constr;
2180 b_constr.datalen = (*env)->GetArrayLength(env, b);
2181 if (b_constr.datalen > 0)
2182 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
2184 b_constr.data = NULL;
2185 for (size_t i = 0; i < b_constr.datalen; i++) {
2186 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
2187 LDKSignature b_conv_8_ref;
2188 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
2189 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
2190 b_constr.data[i] = b_conv_8_ref;
2193 return (uint64_t)ret;
2195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2196 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2197 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
2198 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
2201 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2202 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(ptr & ~1);
2203 LDKCVec_SignatureZ b_var = tuple->b;
2204 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
2206 for (size_t i = 0; i < b_var.datalen; i++) {
2207 int8_tArray b_conv_8_arr = (*env)->NewByteArray(env, 64);
2208 (*env)->SetByteArrayRegion(env, b_conv_8_arr, 0, 64, b_var.data[i].compact_form);
2209 (*env)->SetObjectArrayElement(env, b_arr, i, b_conv_8_arr);
2213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2214 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
2216 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2217 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2218 CHECK(val->result_ok);
2219 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
2222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2223 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(arg & ~1);
2224 CHECK(!val->result_ok);
2225 return *val->contents.err;
2227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2228 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
2230 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2231 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2232 CHECK(val->result_ok);
2233 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
2234 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
2237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2238 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)(arg & ~1);
2239 CHECK(!val->result_ok);
2240 return *val->contents.err;
2242 typedef struct LDKBaseSign_JCalls {
2243 atomic_size_t refcnt;
2246 jmethodID get_per_commitment_point_meth;
2247 jmethodID release_commitment_secret_meth;
2248 jmethodID channel_keys_id_meth;
2249 jmethodID sign_counterparty_commitment_meth;
2250 jmethodID sign_holder_commitment_and_htlcs_meth;
2251 jmethodID sign_justice_revoked_output_meth;
2252 jmethodID sign_justice_revoked_htlc_meth;
2253 jmethodID sign_counterparty_htlc_transaction_meth;
2254 jmethodID sign_closing_transaction_meth;
2255 jmethodID sign_channel_announcement_meth;
2256 jmethodID ready_channel_meth;
2257 } LDKBaseSign_JCalls;
2258 static void LDKBaseSign_JCalls_free(void* this_arg) {
2259 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2260 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2262 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2263 if (get_jenv_res == JNI_EDETACHED) {
2264 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2266 DO_ASSERT(get_jenv_res == JNI_OK);
2268 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2269 if (get_jenv_res == JNI_EDETACHED) {
2270 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2275 LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2276 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2278 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2279 if (get_jenv_res == JNI_EDETACHED) {
2280 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2282 DO_ASSERT(get_jenv_res == JNI_OK);
2284 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2286 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
2287 if ((*env)->ExceptionCheck(env)) {
2288 (*env)->ExceptionDescribe(env);
2289 (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception.");
2291 LDKPublicKey ret_ref;
2292 CHECK((*env)->GetArrayLength(env, ret) == 33);
2293 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
2294 if (get_jenv_res == JNI_EDETACHED) {
2295 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2299 LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_arg, uint64_t idx) {
2300 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2302 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2303 if (get_jenv_res == JNI_EDETACHED) {
2304 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2306 DO_ASSERT(get_jenv_res == JNI_OK);
2308 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2310 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
2311 if ((*env)->ExceptionCheck(env)) {
2312 (*env)->ExceptionDescribe(env);
2313 (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception.");
2315 LDKThirtyTwoBytes ret_ref;
2316 CHECK((*env)->GetArrayLength(env, ret) == 32);
2317 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2318 if (get_jenv_res == JNI_EDETACHED) {
2319 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2323 LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
2324 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2326 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2327 if (get_jenv_res == JNI_EDETACHED) {
2328 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2330 DO_ASSERT(get_jenv_res == JNI_OK);
2332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2334 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth);
2335 if ((*env)->ExceptionCheck(env)) {
2336 (*env)->ExceptionDescribe(env);
2337 (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception.");
2339 LDKThirtyTwoBytes ret_ref;
2340 CHECK((*env)->GetArrayLength(env, ret) == 32);
2341 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
2342 if (get_jenv_res == JNI_EDETACHED) {
2343 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2347 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
2348 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2350 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2351 if (get_jenv_res == JNI_EDETACHED) {
2352 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2354 DO_ASSERT(get_jenv_res == JNI_OK);
2356 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
2357 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
2358 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2359 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2360 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2361 if (commitment_tx_var.is_owned) {
2362 commitment_tx_ref |= 1;
2364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2366 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
2367 if ((*env)->ExceptionCheck(env)) {
2368 (*env)->ExceptionDescribe(env);
2369 (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception.");
2371 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2372 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2373 if (get_jenv_res == JNI_EDETACHED) {
2374 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2378 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
2379 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2381 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2382 if (get_jenv_res == JNI_EDETACHED) {
2383 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2385 DO_ASSERT(get_jenv_res == JNI_OK);
2387 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
2388 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
2389 CHECK((((uint64_t)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2390 CHECK((((uint64_t)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2391 uint64_t commitment_tx_ref = (uint64_t)commitment_tx_var.inner;
2392 if (commitment_tx_var.is_owned) {
2393 commitment_tx_ref |= 1;
2395 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2397 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref);
2398 if ((*env)->ExceptionCheck(env)) {
2399 (*env)->ExceptionDescribe(env);
2400 (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception.");
2402 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1);
2403 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
2404 if (get_jenv_res == JNI_EDETACHED) {
2405 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2409 LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32]) {
2410 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2412 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2413 if (get_jenv_res == JNI_EDETACHED) {
2414 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2416 DO_ASSERT(get_jenv_res == JNI_OK);
2418 LDKTransaction justice_tx_var = justice_tx;
2419 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2420 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2421 Transaction_free(justice_tx_var);
2422 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2423 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2424 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2426 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr);
2427 if ((*env)->ExceptionCheck(env)) {
2428 (*env)->ExceptionDescribe(env);
2429 (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception.");
2431 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2432 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2433 if (get_jenv_res == JNI_EDETACHED) {
2434 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2438 LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
2439 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2441 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2442 if (get_jenv_res == JNI_EDETACHED) {
2443 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2445 DO_ASSERT(get_jenv_res == JNI_OK);
2447 LDKTransaction justice_tx_var = justice_tx;
2448 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
2449 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
2450 Transaction_free(justice_tx_var);
2451 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
2452 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
2453 LDKHTLCOutputInCommitment htlc_var = *htlc;
2454 htlc_var = HTLCOutputInCommitment_clone(htlc);
2455 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2456 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2457 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2458 if (htlc_var.is_owned) {
2461 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2463 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
2464 if ((*env)->ExceptionCheck(env)) {
2465 (*env)->ExceptionDescribe(env);
2466 (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception.");
2468 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2469 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2470 if (get_jenv_res == JNI_EDETACHED) {
2471 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2475 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
2476 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2478 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2479 if (get_jenv_res == JNI_EDETACHED) {
2480 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2482 DO_ASSERT(get_jenv_res == JNI_OK);
2484 LDKTransaction htlc_tx_var = htlc_tx;
2485 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
2486 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2487 Transaction_free(htlc_tx_var);
2488 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
2489 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2490 LDKHTLCOutputInCommitment htlc_var = *htlc;
2491 htlc_var = HTLCOutputInCommitment_clone(htlc);
2492 CHECK((((uint64_t)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2493 CHECK((((uint64_t)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2494 uint64_t htlc_ref = (uint64_t)htlc_var.inner;
2495 if (htlc_var.is_owned) {
2498 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2500 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);
2501 if ((*env)->ExceptionCheck(env)) {
2502 (*env)->ExceptionDescribe(env);
2503 (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception.");
2505 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2506 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2507 if (get_jenv_res == JNI_EDETACHED) {
2508 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2512 LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
2513 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2515 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2516 if (get_jenv_res == JNI_EDETACHED) {
2517 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2519 DO_ASSERT(get_jenv_res == JNI_OK);
2521 LDKTransaction closing_tx_var = closing_tx;
2522 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
2523 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2524 Transaction_free(closing_tx_var);
2525 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2527 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2528 if ((*env)->ExceptionCheck(env)) {
2529 (*env)->ExceptionDescribe(env);
2530 (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
2532 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2533 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2534 if (get_jenv_res == JNI_EDETACHED) {
2535 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2539 LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
2540 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2542 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2543 if (get_jenv_res == JNI_EDETACHED) {
2544 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2546 DO_ASSERT(get_jenv_res == JNI_OK);
2548 LDKUnsignedChannelAnnouncement msg_var = *msg;
2549 msg_var = UnsignedChannelAnnouncement_clone(msg);
2550 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2551 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2552 uint64_t msg_ref = (uint64_t)msg_var.inner;
2553 if (msg_var.is_owned) {
2556 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2558 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2559 if ((*env)->ExceptionCheck(env)) {
2560 (*env)->ExceptionDescribe(env);
2561 (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception.");
2563 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
2564 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
2565 if (get_jenv_res == JNI_EDETACHED) {
2566 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2570 void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
2571 LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
2573 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2574 if (get_jenv_res == JNI_EDETACHED) {
2575 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2577 DO_ASSERT(get_jenv_res == JNI_OK);
2579 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
2580 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
2581 CHECK((((uint64_t)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2582 CHECK((((uint64_t)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2583 uint64_t channel_parameters_ref = (uint64_t)channel_parameters_var.inner;
2584 if (channel_parameters_var.is_owned) {
2585 channel_parameters_ref |= 1;
2587 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2589 (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
2590 if ((*env)->ExceptionCheck(env)) {
2591 (*env)->ExceptionDescribe(env);
2592 (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception.");
2594 if (get_jenv_res == JNI_EDETACHED) {
2595 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2598 static inline LDKBaseSign LDKBaseSign_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2599 jclass c = (*env)->GetObjectClass(env, o);
2601 LDKBaseSign_JCalls *calls = MALLOC(sizeof(LDKBaseSign_JCalls), "LDKBaseSign_JCalls");
2602 atomic_init(&calls->refcnt, 1);
2603 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2604 calls->o = (*env)->NewWeakGlobalRef(env, o);
2605 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2606 CHECK(calls->get_per_commitment_point_meth != NULL);
2607 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2608 CHECK(calls->release_commitment_secret_meth != NULL);
2609 calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
2610 CHECK(calls->channel_keys_id_meth != NULL);
2611 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
2612 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2613 calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
2614 CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
2615 calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
2616 CHECK(calls->sign_justice_revoked_output_meth != NULL);
2617 calls->sign_justice_revoked_htlc_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_htlc", "([BJJ[BJ)J");
2618 CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
2619 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2620 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2621 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2622 CHECK(calls->sign_closing_transaction_meth != NULL);
2623 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2624 CHECK(calls->sign_channel_announcement_meth != NULL);
2625 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
2626 CHECK(calls->ready_channel_meth != NULL);
2628 LDKChannelPublicKeys pubkeys_conv;
2629 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2630 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2631 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2634 .this_arg = (void*) calls,
2635 .get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
2636 .release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
2637 .channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
2638 .sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
2639 .sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
2640 .sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
2641 .sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
2642 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_LDKBaseSign_jcall,
2643 .sign_closing_transaction = sign_closing_transaction_LDKBaseSign_jcall,
2644 .sign_channel_announcement = sign_channel_announcement_LDKBaseSign_jcall,
2645 .ready_channel = ready_channel_LDKBaseSign_jcall,
2646 .free = LDKBaseSign_JCalls_free,
2647 .pubkeys = pubkeys_conv,
2648 .set_pubkeys = NULL,
2652 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBaseSign_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
2653 LDKBaseSign *res_ptr = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
2654 *res_ptr = LDKBaseSign_init(env, clz, o, pubkeys);
2655 return (uint64_t)res_ptr;
2657 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2658 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2659 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
2660 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2664 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
2665 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2666 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2667 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
2672 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2673 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
2674 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->channel_keys_id)(this_arg_conv->this_arg).data);
2678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2679 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2680 LDKCommitmentTransaction commitment_tx_conv;
2681 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2682 commitment_tx_conv.is_owned = false;
2683 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2684 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
2685 return (uint64_t)ret_conv;
2688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
2689 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2690 LDKHolderCommitmentTransaction commitment_tx_conv;
2691 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
2692 commitment_tx_conv.is_owned = false;
2693 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2694 *ret_conv = (this_arg_conv->sign_holder_commitment_and_htlcs)(this_arg_conv->this_arg, &commitment_tx_conv);
2695 return (uint64_t)ret_conv;
2698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1output(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key) {
2699 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2700 LDKTransaction justice_tx_ref;
2701 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2702 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2703 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2704 justice_tx_ref.data_is_owned = true;
2705 unsigned char per_commitment_key_arr[32];
2706 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2707 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2708 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2709 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2710 *ret_conv = (this_arg_conv->sign_justice_revoked_output)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref);
2711 return (uint64_t)ret_conv;
2714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1justice_1revoked_1htlc(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, int64_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
2715 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2716 LDKTransaction justice_tx_ref;
2717 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
2718 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2719 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2720 justice_tx_ref.data_is_owned = true;
2721 unsigned char per_commitment_key_arr[32];
2722 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
2723 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
2724 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2725 LDKHTLCOutputInCommitment htlc_conv;
2726 htlc_conv.inner = (void*)(htlc & (~1));
2727 htlc_conv.is_owned = false;
2728 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2729 *ret_conv = (this_arg_conv->sign_justice_revoked_htlc)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2730 return (uint64_t)ret_conv;
2733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, int64_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
2734 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2735 LDKTransaction htlc_tx_ref;
2736 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
2737 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2738 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2739 htlc_tx_ref.data_is_owned = true;
2740 LDKPublicKey per_commitment_point_ref;
2741 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
2742 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2743 LDKHTLCOutputInCommitment htlc_conv;
2744 htlc_conv.inner = (void*)(htlc & (~1));
2745 htlc_conv.is_owned = false;
2746 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2747 *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);
2748 return (uint64_t)ret_conv;
2751 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
2752 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2753 LDKTransaction closing_tx_ref;
2754 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
2755 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2756 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2757 closing_tx_ref.data_is_owned = true;
2758 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2759 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2760 return (uint64_t)ret_conv;
2763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
2764 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2765 LDKUnsignedChannelAnnouncement msg_conv;
2766 msg_conv.inner = (void*)(msg & (~1));
2767 msg_conv.is_owned = false;
2768 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2769 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2770 return (uint64_t)ret_conv;
2773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
2774 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2775 LDKChannelTransactionParameters channel_parameters_conv;
2776 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
2777 channel_parameters_conv.is_owned = false;
2778 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
2781 LDKChannelPublicKeys LDKBaseSign_set_get_pubkeys(LDKBaseSign* this_arg) {
2782 if (this_arg->set_pubkeys != NULL)
2783 this_arg->set_pubkeys(this_arg);
2784 return this_arg->pubkeys;
2786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
2787 LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
2788 LDKChannelPublicKeys ret_var = LDKBaseSign_set_get_pubkeys(this_arg_conv);
2789 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2790 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2791 uint64_t ret_ref = (uint64_t)ret_var.inner;
2792 if (ret_var.is_owned) {
2798 typedef struct LDKSign_JCalls {
2799 atomic_size_t refcnt;
2802 LDKBaseSign_JCalls* BaseSign;
2803 jmethodID write_meth;
2805 static void LDKSign_JCalls_free(void* this_arg) {
2806 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2807 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2809 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2810 if (get_jenv_res == JNI_EDETACHED) {
2811 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2813 DO_ASSERT(get_jenv_res == JNI_OK);
2815 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2816 if (get_jenv_res == JNI_EDETACHED) {
2817 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2822 LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) {
2823 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) this_arg;
2825 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
2826 if (get_jenv_res == JNI_EDETACHED) {
2827 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
2829 DO_ASSERT(get_jenv_res == JNI_OK);
2831 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2833 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
2834 if ((*env)->ExceptionCheck(env)) {
2835 (*env)->ExceptionDescribe(env);
2836 (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception.");
2838 LDKCVec_u8Z ret_ref;
2839 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
2840 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
2841 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
2842 if (get_jenv_res == JNI_EDETACHED) {
2843 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
2847 static void LDKSign_JCalls_cloned(LDKSign* new_obj) {
2848 LDKSign_JCalls *j_calls = (LDKSign_JCalls*) new_obj->this_arg;
2849 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2850 atomic_fetch_add_explicit(&j_calls->BaseSign->refcnt, 1, memory_order_release);
2852 static inline LDKSign LDKSign_init (JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2853 jclass c = (*env)->GetObjectClass(env, o);
2855 LDKSign_JCalls *calls = MALLOC(sizeof(LDKSign_JCalls), "LDKSign_JCalls");
2856 atomic_init(&calls->refcnt, 1);
2857 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2858 calls->o = (*env)->NewWeakGlobalRef(env, o);
2859 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
2860 CHECK(calls->write_meth != NULL);
2862 LDKChannelPublicKeys pubkeys_conv;
2863 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2864 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2865 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2868 .this_arg = (void*) calls,
2869 .write = write_LDKSign_jcall,
2870 .cloned = LDKSign_JCalls_cloned,
2871 .free = LDKSign_JCalls_free,
2872 .BaseSign = LDKBaseSign_init(env, clz, BaseSign, pubkeys),
2874 calls->BaseSign = ret.BaseSign.this_arg;
2877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1new(JNIEnv *env, jclass clz, jobject o, jobject BaseSign, int64_t pubkeys) {
2878 LDKSign *res_ptr = MALLOC(sizeof(LDKSign), "LDKSign");
2879 *res_ptr = LDKSign_init(env, clz, o, BaseSign, pubkeys);
2880 return (uint64_t)res_ptr;
2882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSign_1get_1BaseSign(JNIEnv *env, jclass clz, int64_t arg) {
2883 LDKSign *inp = (LDKSign *)(arg & ~1);
2884 uint64_t res_ptr = (uint64_t)&inp->BaseSign;
2885 DO_ASSERT((res_ptr & 1) == 0);
2886 return (int64_t)(res_ptr | 1);
2888 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Sign_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
2889 LDKSign* this_arg_conv = (LDKSign*)(((uint64_t)this_arg) & ~1);
2890 LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2891 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
2892 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
2893 CVec_u8Z_free(ret_var);
2897 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2898 return ((LDKCResult_SignDecodeErrorZ*)arg)->result_ok;
2900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2901 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2902 CHECK(val->result_ok);
2903 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
2904 *ret = Sign_clone(&(*val->contents.result));
2905 return (uint64_t)ret;
2907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2908 LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
2909 CHECK(!val->result_ok);
2910 LDKDecodeError err_var = (*val->contents.err);
2911 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2912 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2913 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2917 return ((LDKCResult_RecoverableSignatureNoneZ*)arg)->result_ok;
2919 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2920 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2921 CHECK(val->result_ok);
2922 int8_tArray es_arr = (*env)->NewByteArray(env, 68);
2923 (*env)->SetByteArrayRegion(env, es_arr, 0, 68, (*val->contents.result).serialized_form);
2926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RecoverableSignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2927 LDKCResult_RecoverableSignatureNoneZ *val = (LDKCResult_RecoverableSignatureNoneZ*)(arg & ~1);
2928 CHECK(!val->result_ok);
2929 return *val->contents.err;
2931 static inline LDKCVec_CVec_u8ZZ CVec_CVec_u8ZZ_clone(const LDKCVec_CVec_u8ZZ *orig) {
2932 LDKCVec_CVec_u8ZZ ret = { .data = MALLOC(sizeof(LDKCVec_u8Z) * orig->datalen, "LDKCVec_CVec_u8ZZ clone bytes"), .datalen = orig->datalen };
2933 for (size_t i = 0; i < ret.datalen; i++) {
2934 ret.data[i] = CVec_u8Z_clone(&orig->data[i]);
2938 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2939 return ((LDKCResult_CVec_CVec_u8ZZNoneZ*)arg)->result_ok;
2941 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2942 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2943 CHECK(val->result_ok);
2944 LDKCVec_CVec_u8ZZ res_var = (*val->contents.result);
2945 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
2947 for (size_t i = 0; i < res_var.datalen; i++) {
2948 LDKCVec_u8Z res_conv_8_var = res_var.data[i];
2949 int8_tArray res_conv_8_arr = (*env)->NewByteArray(env, res_conv_8_var.datalen);
2950 (*env)->SetByteArrayRegion(env, res_conv_8_arr, 0, res_conv_8_var.datalen, res_conv_8_var.data);
2951 (*env)->SetObjectArrayElement(env, res_arr, i, res_conv_8_arr);
2955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1CVec_1u8ZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2956 LDKCResult_CVec_CVec_u8ZZNoneZ *val = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(arg & ~1);
2957 CHECK(!val->result_ok);
2958 return *val->contents.err;
2960 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2961 return ((LDKCResult_InMemorySignerDecodeErrorZ*)arg)->result_ok;
2963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2964 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2965 CHECK(val->result_ok);
2966 LDKInMemorySigner res_var = (*val->contents.result);
2967 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2968 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2969 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
2972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemorySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2973 LDKCResult_InMemorySignerDecodeErrorZ *val = (LDKCResult_InMemorySignerDecodeErrorZ*)(arg & ~1);
2974 CHECK(!val->result_ok);
2975 LDKDecodeError err_var = (*val->contents.err);
2976 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2977 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2978 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
2981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TxOutZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2982 LDKCVec_TxOutZ *ret = MALLOC(sizeof(LDKCVec_TxOutZ), "LDKCVec_TxOutZ");
2983 ret->datalen = (*env)->GetArrayLength(env, elems);
2984 if (ret->datalen == 0) {
2987 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVec_TxOutZ Data");
2988 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2989 for (size_t i = 0; i < ret->datalen; i++) {
2990 int64_t arr_elem = java_elems[i];
2991 LDKTxOut arr_elem_conv = *(LDKTxOut*)(((uint64_t)arr_elem) & ~1);
2992 arr_elem_conv = TxOut_clone((LDKTxOut*)(((uint64_t)arr_elem) & ~1));
2993 ret->data[i] = arr_elem_conv;
2995 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2997 return (uint64_t)ret;
2999 static inline LDKCVec_TxOutZ CVec_TxOutZ_clone(const LDKCVec_TxOutZ *orig) {
3000 LDKCVec_TxOutZ ret = { .data = MALLOC(sizeof(LDKTxOut) * orig->datalen, "LDKCVec_TxOutZ clone bytes"), .datalen = orig->datalen };
3001 for (size_t i = 0; i < ret.datalen; i++) {
3002 ret.data[i] = TxOut_clone(&orig->data[i]);
3006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3007 return ((LDKCResult_TransactionNoneZ*)arg)->result_ok;
3009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3010 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3011 CHECK(val->result_ok);
3012 LDKTransaction res_var = (*val->contents.result);
3013 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3014 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3018 LDKCResult_TransactionNoneZ *val = (LDKCResult_TransactionNoneZ*)(arg & ~1);
3019 CHECK(!val->result_ok);
3020 return *val->contents.err;
3022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
3023 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
3024 LDKThirtyTwoBytes a_ref;
3025 CHECK((*env)->GetArrayLength(env, a) == 32);
3026 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3028 LDKChannelMonitor b_conv;
3029 b_conv.inner = (void*)(b & (~1));
3030 b_conv.is_owned = (b & 1) || (b == 0);
3031 b_conv = ChannelMonitor_clone(&b_conv);
3033 return (uint64_t)ret;
3035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3036 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
3037 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3038 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3042 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)(ptr & ~1);
3043 LDKChannelMonitor b_var = tuple->b;
3044 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3045 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3046 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
3049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1BlockHashChannelMonitorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3050 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ");
3051 ret->datalen = (*env)->GetArrayLength(env, elems);
3052 if (ret->datalen == 0) {
3055 ret->data = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ) * ret->datalen, "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Data");
3056 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3057 for (size_t i = 0; i < ret->datalen; i++) {
3058 int64_t arr_elem = java_elems[i];
3059 LDKC2Tuple_BlockHashChannelMonitorZ arr_elem_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)arr_elem) & ~1);
3060 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
3061 ret->data[i] = arr_elem_conv;
3063 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3065 return (uint64_t)ret;
3067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3068 return ((LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)arg)->result_ok;
3070 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3071 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3072 CHECK(val->result_ok);
3073 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res_var = (*val->contents.result);
3074 int64_tArray res_arr = (*env)->NewLongArray(env, res_var.datalen);
3075 int64_t *res_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, res_arr, NULL);
3076 for (size_t i = 0; i < res_var.datalen; i++) {
3077 uint64_t res_conv_34_ref = (uint64_t)(&res_var.data[i]) | 1;
3078 res_arr_ptr[i] = res_conv_34_ref;
3080 (*env)->ReleasePrimitiveArrayCritical(env, res_arr, res_arr_ptr, 0);
3083 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3084 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *val = (LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(arg & ~1);
3085 CHECK(!val->result_ok);
3086 jclass err_conv = LDKIOError_to_java(env, (*val->contents.err));
3089 static jclass LDKCOption_u16Z_Some_class = NULL;
3090 static jmethodID LDKCOption_u16Z_Some_meth = NULL;
3091 static jclass LDKCOption_u16Z_None_class = NULL;
3092 static jmethodID LDKCOption_u16Z_None_meth = NULL;
3093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) {
3094 LDKCOption_u16Z_Some_class =
3095 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;"));
3096 CHECK(LDKCOption_u16Z_Some_class != NULL);
3097 LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "<init>", "(S)V");
3098 CHECK(LDKCOption_u16Z_Some_meth != NULL);
3099 LDKCOption_u16Z_None_class =
3100 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;"));
3101 CHECK(LDKCOption_u16Z_None_class != NULL);
3102 LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "<init>", "()V");
3103 CHECK(LDKCOption_u16Z_None_meth != NULL);
3105 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1u16Z_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3106 LDKCOption_u16Z *obj = (LDKCOption_u16Z*)(ptr & ~1);
3108 case LDKCOption_u16Z_Some: {
3109 return (*env)->NewObject(env, LDKCOption_u16Z_Some_class, LDKCOption_u16Z_Some_meth, obj->some);
3111 case LDKCOption_u16Z_None: {
3112 return (*env)->NewObject(env, LDKCOption_u16Z_None_class, LDKCOption_u16Z_None_meth);
3117 static jclass LDKAPIError_APIMisuseError_class = NULL;
3118 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
3119 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
3120 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
3121 static jclass LDKAPIError_RouteError_class = NULL;
3122 static jmethodID LDKAPIError_RouteError_meth = NULL;
3123 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
3124 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
3125 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
3126 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
3127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
3128 LDKAPIError_APIMisuseError_class =
3129 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
3130 CHECK(LDKAPIError_APIMisuseError_class != NULL);
3131 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(Ljava/lang/String;)V");
3132 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
3133 LDKAPIError_FeeRateTooHigh_class =
3134 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
3135 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
3136 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(Ljava/lang/String;I)V");
3137 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
3138 LDKAPIError_RouteError_class =
3139 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
3140 CHECK(LDKAPIError_RouteError_class != NULL);
3141 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
3142 CHECK(LDKAPIError_RouteError_meth != NULL);
3143 LDKAPIError_ChannelUnavailable_class =
3144 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
3145 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
3146 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(Ljava/lang/String;)V");
3147 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
3148 LDKAPIError_MonitorUpdateFailed_class =
3149 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
3150 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
3151 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
3152 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
3154 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3155 LDKAPIError *obj = (LDKAPIError*)(ptr & ~1);
3157 case LDKAPIError_APIMisuseError: {
3158 LDKStr err_str = obj->api_misuse_error.err;
3159 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3160 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_conv);
3162 case LDKAPIError_FeeRateTooHigh: {
3163 LDKStr err_str = obj->fee_rate_too_high.err;
3164 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3165 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_conv, obj->fee_rate_too_high.feerate);
3167 case LDKAPIError_RouteError: {
3168 LDKStr err_str = obj->route_error.err;
3169 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3170 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
3172 case LDKAPIError_ChannelUnavailable: {
3173 LDKStr err_str = obj->channel_unavailable.err;
3174 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
3175 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_conv);
3177 case LDKAPIError_MonitorUpdateFailed: {
3178 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
3183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3184 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
3186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3187 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3188 CHECK(val->result_ok);
3189 return *val->contents.result;
3191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3192 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)(arg & ~1);
3193 CHECK(!val->result_ok);
3194 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CResult_1NoneAPIErrorZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3198 LDKCVec_CResult_NoneAPIErrorZZ *ret = MALLOC(sizeof(LDKCVec_CResult_NoneAPIErrorZZ), "LDKCVec_CResult_NoneAPIErrorZZ");
3199 ret->datalen = (*env)->GetArrayLength(env, elems);
3200 if (ret->datalen == 0) {
3203 ret->data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * ret->datalen, "LDKCVec_CResult_NoneAPIErrorZZ Data");
3204 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3205 for (size_t i = 0; i < ret->datalen; i++) {
3206 int64_t arr_elem = java_elems[i];
3207 LDKCResult_NoneAPIErrorZ arr_elem_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1);
3208 arr_elem_conv = CResult_NoneAPIErrorZ_clone((LDKCResult_NoneAPIErrorZ*)(((uint64_t)arr_elem) & ~1));
3209 ret->data[i] = arr_elem_conv;
3211 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3213 return (uint64_t)ret;
3215 static inline LDKCVec_CResult_NoneAPIErrorZZ CVec_CResult_NoneAPIErrorZZ_clone(const LDKCVec_CResult_NoneAPIErrorZZ *orig) {
3216 LDKCVec_CResult_NoneAPIErrorZZ ret = { .data = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ) * orig->datalen, "LDKCVec_CResult_NoneAPIErrorZZ clone bytes"), .datalen = orig->datalen };
3217 for (size_t i = 0; i < ret.datalen; i++) {
3218 ret.data[i] = CResult_NoneAPIErrorZ_clone(&orig->data[i]);
3222 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1APIErrorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3223 LDKCVec_APIErrorZ *ret = MALLOC(sizeof(LDKCVec_APIErrorZ), "LDKCVec_APIErrorZ");
3224 ret->datalen = (*env)->GetArrayLength(env, elems);
3225 if (ret->datalen == 0) {
3228 ret->data = MALLOC(sizeof(LDKAPIError) * ret->datalen, "LDKCVec_APIErrorZ Data");
3229 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3230 for (size_t i = 0; i < ret->datalen; i++) {
3231 int64_t arr_elem = java_elems[i];
3232 LDKAPIError arr_elem_conv = *(LDKAPIError*)(((uint64_t)arr_elem) & ~1);
3233 arr_elem_conv = APIError_clone((LDKAPIError*)(((uint64_t)arr_elem) & ~1));
3234 ret->data[i] = arr_elem_conv;
3236 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3238 return (uint64_t)ret;
3240 static inline LDKCVec_APIErrorZ CVec_APIErrorZ_clone(const LDKCVec_APIErrorZ *orig) {
3241 LDKCVec_APIErrorZ ret = { .data = MALLOC(sizeof(LDKAPIError) * orig->datalen, "LDKCVec_APIErrorZ clone bytes"), .datalen = orig->datalen };
3242 for (size_t i = 0; i < ret.datalen; i++) {
3243 ret.data[i] = APIError_clone(&orig->data[i]);
3247 static jclass LDKPaymentSendFailure_ParameterError_class = NULL;
3248 static jmethodID LDKPaymentSendFailure_ParameterError_meth = NULL;
3249 static jclass LDKPaymentSendFailure_PathParameterError_class = NULL;
3250 static jmethodID LDKPaymentSendFailure_PathParameterError_meth = NULL;
3251 static jclass LDKPaymentSendFailure_AllFailedRetrySafe_class = NULL;
3252 static jmethodID LDKPaymentSendFailure_AllFailedRetrySafe_meth = NULL;
3253 static jclass LDKPaymentSendFailure_PartialFailure_class = NULL;
3254 static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL;
3255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) {
3256 LDKPaymentSendFailure_ParameterError_class =
3257 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;"));
3258 CHECK(LDKPaymentSendFailure_ParameterError_class != NULL);
3259 LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "<init>", "(J)V");
3260 CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL);
3261 LDKPaymentSendFailure_PathParameterError_class =
3262 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;"));
3263 CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL);
3264 LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "<init>", "([J)V");
3265 CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL);
3266 LDKPaymentSendFailure_AllFailedRetrySafe_class =
3267 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;"));
3268 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL);
3269 LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "<init>", "([J)V");
3270 CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL);
3271 LDKPaymentSendFailure_PartialFailure_class =
3272 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;"));
3273 CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL);
3274 LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "<init>", "([J)V");
3275 CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL);
3277 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentSendFailure_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3278 LDKPaymentSendFailure *obj = (LDKPaymentSendFailure*)(ptr & ~1);
3280 case LDKPaymentSendFailure_ParameterError: {
3281 uint64_t parameter_error_ref = ((uint64_t)&obj->parameter_error) | 1;
3282 return (*env)->NewObject(env, LDKPaymentSendFailure_ParameterError_class, LDKPaymentSendFailure_ParameterError_meth, parameter_error_ref);
3284 case LDKPaymentSendFailure_PathParameterError: {
3285 LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error_var = obj->path_parameter_error;
3286 int64_tArray path_parameter_error_arr = (*env)->NewLongArray(env, path_parameter_error_var.datalen);
3287 int64_t *path_parameter_error_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_parameter_error_arr, NULL);
3288 for (size_t w = 0; w < path_parameter_error_var.datalen; w++) {
3289 LDKCResult_NoneAPIErrorZ* path_parameter_error_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3290 *path_parameter_error_conv_22_conv = path_parameter_error_var.data[w];
3291 *path_parameter_error_conv_22_conv = CResult_NoneAPIErrorZ_clone(path_parameter_error_conv_22_conv);
3292 path_parameter_error_arr_ptr[w] = (uint64_t)path_parameter_error_conv_22_conv;
3294 (*env)->ReleasePrimitiveArrayCritical(env, path_parameter_error_arr, path_parameter_error_arr_ptr, 0);
3295 return (*env)->NewObject(env, LDKPaymentSendFailure_PathParameterError_class, LDKPaymentSendFailure_PathParameterError_meth, path_parameter_error_arr);
3297 case LDKPaymentSendFailure_AllFailedRetrySafe: {
3298 LDKCVec_APIErrorZ all_failed_retry_safe_var = obj->all_failed_retry_safe;
3299 int64_tArray all_failed_retry_safe_arr = (*env)->NewLongArray(env, all_failed_retry_safe_var.datalen);
3300 int64_t *all_failed_retry_safe_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, all_failed_retry_safe_arr, NULL);
3301 for (size_t k = 0; k < all_failed_retry_safe_var.datalen; k++) {
3302 uint64_t all_failed_retry_safe_conv_10_ref = ((uint64_t)&all_failed_retry_safe_var.data[k]) | 1;
3303 all_failed_retry_safe_arr_ptr[k] = all_failed_retry_safe_conv_10_ref;
3305 (*env)->ReleasePrimitiveArrayCritical(env, all_failed_retry_safe_arr, all_failed_retry_safe_arr_ptr, 0);
3306 return (*env)->NewObject(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, LDKPaymentSendFailure_AllFailedRetrySafe_meth, all_failed_retry_safe_arr);
3308 case LDKPaymentSendFailure_PartialFailure: {
3309 LDKCVec_CResult_NoneAPIErrorZZ partial_failure_var = obj->partial_failure;
3310 int64_tArray partial_failure_arr = (*env)->NewLongArray(env, partial_failure_var.datalen);
3311 int64_t *partial_failure_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, partial_failure_arr, NULL);
3312 for (size_t w = 0; w < partial_failure_var.datalen; w++) {
3313 LDKCResult_NoneAPIErrorZ* partial_failure_conv_22_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
3314 *partial_failure_conv_22_conv = partial_failure_var.data[w];
3315 *partial_failure_conv_22_conv = CResult_NoneAPIErrorZ_clone(partial_failure_conv_22_conv);
3316 partial_failure_arr_ptr[w] = (uint64_t)partial_failure_conv_22_conv;
3318 (*env)->ReleasePrimitiveArrayCritical(env, partial_failure_arr, partial_failure_arr_ptr, 0);
3319 return (*env)->NewObject(env, LDKPaymentSendFailure_PartialFailure_class, LDKPaymentSendFailure_PartialFailure_meth, partial_failure_arr);
3324 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3325 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
3327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3328 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3329 CHECK(val->result_ok);
3330 return *val->contents.result;
3332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3333 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)(arg & ~1);
3334 CHECK(!val->result_ok);
3335 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3339 return ((LDKCResult_PaymentHashPaymentSendFailureZ*)arg)->result_ok;
3341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3342 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3343 CHECK(val->result_ok);
3344 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3345 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentHashPaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3349 LDKCResult_PaymentHashPaymentSendFailureZ *val = (LDKCResult_PaymentHashPaymentSendFailureZ*)(arg & ~1);
3350 CHECK(!val->result_ok);
3351 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3354 static jclass LDKNetAddress_IPv4_class = NULL;
3355 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3356 static jclass LDKNetAddress_IPv6_class = NULL;
3357 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3358 static jclass LDKNetAddress_OnionV2_class = NULL;
3359 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3360 static jclass LDKNetAddress_OnionV3_class = NULL;
3361 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
3363 LDKNetAddress_IPv4_class =
3364 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3365 CHECK(LDKNetAddress_IPv4_class != NULL);
3366 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3367 CHECK(LDKNetAddress_IPv4_meth != NULL);
3368 LDKNetAddress_IPv6_class =
3369 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3370 CHECK(LDKNetAddress_IPv6_class != NULL);
3371 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3372 CHECK(LDKNetAddress_IPv6_meth != NULL);
3373 LDKNetAddress_OnionV2_class =
3374 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3375 CHECK(LDKNetAddress_OnionV2_class != NULL);
3376 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3377 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3378 LDKNetAddress_OnionV3_class =
3379 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3380 CHECK(LDKNetAddress_OnionV3_class != NULL);
3381 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3382 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3384 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
3385 LDKNetAddress *obj = (LDKNetAddress*)(ptr & ~1);
3387 case LDKNetAddress_IPv4: {
3388 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
3389 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3390 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3392 case LDKNetAddress_IPv6: {
3393 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
3394 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3395 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3397 case LDKNetAddress_OnionV2: {
3398 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
3399 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3400 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3402 case LDKNetAddress_OnionV3: {
3403 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
3404 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3405 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);
3410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3411 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
3412 ret->datalen = (*env)->GetArrayLength(env, elems);
3413 if (ret->datalen == 0) {
3416 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
3417 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3418 for (size_t i = 0; i < ret->datalen; i++) {
3419 int64_t arr_elem = java_elems[i];
3420 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)(((uint64_t)arr_elem) & ~1);
3421 arr_elem_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)arr_elem) & ~1));
3422 ret->data[i] = arr_elem_conv;
3424 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3426 return (uint64_t)ret;
3428 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
3429 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
3430 for (size_t i = 0; i < ret.datalen; i++) {
3431 ret.data[i] = NetAddress_clone(&orig->data[i]);
3435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
3436 LDKC2Tuple_PaymentHashPaymentSecretZ* ret = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
3437 LDKThirtyTwoBytes a_ref;
3438 CHECK((*env)->GetArrayLength(env, a) == 32);
3439 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
3441 LDKThirtyTwoBytes b_ref;
3442 CHECK((*env)->GetArrayLength(env, b) == 32);
3443 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
3445 return (uint64_t)ret;
3447 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3448 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3449 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
3450 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
3453 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PaymentHashPaymentSecretZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3454 LDKC2Tuple_PaymentHashPaymentSecretZ *tuple = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(ptr & ~1);
3455 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
3456 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
3459 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3460 return ((LDKCResult_PaymentSecretAPIErrorZ*)arg)->result_ok;
3462 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3463 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3464 CHECK(val->result_ok);
3465 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3466 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data);
3469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3470 LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1);
3471 CHECK(!val->result_ok);
3472 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
3475 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3476 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
3477 ret->datalen = (*env)->GetArrayLength(env, elems);
3478 if (ret->datalen == 0) {
3481 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
3482 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3483 for (size_t i = 0; i < ret->datalen; i++) {
3484 int64_t arr_elem = java_elems[i];
3485 LDKChannelMonitor arr_elem_conv;
3486 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3487 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3488 arr_elem_conv = ChannelMonitor_clone(&arr_elem_conv);
3489 ret->data[i] = arr_elem_conv;
3491 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3493 return (uint64_t)ret;
3495 static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) {
3496 LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen };
3497 for (size_t i = 0; i < ret.datalen; i++) {
3498 ret.data[i] = ChannelMonitor_clone(&orig->data[i]);
3502 typedef struct LDKWatch_JCalls {
3503 atomic_size_t refcnt;
3506 jmethodID watch_channel_meth;
3507 jmethodID update_channel_meth;
3508 jmethodID release_pending_monitor_events_meth;
3510 static void LDKWatch_JCalls_free(void* this_arg) {
3511 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3512 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3514 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3515 if (get_jenv_res == JNI_EDETACHED) {
3516 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3518 DO_ASSERT(get_jenv_res == JNI_OK);
3520 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3521 if (get_jenv_res == JNI_EDETACHED) {
3522 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3527 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
3528 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3530 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3531 if (get_jenv_res == JNI_EDETACHED) {
3532 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3534 DO_ASSERT(get_jenv_res == JNI_OK);
3536 LDKOutPoint funding_txo_var = funding_txo;
3537 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3538 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3539 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3540 if (funding_txo_var.is_owned) {
3541 funding_txo_ref |= 1;
3543 LDKChannelMonitor monitor_var = monitor;
3544 CHECK((((uint64_t)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3545 CHECK((((uint64_t)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3546 uint64_t monitor_ref = (uint64_t)monitor_var.inner;
3547 if (monitor_var.is_owned) {
3550 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3552 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
3553 if ((*env)->ExceptionCheck(env)) {
3554 (*env)->ExceptionDescribe(env);
3555 (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception.");
3557 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3558 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3559 if (get_jenv_res == JNI_EDETACHED) {
3560 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3564 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
3565 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3567 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3568 if (get_jenv_res == JNI_EDETACHED) {
3569 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3571 DO_ASSERT(get_jenv_res == JNI_OK);
3573 LDKOutPoint funding_txo_var = funding_txo;
3574 CHECK((((uint64_t)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3575 CHECK((((uint64_t)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3576 uint64_t funding_txo_ref = (uint64_t)funding_txo_var.inner;
3577 if (funding_txo_var.is_owned) {
3578 funding_txo_ref |= 1;
3580 LDKChannelMonitorUpdate update_var = update;
3581 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3582 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3583 uint64_t update_ref = (uint64_t)update_var.inner;
3584 if (update_var.is_owned) {
3587 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3589 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
3590 if ((*env)->ExceptionCheck(env)) {
3591 (*env)->ExceptionDescribe(env);
3592 (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception.");
3594 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
3595 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
3596 if (get_jenv_res == JNI_EDETACHED) {
3597 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3601 LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* this_arg) {
3602 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
3604 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3605 if (get_jenv_res == JNI_EDETACHED) {
3606 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3608 DO_ASSERT(get_jenv_res == JNI_OK);
3610 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3612 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
3613 if ((*env)->ExceptionCheck(env)) {
3614 (*env)->ExceptionDescribe(env);
3615 (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception.");
3617 LDKCVec_MonitorEventZ ret_constr;
3618 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
3619 if (ret_constr.datalen > 0)
3620 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
3622 ret_constr.data = NULL;
3623 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
3624 for (size_t o = 0; o < ret_constr.datalen; o++) {
3625 int64_t ret_conv_14 = ret_vals[o];
3626 LDKMonitorEvent ret_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1);
3627 ret_conv_14_conv = MonitorEvent_clone((LDKMonitorEvent*)(((uint64_t)ret_conv_14) & ~1));
3628 ret_constr.data[o] = ret_conv_14_conv;
3630 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
3631 if (get_jenv_res == JNI_EDETACHED) {
3632 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3636 static void LDKWatch_JCalls_cloned(LDKWatch* new_obj) {
3637 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) new_obj->this_arg;
3638 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3640 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
3641 jclass c = (*env)->GetObjectClass(env, o);
3643 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
3644 atomic_init(&calls->refcnt, 1);
3645 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3646 calls->o = (*env)->NewWeakGlobalRef(env, o);
3647 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
3648 CHECK(calls->watch_channel_meth != NULL);
3649 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
3650 CHECK(calls->update_channel_meth != NULL);
3651 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
3652 CHECK(calls->release_pending_monitor_events_meth != NULL);
3655 .this_arg = (void*) calls,
3656 .watch_channel = watch_channel_LDKWatch_jcall,
3657 .update_channel = update_channel_LDKWatch_jcall,
3658 .release_pending_monitor_events = release_pending_monitor_events_LDKWatch_jcall,
3659 .free = LDKWatch_JCalls_free,
3663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
3664 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
3665 *res_ptr = LDKWatch_init(env, clz, o);
3666 return (uint64_t)res_ptr;
3668 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) {
3669 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3670 LDKOutPoint funding_txo_conv;
3671 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3672 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3673 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3674 LDKChannelMonitor monitor_conv;
3675 monitor_conv.inner = (void*)(monitor & (~1));
3676 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
3677 monitor_conv = ChannelMonitor_clone(&monitor_conv);
3678 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3679 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
3680 return (uint64_t)ret_conv;
3683 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) {
3684 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3685 LDKOutPoint funding_txo_conv;
3686 funding_txo_conv.inner = (void*)(funding_txo & (~1));
3687 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
3688 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
3689 LDKChannelMonitorUpdate update_conv;
3690 update_conv.inner = (void*)(update & (~1));
3691 update_conv.is_owned = (update & 1) || (update == 0);
3692 update_conv = ChannelMonitorUpdate_clone(&update_conv);
3693 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
3694 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
3695 return (uint64_t)ret_conv;
3698 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3699 LDKWatch* this_arg_conv = (LDKWatch*)(((uint64_t)this_arg) & ~1);
3700 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
3701 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3702 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3703 for (size_t o = 0; o < ret_var.datalen; o++) {
3704 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
3705 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
3706 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
3707 ret_arr_ptr[o] = ret_conv_14_ref;
3709 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3714 typedef struct LDKBroadcasterInterface_JCalls {
3715 atomic_size_t refcnt;
3718 jmethodID broadcast_transaction_meth;
3719 } LDKBroadcasterInterface_JCalls;
3720 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
3721 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3722 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3724 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3725 if (get_jenv_res == JNI_EDETACHED) {
3726 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3728 DO_ASSERT(get_jenv_res == JNI_OK);
3730 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3731 if (get_jenv_res == JNI_EDETACHED) {
3732 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3737 void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, LDKTransaction tx) {
3738 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
3740 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3741 if (get_jenv_res == JNI_EDETACHED) {
3742 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3744 DO_ASSERT(get_jenv_res == JNI_OK);
3746 LDKTransaction tx_var = tx;
3747 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
3748 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
3749 Transaction_free(tx_var);
3750 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3752 (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
3753 if ((*env)->ExceptionCheck(env)) {
3754 (*env)->ExceptionDescribe(env);
3755 (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception.");
3757 if (get_jenv_res == JNI_EDETACHED) {
3758 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3761 static void LDKBroadcasterInterface_JCalls_cloned(LDKBroadcasterInterface* new_obj) {
3762 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) new_obj->this_arg;
3763 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3765 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
3766 jclass c = (*env)->GetObjectClass(env, o);
3768 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
3769 atomic_init(&calls->refcnt, 1);
3770 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3771 calls->o = (*env)->NewWeakGlobalRef(env, o);
3772 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
3773 CHECK(calls->broadcast_transaction_meth != NULL);
3775 LDKBroadcasterInterface ret = {
3776 .this_arg = (void*) calls,
3777 .broadcast_transaction = broadcast_transaction_LDKBroadcasterInterface_jcall,
3778 .free = LDKBroadcasterInterface_JCalls_free,
3782 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
3783 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
3784 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
3785 return (uint64_t)res_ptr;
3787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
3788 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)(((uint64_t)this_arg) & ~1);
3789 LDKTransaction tx_ref;
3790 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
3791 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
3792 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
3793 tx_ref.data_is_owned = true;
3794 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
3797 typedef struct LDKKeysInterface_JCalls {
3798 atomic_size_t refcnt;
3801 jmethodID get_node_secret_meth;
3802 jmethodID get_destination_script_meth;
3803 jmethodID get_shutdown_pubkey_meth;
3804 jmethodID get_channel_signer_meth;
3805 jmethodID get_secure_random_bytes_meth;
3806 jmethodID read_chan_signer_meth;
3807 jmethodID sign_invoice_meth;
3808 } LDKKeysInterface_JCalls;
3809 static void LDKKeysInterface_JCalls_free(void* this_arg) {
3810 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3811 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3813 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3814 if (get_jenv_res == JNI_EDETACHED) {
3815 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3817 DO_ASSERT(get_jenv_res == JNI_OK);
3819 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3820 if (get_jenv_res == JNI_EDETACHED) {
3821 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3826 LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) {
3827 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3829 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3830 if (get_jenv_res == JNI_EDETACHED) {
3831 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3833 DO_ASSERT(get_jenv_res == JNI_OK);
3835 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3837 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
3838 if ((*env)->ExceptionCheck(env)) {
3839 (*env)->ExceptionDescribe(env);
3840 (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception.");
3842 LDKSecretKey ret_ref;
3843 CHECK((*env)->GetArrayLength(env, ret) == 32);
3844 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.bytes);
3845 if (get_jenv_res == JNI_EDETACHED) {
3846 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3850 LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) {
3851 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3853 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3854 if (get_jenv_res == JNI_EDETACHED) {
3855 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3857 DO_ASSERT(get_jenv_res == JNI_OK);
3859 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3861 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
3862 if ((*env)->ExceptionCheck(env)) {
3863 (*env)->ExceptionDescribe(env);
3864 (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception.");
3866 LDKCVec_u8Z ret_ref;
3867 ret_ref.datalen = (*env)->GetArrayLength(env, ret);
3868 ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
3869 (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
3870 if (get_jenv_res == JNI_EDETACHED) {
3871 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3875 LDKPublicKey get_shutdown_pubkey_LDKKeysInterface_jcall(const void* this_arg) {
3876 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3878 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3879 if (get_jenv_res == JNI_EDETACHED) {
3880 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3882 DO_ASSERT(get_jenv_res == JNI_OK);
3884 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3886 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
3887 if ((*env)->ExceptionCheck(env)) {
3888 (*env)->ExceptionDescribe(env);
3889 (*env)->FatalError(env, "A call to get_shutdown_pubkey in LDKKeysInterface from rust threw an exception.");
3891 LDKPublicKey ret_ref;
3892 CHECK((*env)->GetArrayLength(env, ret) == 33);
3893 (*env)->GetByteArrayRegion(env, ret, 0, 33, ret_ref.compressed_form);
3894 if (get_jenv_res == JNI_EDETACHED) {
3895 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3899 LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
3900 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3902 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3903 if (get_jenv_res == JNI_EDETACHED) {
3904 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3906 DO_ASSERT(get_jenv_res == JNI_OK);
3908 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3910 LDKSign* ret = (LDKSign*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis);
3911 if ((*env)->ExceptionCheck(env)) {
3912 (*env)->ExceptionDescribe(env);
3913 (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception.");
3915 LDKSign ret_conv = *(LDKSign*)(((uint64_t)ret) & ~1);
3916 ret_conv = Sign_clone(ret);
3917 if (get_jenv_res == JNI_EDETACHED) {
3918 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3922 LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* this_arg) {
3923 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3925 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3926 if (get_jenv_res == JNI_EDETACHED) {
3927 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3929 DO_ASSERT(get_jenv_res == JNI_OK);
3931 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3933 int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
3934 if ((*env)->ExceptionCheck(env)) {
3935 (*env)->ExceptionDescribe(env);
3936 (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception.");
3938 LDKThirtyTwoBytes ret_ref;
3939 CHECK((*env)->GetArrayLength(env, ret) == 32);
3940 (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data);
3941 if (get_jenv_res == JNI_EDETACHED) {
3942 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3946 LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* this_arg, LDKu8slice reader) {
3947 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3949 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3950 if (get_jenv_res == JNI_EDETACHED) {
3951 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3953 DO_ASSERT(get_jenv_res == JNI_OK);
3955 LDKu8slice reader_var = reader;
3956 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
3957 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
3958 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3960 LDKCResult_SignDecodeErrorZ* ret = (LDKCResult_SignDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
3961 if ((*env)->ExceptionCheck(env)) {
3962 (*env)->ExceptionDescribe(env);
3963 (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception.");
3965 LDKCResult_SignDecodeErrorZ ret_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1);
3966 ret_conv = CResult_SignDecodeErrorZ_clone((LDKCResult_SignDecodeErrorZ*)(((uint64_t)ret) & ~1));
3967 if (get_jenv_res == JNI_EDETACHED) {
3968 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3972 LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const void* this_arg, LDKCVec_u8Z invoice_preimage) {
3973 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
3975 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
3976 if (get_jenv_res == JNI_EDETACHED) {
3977 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
3979 DO_ASSERT(get_jenv_res == JNI_OK);
3981 LDKCVec_u8Z invoice_preimage_var = invoice_preimage;
3982 int8_tArray invoice_preimage_arr = (*env)->NewByteArray(env, invoice_preimage_var.datalen);
3983 (*env)->SetByteArrayRegion(env, invoice_preimage_arr, 0, invoice_preimage_var.datalen, invoice_preimage_var.data);
3984 CVec_u8Z_free(invoice_preimage_var);
3985 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3987 LDKCResult_RecoverableSignatureNoneZ* ret = (LDKCResult_RecoverableSignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr);
3988 if ((*env)->ExceptionCheck(env)) {
3989 (*env)->ExceptionDescribe(env);
3990 (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception.");
3992 LDKCResult_RecoverableSignatureNoneZ ret_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1);
3993 ret_conv = CResult_RecoverableSignatureNoneZ_clone((LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)ret) & ~1));
3994 if (get_jenv_res == JNI_EDETACHED) {
3995 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
3999 static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) {
4000 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg;
4001 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4003 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
4004 jclass c = (*env)->GetObjectClass(env, o);
4006 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
4007 atomic_init(&calls->refcnt, 1);
4008 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4009 calls->o = (*env)->NewWeakGlobalRef(env, o);
4010 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
4011 CHECK(calls->get_node_secret_meth != NULL);
4012 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
4013 CHECK(calls->get_destination_script_meth != NULL);
4014 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
4015 CHECK(calls->get_shutdown_pubkey_meth != NULL);
4016 calls->get_channel_signer_meth = (*env)->GetMethodID(env, c, "get_channel_signer", "(ZJ)J");
4017 CHECK(calls->get_channel_signer_meth != NULL);
4018 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
4019 CHECK(calls->get_secure_random_bytes_meth != NULL);
4020 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
4021 CHECK(calls->read_chan_signer_meth != NULL);
4022 calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J");
4023 CHECK(calls->sign_invoice_meth != NULL);
4025 LDKKeysInterface ret = {
4026 .this_arg = (void*) calls,
4027 .get_node_secret = get_node_secret_LDKKeysInterface_jcall,
4028 .get_destination_script = get_destination_script_LDKKeysInterface_jcall,
4029 .get_shutdown_pubkey = get_shutdown_pubkey_LDKKeysInterface_jcall,
4030 .get_channel_signer = get_channel_signer_LDKKeysInterface_jcall,
4031 .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall,
4032 .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall,
4033 .sign_invoice = sign_invoice_LDKKeysInterface_jcall,
4034 .free = LDKKeysInterface_JCalls_free,
4038 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
4039 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
4040 *res_ptr = LDKKeysInterface_init(env, clz, o);
4041 return (uint64_t)res_ptr;
4043 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
4044 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4045 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4046 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
4050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
4051 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4052 LDKCVec_u8Z ret_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
4053 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
4054 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
4055 CVec_u8Z_free(ret_var);
4059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
4060 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4061 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
4062 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
4066 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
4067 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4068 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
4069 *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
4070 return (uint64_t)ret;
4073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
4074 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4075 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
4076 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
4080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
4081 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4082 LDKu8slice reader_ref;
4083 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
4084 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
4085 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
4086 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
4087 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
4088 return (uint64_t)ret_conv;
4091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray invoice_preimage) {
4092 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
4093 LDKCVec_u8Z invoice_preimage_ref;
4094 invoice_preimage_ref.datalen = (*env)->GetArrayLength(env, invoice_preimage);
4095 invoice_preimage_ref.data = MALLOC(invoice_preimage_ref.datalen, "LDKCVec_u8Z Bytes");
4096 (*env)->GetByteArrayRegion(env, invoice_preimage, 0, invoice_preimage_ref.datalen, invoice_preimage_ref.data);
4097 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
4098 *ret_conv = (this_arg_conv->sign_invoice)(this_arg_conv->this_arg, invoice_preimage_ref);
4099 return (uint64_t)ret_conv;
4102 typedef struct LDKFeeEstimator_JCalls {
4103 atomic_size_t refcnt;
4106 jmethodID get_est_sat_per_1000_weight_meth;
4107 } LDKFeeEstimator_JCalls;
4108 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
4109 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4110 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4112 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4113 if (get_jenv_res == JNI_EDETACHED) {
4114 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4116 DO_ASSERT(get_jenv_res == JNI_OK);
4118 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4119 if (get_jenv_res == JNI_EDETACHED) {
4120 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4125 uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
4126 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
4128 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4129 if (get_jenv_res == JNI_EDETACHED) {
4130 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4132 DO_ASSERT(get_jenv_res == JNI_OK);
4134 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
4135 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4137 int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
4138 if ((*env)->ExceptionCheck(env)) {
4139 (*env)->ExceptionDescribe(env);
4140 (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception.");
4142 if (get_jenv_res == JNI_EDETACHED) {
4143 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4147 static void LDKFeeEstimator_JCalls_cloned(LDKFeeEstimator* new_obj) {
4148 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) new_obj->this_arg;
4149 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4151 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
4152 jclass c = (*env)->GetObjectClass(env, o);
4154 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
4155 atomic_init(&calls->refcnt, 1);
4156 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4157 calls->o = (*env)->NewWeakGlobalRef(env, o);
4158 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/ConfirmationTarget;)I");
4159 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
4161 LDKFeeEstimator ret = {
4162 .this_arg = (void*) calls,
4163 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_LDKFeeEstimator_jcall,
4164 .free = LDKFeeEstimator_JCalls_free,
4168 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
4169 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
4170 *res_ptr = LDKFeeEstimator_init(env, clz, o);
4171 return (uint64_t)res_ptr;
4173 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) {
4174 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)(((uint64_t)this_arg) & ~1);
4175 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
4176 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
4180 typedef struct LDKLogger_JCalls {
4181 atomic_size_t refcnt;
4186 static void LDKLogger_JCalls_free(void* this_arg) {
4187 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4188 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4190 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4191 if (get_jenv_res == JNI_EDETACHED) {
4192 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4194 DO_ASSERT(get_jenv_res == JNI_OK);
4196 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4197 if (get_jenv_res == JNI_EDETACHED) {
4198 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4203 void log_LDKLogger_jcall(const void* this_arg, const char* record) {
4204 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
4206 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
4207 if (get_jenv_res == JNI_EDETACHED) {
4208 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
4210 DO_ASSERT(get_jenv_res == JNI_OK);
4212 const char* record_str = record;
4213 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
4214 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4216 (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
4217 if ((*env)->ExceptionCheck(env)) {
4218 (*env)->ExceptionDescribe(env);
4219 (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception.");
4221 if (get_jenv_res == JNI_EDETACHED) {
4222 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
4225 static void LDKLogger_JCalls_cloned(LDKLogger* new_obj) {
4226 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) new_obj->this_arg;
4227 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4229 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
4230 jclass c = (*env)->GetObjectClass(env, o);
4232 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
4233 atomic_init(&calls->refcnt, 1);
4234 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4235 calls->o = (*env)->NewWeakGlobalRef(env, o);
4236 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
4237 CHECK(calls->log_meth != NULL);
4240 .this_arg = (void*) calls,
4241 .log = log_LDKLogger_jcall,
4242 .free = LDKLogger_JCalls_free,
4246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
4247 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
4248 *res_ptr = LDKLogger_init(env, clz, o);
4249 return (uint64_t)res_ptr;
4251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
4252 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
4253 LDKThirtyTwoBytes a_ref;
4254 CHECK((*env)->GetArrayLength(env, a) == 32);
4255 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4257 LDKChannelManager b_conv;
4258 b_conv.inner = (void*)(b & (~1));
4259 b_conv.is_owned = (b & 1) || (b == 0);
4260 // Warning: we need a move here but no clone is available for LDKChannelManager
4262 return (uint64_t)ret;
4264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4265 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4266 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4267 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4271 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)(ptr & ~1);
4272 LDKChannelManager b_var = tuple->b;
4273 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4274 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4275 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
4278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4279 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
4281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4282 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4283 CHECK(val->result_ok);
4284 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
4287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4288 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(arg & ~1);
4289 CHECK(!val->result_ok);
4290 LDKDecodeError err_var = (*val->contents.err);
4291 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4292 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4293 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4297 return ((LDKCResult_ChannelConfigDecodeErrorZ*)arg)->result_ok;
4299 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4300 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4301 CHECK(val->result_ok);
4302 LDKChannelConfig res_var = (*val->contents.result);
4303 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4304 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4305 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelConfigDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4309 LDKCResult_ChannelConfigDecodeErrorZ *val = (LDKCResult_ChannelConfigDecodeErrorZ*)(arg & ~1);
4310 CHECK(!val->result_ok);
4311 LDKDecodeError err_var = (*val->contents.err);
4312 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4313 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4314 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4317 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4318 return ((LDKCResult_OutPointDecodeErrorZ*)arg)->result_ok;
4320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4321 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4322 CHECK(val->result_ok);
4323 LDKOutPoint res_var = (*val->contents.result);
4324 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4325 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4326 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4329 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4330 LDKCResult_OutPointDecodeErrorZ *val = (LDKCResult_OutPointDecodeErrorZ*)(arg & ~1);
4331 CHECK(!val->result_ok);
4332 LDKDecodeError err_var = (*val->contents.err);
4333 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4334 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4335 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4339 return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
4341 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4342 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4343 CHECK(val->result_ok);
4344 jclass res_conv = LDKSiPrefix_to_java(env, (*val->contents.result));
4347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4348 LDKCResult_SiPrefixNoneZ *val = (LDKCResult_SiPrefixNoneZ*)(arg & ~1);
4349 CHECK(!val->result_ok);
4350 return *val->contents.err;
4352 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4353 return ((LDKCResult_InvoiceNoneZ*)arg)->result_ok;
4355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4356 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4357 CHECK(val->result_ok);
4358 LDKInvoice res_var = (*val->contents.result);
4359 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4360 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4361 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4365 LDKCResult_InvoiceNoneZ *val = (LDKCResult_InvoiceNoneZ*)(arg & ~1);
4366 CHECK(!val->result_ok);
4367 return *val->contents.err;
4369 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4370 return ((LDKCResult_SignedRawInvoiceNoneZ*)arg)->result_ok;
4372 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4373 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4374 CHECK(val->result_ok);
4375 LDKSignedRawInvoice res_var = (*val->contents.result);
4376 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4377 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4378 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignedRawInvoiceNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4382 LDKCResult_SignedRawInvoiceNoneZ *val = (LDKCResult_SignedRawInvoiceNoneZ*)(arg & ~1);
4383 CHECK(!val->result_ok);
4384 return *val->contents.err;
4386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
4387 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
4388 LDKRawInvoice a_conv;
4389 a_conv.inner = (void*)(a & (~1));
4390 a_conv.is_owned = (a & 1) || (a == 0);
4391 a_conv = RawInvoice_clone(&a_conv);
4393 LDKThirtyTwoBytes b_ref;
4394 CHECK((*env)->GetArrayLength(env, b) == 32);
4395 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
4397 LDKInvoiceSignature c_conv;
4398 c_conv.inner = (void*)(c & (~1));
4399 c_conv.is_owned = (c & 1) || (c == 0);
4400 c_conv = InvoiceSignature_clone(&c_conv);
4402 return (uint64_t)ret;
4404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4405 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4406 LDKRawInvoice a_var = tuple->a;
4407 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4408 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4409 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4412 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4413 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4414 int8_tArray b_arr = (*env)->NewByteArray(env, 32);
4415 (*env)->SetByteArrayRegion(env, b_arr, 0, 32, tuple->b.data);
4418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
4419 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *tuple = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(ptr & ~1);
4420 LDKInvoiceSignature c_var = tuple->c;
4421 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
4426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4427 return ((LDKCResult_PayeePubKeyErrorZ*)arg)->result_ok;
4429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4430 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4431 CHECK(val->result_ok);
4432 LDKPayeePubKey res_var = (*val->contents.result);
4433 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4434 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4435 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4438 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PayeePubKeyErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4439 LDKCResult_PayeePubKeyErrorZ *val = (LDKCResult_PayeePubKeyErrorZ*)(arg & ~1);
4440 CHECK(!val->result_ok);
4441 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PrivateRouteZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4445 LDKCVec_PrivateRouteZ *ret = MALLOC(sizeof(LDKCVec_PrivateRouteZ), "LDKCVec_PrivateRouteZ");
4446 ret->datalen = (*env)->GetArrayLength(env, elems);
4447 if (ret->datalen == 0) {
4450 ret->data = MALLOC(sizeof(LDKPrivateRoute) * ret->datalen, "LDKCVec_PrivateRouteZ Data");
4451 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4452 for (size_t i = 0; i < ret->datalen; i++) {
4453 int64_t arr_elem = java_elems[i];
4454 LDKPrivateRoute arr_elem_conv;
4455 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4456 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4457 arr_elem_conv = PrivateRoute_clone(&arr_elem_conv);
4458 ret->data[i] = arr_elem_conv;
4460 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4462 return (uint64_t)ret;
4464 static inline LDKCVec_PrivateRouteZ CVec_PrivateRouteZ_clone(const LDKCVec_PrivateRouteZ *orig) {
4465 LDKCVec_PrivateRouteZ ret = { .data = MALLOC(sizeof(LDKPrivateRoute) * orig->datalen, "LDKCVec_PrivateRouteZ clone bytes"), .datalen = orig->datalen };
4466 for (size_t i = 0; i < ret.datalen; i++) {
4467 ret.data[i] = PrivateRoute_clone(&orig->data[i]);
4471 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4472 return ((LDKCResult_PositiveTimestampCreationErrorZ*)arg)->result_ok;
4474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4475 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4476 CHECK(val->result_ok);
4477 LDKPositiveTimestamp res_var = (*val->contents.result);
4478 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4479 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4480 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4483 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PositiveTimestampCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4484 LDKCResult_PositiveTimestampCreationErrorZ *val = (LDKCResult_PositiveTimestampCreationErrorZ*)(arg & ~1);
4485 CHECK(!val->result_ok);
4486 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4489 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4490 return ((LDKCResult_NoneSemanticErrorZ*)arg)->result_ok;
4492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4493 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4494 CHECK(val->result_ok);
4495 return *val->contents.result;
4497 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4498 LDKCResult_NoneSemanticErrorZ *val = (LDKCResult_NoneSemanticErrorZ*)(arg & ~1);
4499 CHECK(!val->result_ok);
4500 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4503 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4504 return ((LDKCResult_InvoiceSemanticErrorZ*)arg)->result_ok;
4506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4507 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4508 CHECK(val->result_ok);
4509 LDKInvoice res_var = (*val->contents.result);
4510 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4511 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4512 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4515 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSemanticErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4516 LDKCResult_InvoiceSemanticErrorZ *val = (LDKCResult_InvoiceSemanticErrorZ*)(arg & ~1);
4517 CHECK(!val->result_ok);
4518 jclass err_conv = LDKSemanticError_to_java(env, (*val->contents.err));
4521 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4522 return ((LDKCResult_DescriptionCreationErrorZ*)arg)->result_ok;
4524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4525 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4526 CHECK(val->result_ok);
4527 LDKDescription res_var = (*val->contents.result);
4528 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4529 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4530 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4533 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DescriptionCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4534 LDKCResult_DescriptionCreationErrorZ *val = (LDKCResult_DescriptionCreationErrorZ*)(arg & ~1);
4535 CHECK(!val->result_ok);
4536 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4540 return ((LDKCResult_ExpiryTimeCreationErrorZ*)arg)->result_ok;
4542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4543 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4544 CHECK(val->result_ok);
4545 LDKExpiryTime res_var = (*val->contents.result);
4546 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4547 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4548 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4551 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ExpiryTimeCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4552 LDKCResult_ExpiryTimeCreationErrorZ *val = (LDKCResult_ExpiryTimeCreationErrorZ*)(arg & ~1);
4553 CHECK(!val->result_ok);
4554 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4557 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4558 return ((LDKCResult_PrivateRouteCreationErrorZ*)arg)->result_ok;
4560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4561 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4562 CHECK(val->result_ok);
4563 LDKPrivateRoute res_var = (*val->contents.result);
4564 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4565 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4566 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4569 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PrivateRouteCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4570 LDKCResult_PrivateRouteCreationErrorZ *val = (LDKCResult_PrivateRouteCreationErrorZ*)(arg & ~1);
4571 CHECK(!val->result_ok);
4572 jclass err_conv = LDKCreationError_to_java(env, (*val->contents.err));
4575 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4576 return ((LDKCResult_StringErrorZ*)arg)->result_ok;
4578 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4579 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4580 CHECK(val->result_ok);
4581 LDKStr res_str = (*val->contents.result);
4582 jstring res_conv = str_ref_to_java(env, res_str.chars, res_str.len);
4585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1StringErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4586 LDKCResult_StringErrorZ *val = (LDKCResult_StringErrorZ*)(arg & ~1);
4587 CHECK(!val->result_ok);
4588 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
4591 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4592 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
4594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4595 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4596 CHECK(val->result_ok);
4597 LDKChannelMonitorUpdate res_var = (*val->contents.result);
4598 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4599 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4600 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4604 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(arg & ~1);
4605 CHECK(!val->result_ok);
4606 LDKDecodeError err_var = (*val->contents.err);
4607 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4608 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4609 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4613 return ((LDKCResult_HTLCUpdateDecodeErrorZ*)arg)->result_ok;
4615 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4616 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4617 CHECK(val->result_ok);
4618 LDKHTLCUpdate res_var = (*val->contents.result);
4619 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4620 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4621 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
4624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4625 LDKCResult_HTLCUpdateDecodeErrorZ *val = (LDKCResult_HTLCUpdateDecodeErrorZ*)(arg & ~1);
4626 CHECK(!val->result_ok);
4627 LDKDecodeError err_var = (*val->contents.err);
4628 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4629 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4630 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4633 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4634 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
4636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
4637 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4638 CHECK(val->result_ok);
4639 return *val->contents.result;
4641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
4642 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1);
4643 CHECK(!val->result_ok);
4644 LDKMonitorUpdateError err_var = (*val->contents.err);
4645 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4646 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4647 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
4650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
4651 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4653 a_conv.inner = (void*)(a & (~1));
4654 a_conv.is_owned = (a & 1) || (a == 0);
4655 a_conv = OutPoint_clone(&a_conv);
4658 b_ref.datalen = (*env)->GetArrayLength(env, b);
4659 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4660 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4662 return (uint64_t)ret;
4664 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4665 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4666 LDKOutPoint a_var = tuple->a;
4667 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4668 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4669 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
4672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4673 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)(ptr & ~1);
4674 LDKCVec_u8Z b_var = tuple->b;
4675 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4676 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4679 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
4680 LDKC2Tuple_u32ScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
4683 b_ref.datalen = (*env)->GetArrayLength(env, b);
4684 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
4685 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
4687 return (uint64_t)ret;
4689 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4690 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4693 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32ScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4694 LDKC2Tuple_u32ScriptZ *tuple = (LDKC2Tuple_u32ScriptZ*)(ptr & ~1);
4695 LDKCVec_u8Z b_var = tuple->b;
4696 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
4697 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
4700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32ScriptZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4701 LDKCVec_C2Tuple_u32ScriptZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32ScriptZZ), "LDKCVec_C2Tuple_u32ScriptZZ");
4702 ret->datalen = (*env)->GetArrayLength(env, elems);
4703 if (ret->datalen == 0) {
4706 ret->data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * ret->datalen, "LDKCVec_C2Tuple_u32ScriptZZ Data");
4707 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4708 for (size_t i = 0; i < ret->datalen; i++) {
4709 int64_t arr_elem = java_elems[i];
4710 LDKC2Tuple_u32ScriptZ arr_elem_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1);
4711 arr_elem_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)arr_elem) & ~1));
4712 ret->data[i] = arr_elem_conv;
4714 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4716 return (uint64_t)ret;
4718 static inline LDKCVec_C2Tuple_u32ScriptZZ CVec_C2Tuple_u32ScriptZZ_clone(const LDKCVec_C2Tuple_u32ScriptZZ *orig) {
4719 LDKCVec_C2Tuple_u32ScriptZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ) * orig->datalen, "LDKCVec_C2Tuple_u32ScriptZZ clone bytes"), .datalen = orig->datalen };
4720 for (size_t i = 0; i < ret.datalen; i++) {
4721 ret.data[i] = C2Tuple_u32ScriptZ_clone(&orig->data[i]);
4725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4726 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
4727 LDKThirtyTwoBytes a_ref;
4728 CHECK((*env)->GetArrayLength(env, a) == 32);
4729 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4731 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
4732 b_constr.datalen = (*env)->GetArrayLength(env, b);
4733 if (b_constr.datalen > 0)
4734 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
4736 b_constr.data = NULL;
4737 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4738 for (size_t b = 0; b < b_constr.datalen; b++) {
4739 int64_t b_conv_27 = b_vals[b];
4740 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
4741 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
4742 b_constr.data[b] = b_conv_27_conv;
4744 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
4746 return (uint64_t)ret;
4748 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4749 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4750 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
4751 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
4754 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4755 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(ptr & ~1);
4756 LDKCVec_C2Tuple_u32ScriptZZ b_var = tuple->b;
4757 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
4758 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
4759 for (size_t b = 0; b < b_var.datalen; b++) {
4760 uint64_t b_conv_27_ref = (uint64_t)(&b_var.data[b]) | 1;
4761 b_arr_ptr[b] = b_conv_27_ref;
4763 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
4766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4767 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ");
4768 ret->datalen = (*env)->GetArrayLength(env, elems);
4769 if (ret->datalen == 0) {
4772 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Data");
4773 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4774 for (size_t i = 0; i < ret->datalen; i++) {
4775 int64_t arr_elem = java_elems[i];
4776 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1);
4777 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)arr_elem) & ~1));
4778 ret->data[i] = arr_elem_conv;
4780 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4782 return (uint64_t)ret;
4784 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ *orig) {
4785 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ clone bytes"), .datalen = orig->datalen };
4786 for (size_t i = 0; i < ret.datalen; i++) {
4787 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(&orig->data[i]);
4791 static jclass LDKPaymentPurpose_InvoicePayment_class = NULL;
4792 static jmethodID LDKPaymentPurpose_InvoicePayment_meth = NULL;
4793 static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL;
4794 static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL;
4795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) {
4796 LDKPaymentPurpose_InvoicePayment_class =
4797 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;"));
4798 CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL);
4799 LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "<init>", "([B[BJ)V");
4800 CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL);
4801 LDKPaymentPurpose_SpontaneousPayment_class =
4802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;"));
4803 CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL);
4804 LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "<init>", "([B)V");
4805 CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL);
4807 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4808 LDKPaymentPurpose *obj = (LDKPaymentPurpose*)(ptr & ~1);
4810 case LDKPaymentPurpose_InvoicePayment: {
4811 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4812 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data);
4813 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
4814 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data);
4815 return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id);
4817 case LDKPaymentPurpose_SpontaneousPayment: {
4818 int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32);
4819 (*env)->SetByteArrayRegion(env, spontaneous_payment_arr, 0, 32, obj->spontaneous_payment.data);
4820 return (*env)->NewObject(env, LDKPaymentPurpose_SpontaneousPayment_class, LDKPaymentPurpose_SpontaneousPayment_meth, spontaneous_payment_arr);
4825 static jclass LDKEvent_FundingGenerationReady_class = NULL;
4826 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
4827 static jclass LDKEvent_PaymentReceived_class = NULL;
4828 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
4829 static jclass LDKEvent_PaymentSent_class = NULL;
4830 static jmethodID LDKEvent_PaymentSent_meth = NULL;
4831 static jclass LDKEvent_PaymentFailed_class = NULL;
4832 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
4833 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
4834 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
4835 static jclass LDKEvent_SpendableOutputs_class = NULL;
4836 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
4837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
4838 LDKEvent_FundingGenerationReady_class =
4839 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
4840 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
4841 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
4842 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
4843 LDKEvent_PaymentReceived_class =
4844 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
4845 CHECK(LDKEvent_PaymentReceived_class != NULL);
4846 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([BJJ)V");
4847 CHECK(LDKEvent_PaymentReceived_meth != NULL);
4848 LDKEvent_PaymentSent_class =
4849 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
4850 CHECK(LDKEvent_PaymentSent_class != NULL);
4851 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
4852 CHECK(LDKEvent_PaymentSent_meth != NULL);
4853 LDKEvent_PaymentFailed_class =
4854 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
4855 CHECK(LDKEvent_PaymentFailed_class != NULL);
4856 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
4857 CHECK(LDKEvent_PaymentFailed_meth != NULL);
4858 LDKEvent_PendingHTLCsForwardable_class =
4859 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
4860 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
4861 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
4862 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
4863 LDKEvent_SpendableOutputs_class =
4864 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
4865 CHECK(LDKEvent_SpendableOutputs_class != NULL);
4866 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
4867 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
4869 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
4870 LDKEvent *obj = (LDKEvent*)(ptr & ~1);
4872 case LDKEvent_FundingGenerationReady: {
4873 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
4874 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
4875 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
4876 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
4877 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
4878 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);
4880 case LDKEvent_PaymentReceived: {
4881 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4882 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
4883 uint64_t purpose_ref = ((uint64_t)&obj->payment_received.purpose) | 1;
4884 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, obj->payment_received.amt, purpose_ref);
4886 case LDKEvent_PaymentSent: {
4887 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
4888 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
4889 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
4891 case LDKEvent_PaymentFailed: {
4892 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
4893 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
4894 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
4896 case LDKEvent_PendingHTLCsForwardable: {
4897 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
4899 case LDKEvent_SpendableOutputs: {
4900 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
4901 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
4902 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
4903 for (size_t b = 0; b < outputs_var.datalen; b++) {
4904 uint64_t outputs_conv_27_ref = ((uint64_t)&outputs_var.data[b]) | 1;
4905 outputs_arr_ptr[b] = outputs_conv_27_ref;
4907 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
4908 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
4913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4914 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
4915 ret->datalen = (*env)->GetArrayLength(env, elems);
4916 if (ret->datalen == 0) {
4919 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
4920 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4921 for (size_t i = 0; i < ret->datalen; i++) {
4922 int64_t arr_elem = java_elems[i];
4923 LDKEvent arr_elem_conv = *(LDKEvent*)(((uint64_t)arr_elem) & ~1);
4924 arr_elem_conv = Event_clone((LDKEvent*)(((uint64_t)arr_elem) & ~1));
4925 ret->data[i] = arr_elem_conv;
4927 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4929 return (uint64_t)ret;
4931 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
4932 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
4933 for (size_t i = 0; i < ret.datalen; i++) {
4934 ret.data[i] = Event_clone(&orig->data[i]);
4938 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
4939 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
4941 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
4942 b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
4944 return (uint64_t)ret;
4946 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
4947 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
4951 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)(ptr & ~1);
4952 uint64_t b_ref = ((uint64_t)&tuple->b) | 1;
4953 return (uint64_t)b_ref;
4955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
4956 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
4957 ret->datalen = (*env)->GetArrayLength(env, elems);
4958 if (ret->datalen == 0) {
4961 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
4962 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4963 for (size_t i = 0; i < ret->datalen; i++) {
4964 int64_t arr_elem = java_elems[i];
4965 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1);
4966 arr_elem_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)arr_elem) & ~1));
4967 ret->data[i] = arr_elem_conv;
4969 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4971 return (uint64_t)ret;
4973 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
4974 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
4975 for (size_t i = 0; i < ret.datalen; i++) {
4976 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
4980 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
4981 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
4982 LDKThirtyTwoBytes a_ref;
4983 CHECK((*env)->GetArrayLength(env, a) == 32);
4984 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
4986 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
4987 b_constr.datalen = (*env)->GetArrayLength(env, b);
4988 if (b_constr.datalen > 0)
4989 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
4991 b_constr.data = NULL;
4992 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
4993 for (size_t a = 0; a < b_constr.datalen; a++) {
4994 int64_t b_conv_26 = b_vals[a];
4995 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
4996 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
4997 b_constr.data[a] = b_conv_26_conv;
4999 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5001 return (uint64_t)ret;
5003 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5004 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
5005 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
5006 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
5009 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5010 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(ptr & ~1);
5011 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
5012 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
5013 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
5014 for (size_t a = 0; a < b_var.datalen; a++) {
5015 uint64_t b_conv_26_ref = (uint64_t)(&b_var.data[a]) | 1;
5016 b_arr_ptr[a] = b_conv_26_ref;
5018 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
5021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5022 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
5023 ret->datalen = (*env)->GetArrayLength(env, elems);
5024 if (ret->datalen == 0) {
5027 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
5028 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5029 for (size_t i = 0; i < ret->datalen; i++) {
5030 int64_t arr_elem = java_elems[i];
5031 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1);
5032 arr_elem_conv = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone((LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)arr_elem) & ~1));
5033 ret->data[i] = arr_elem_conv;
5035 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5037 return (uint64_t)ret;
5039 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
5040 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
5041 for (size_t i = 0; i < ret.datalen; i++) {
5042 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
5046 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5047 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
5049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5050 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5051 CHECK(val->result_ok);
5052 uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
5055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5056 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
5057 CHECK(!val->result_ok);
5058 LDKDecodeError err_var = (*val->contents.err);
5059 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5060 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5061 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5065 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
5067 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5068 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5069 CHECK(val->result_ok);
5070 return *val->contents.result;
5072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5073 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)(arg & ~1);
5074 CHECK(!val->result_ok);
5075 LDKLightningError err_var = (*val->contents.err);
5076 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5077 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5078 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5081 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) {
5082 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5083 LDKChannelAnnouncement a_conv;
5084 a_conv.inner = (void*)(a & (~1));
5085 a_conv.is_owned = (a & 1) || (a == 0);
5086 a_conv = ChannelAnnouncement_clone(&a_conv);
5088 LDKChannelUpdate b_conv;
5089 b_conv.inner = (void*)(b & (~1));
5090 b_conv.is_owned = (b & 1) || (b == 0);
5091 b_conv = ChannelUpdate_clone(&b_conv);
5093 LDKChannelUpdate c_conv;
5094 c_conv.inner = (void*)(c & (~1));
5095 c_conv.is_owned = (c & 1) || (c == 0);
5096 c_conv = ChannelUpdate_clone(&c_conv);
5098 return (uint64_t)ret;
5100 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
5101 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5102 LDKChannelAnnouncement a_var = tuple->a;
5103 CHECK((((uint64_t)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5104 CHECK((((uint64_t)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5105 uint64_t a_ref = (uint64_t)a_var.inner & ~1;
5108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
5109 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5110 LDKChannelUpdate b_var = tuple->b;
5111 CHECK((((uint64_t)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5112 CHECK((((uint64_t)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5113 uint64_t b_ref = (uint64_t)b_var.inner & ~1;
5116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
5117 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(ptr & ~1);
5118 LDKChannelUpdate c_var = tuple->c;
5119 CHECK((((uint64_t)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5120 CHECK((((uint64_t)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5121 uint64_t c_ref = (uint64_t)c_var.inner & ~1;
5124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5125 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
5126 ret->datalen = (*env)->GetArrayLength(env, elems);
5127 if (ret->datalen == 0) {
5130 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
5131 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5132 for (size_t i = 0; i < ret->datalen; i++) {
5133 int64_t arr_elem = java_elems[i];
5134 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1);
5135 arr_elem_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)arr_elem) & ~1));
5136 ret->data[i] = arr_elem_conv;
5138 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5140 return (uint64_t)ret;
5142 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
5143 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
5144 for (size_t i = 0; i < ret.datalen; i++) {
5145 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
5149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5150 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
5151 ret->datalen = (*env)->GetArrayLength(env, elems);
5152 if (ret->datalen == 0) {
5155 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
5156 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5157 for (size_t i = 0; i < ret->datalen; i++) {
5158 int64_t arr_elem = java_elems[i];
5159 LDKNodeAnnouncement arr_elem_conv;
5160 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5161 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5162 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
5163 ret->data[i] = arr_elem_conv;
5165 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5167 return (uint64_t)ret;
5169 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
5170 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
5171 for (size_t i = 0; i < ret.datalen; i++) {
5172 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
5176 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5177 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
5179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5180 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5181 CHECK(val->result_ok);
5182 return *val->contents.result;
5184 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5185 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
5186 CHECK(!val->result_ok);
5187 LDKLightningError err_var = (*val->contents.err);
5188 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5189 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5190 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5194 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
5196 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5197 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5198 CHECK(val->result_ok);
5199 LDKCVec_u8Z res_var = (*val->contents.result);
5200 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
5201 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
5204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5205 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(arg & ~1);
5206 CHECK(!val->result_ok);
5207 LDKPeerHandleError err_var = (*val->contents.err);
5208 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5209 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5210 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5213 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5214 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
5216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5217 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5218 CHECK(val->result_ok);
5219 return *val->contents.result;
5221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5222 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)(arg & ~1);
5223 CHECK(!val->result_ok);
5224 LDKPeerHandleError err_var = (*val->contents.err);
5225 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5226 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5227 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5231 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
5233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5234 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5235 CHECK(val->result_ok);
5236 return *val->contents.result;
5238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5239 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)(arg & ~1);
5240 CHECK(!val->result_ok);
5241 LDKPeerHandleError err_var = (*val->contents.err);
5242 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5243 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5244 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5248 return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
5250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5251 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5252 CHECK(val->result_ok);
5253 LDKDirectionalChannelInfo res_var = (*val->contents.result);
5254 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5255 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5256 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5260 LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
5261 CHECK(!val->result_ok);
5262 LDKDecodeError err_var = (*val->contents.err);
5263 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5264 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5265 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5268 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5269 return ((LDKCResult_ChannelInfoDecodeErrorZ*)arg)->result_ok;
5271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5272 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5273 CHECK(val->result_ok);
5274 LDKChannelInfo res_var = (*val->contents.result);
5275 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5276 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5277 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5281 LDKCResult_ChannelInfoDecodeErrorZ *val = (LDKCResult_ChannelInfoDecodeErrorZ*)(arg & ~1);
5282 CHECK(!val->result_ok);
5283 LDKDecodeError err_var = (*val->contents.err);
5284 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5285 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5286 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5290 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
5292 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5293 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5294 CHECK(val->result_ok);
5295 LDKRoutingFees res_var = (*val->contents.result);
5296 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5297 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5298 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5302 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)(arg & ~1);
5303 CHECK(!val->result_ok);
5304 LDKDecodeError err_var = (*val->contents.err);
5305 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5306 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5307 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5310 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5311 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
5313 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5314 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5315 CHECK(val->result_ok);
5316 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
5317 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5318 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5319 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5323 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(arg & ~1);
5324 CHECK(!val->result_ok);
5325 LDKDecodeError err_var = (*val->contents.err);
5326 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5327 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5328 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5332 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
5333 ret->datalen = (*env)->GetArrayLength(env, elems);
5334 if (ret->datalen == 0) {
5337 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
5338 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5339 for (size_t i = 0; i < ret->datalen; i++) {
5340 ret->data[i] = java_elems[i];
5342 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5344 return (uint64_t)ret;
5346 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
5347 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
5348 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
5351 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5352 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
5354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5355 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5356 CHECK(val->result_ok);
5357 LDKNodeInfo res_var = (*val->contents.result);
5358 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5359 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5360 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5364 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)(arg & ~1);
5365 CHECK(!val->result_ok);
5366 LDKDecodeError err_var = (*val->contents.err);
5367 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5368 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5369 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5372 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5373 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
5375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5376 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5377 CHECK(val->result_ok);
5378 LDKNetworkGraph res_var = (*val->contents.result);
5379 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5380 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5381 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5385 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)(arg & ~1);
5386 CHECK(!val->result_ok);
5387 LDKDecodeError err_var = (*val->contents.err);
5388 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5389 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5390 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5393 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5394 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
5396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5397 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5398 CHECK(val->result_ok);
5399 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5402 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5403 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)(arg & ~1);
5404 CHECK(!val->result_ok);
5405 return *val->contents.err;
5407 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5408 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
5410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5411 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5412 CHECK(val->result_ok);
5413 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
5414 *res_conv = (*val->contents.result);
5415 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
5416 return (uint64_t)res_conv;
5418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5419 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(arg & ~1);
5420 CHECK(!val->result_ok);
5421 LDKDecodeError err_var = (*val->contents.err);
5422 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5423 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5424 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5428 return ((LDKCResult_NetAddressDecodeErrorZ*)arg)->result_ok;
5430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5431 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5432 CHECK(val->result_ok);
5433 uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
5436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5437 LDKCResult_NetAddressDecodeErrorZ *val = (LDKCResult_NetAddressDecodeErrorZ*)(arg & ~1);
5438 CHECK(!val->result_ok);
5439 LDKDecodeError err_var = (*val->contents.err);
5440 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5441 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5442 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5445 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5446 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
5447 ret->datalen = (*env)->GetArrayLength(env, elems);
5448 if (ret->datalen == 0) {
5451 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
5452 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5453 for (size_t i = 0; i < ret->datalen; i++) {
5454 int64_t arr_elem = java_elems[i];
5455 LDKUpdateAddHTLC arr_elem_conv;
5456 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5457 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5458 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
5459 ret->data[i] = arr_elem_conv;
5461 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5463 return (uint64_t)ret;
5465 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
5466 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
5467 for (size_t i = 0; i < ret.datalen; i++) {
5468 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
5472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5473 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
5474 ret->datalen = (*env)->GetArrayLength(env, elems);
5475 if (ret->datalen == 0) {
5478 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
5479 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5480 for (size_t i = 0; i < ret->datalen; i++) {
5481 int64_t arr_elem = java_elems[i];
5482 LDKUpdateFulfillHTLC arr_elem_conv;
5483 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5484 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5485 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
5486 ret->data[i] = arr_elem_conv;
5488 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5490 return (uint64_t)ret;
5492 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
5493 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
5494 for (size_t i = 0; i < ret.datalen; i++) {
5495 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
5499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5500 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
5501 ret->datalen = (*env)->GetArrayLength(env, elems);
5502 if (ret->datalen == 0) {
5505 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
5506 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5507 for (size_t i = 0; i < ret->datalen; i++) {
5508 int64_t arr_elem = java_elems[i];
5509 LDKUpdateFailHTLC arr_elem_conv;
5510 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5511 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5512 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
5513 ret->data[i] = arr_elem_conv;
5515 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5517 return (uint64_t)ret;
5519 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
5520 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
5521 for (size_t i = 0; i < ret.datalen; i++) {
5522 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
5526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
5527 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
5528 ret->datalen = (*env)->GetArrayLength(env, elems);
5529 if (ret->datalen == 0) {
5532 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
5533 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
5534 for (size_t i = 0; i < ret->datalen; i++) {
5535 int64_t arr_elem = java_elems[i];
5536 LDKUpdateFailMalformedHTLC arr_elem_conv;
5537 arr_elem_conv.inner = (void*)(arr_elem & (~1));
5538 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
5539 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
5540 ret->data[i] = arr_elem_conv;
5542 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
5544 return (uint64_t)ret;
5546 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
5547 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
5548 for (size_t i = 0; i < ret.datalen; i++) {
5549 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
5553 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5554 return ((LDKCResult_AcceptChannelDecodeErrorZ*)arg)->result_ok;
5556 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5557 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5558 CHECK(val->result_ok);
5559 LDKAcceptChannel res_var = (*val->contents.result);
5560 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5561 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5562 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AcceptChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5566 LDKCResult_AcceptChannelDecodeErrorZ *val = (LDKCResult_AcceptChannelDecodeErrorZ*)(arg & ~1);
5567 CHECK(!val->result_ok);
5568 LDKDecodeError err_var = (*val->contents.err);
5569 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5570 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5571 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5574 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5575 return ((LDKCResult_AnnouncementSignaturesDecodeErrorZ*)arg)->result_ok;
5577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5578 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5579 CHECK(val->result_ok);
5580 LDKAnnouncementSignatures res_var = (*val->contents.result);
5581 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5582 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5583 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1AnnouncementSignaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5587 LDKCResult_AnnouncementSignaturesDecodeErrorZ *val = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(arg & ~1);
5588 CHECK(!val->result_ok);
5589 LDKDecodeError err_var = (*val->contents.err);
5590 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5591 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5592 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5596 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
5598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5599 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5600 CHECK(val->result_ok);
5601 LDKChannelReestablish res_var = (*val->contents.result);
5602 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5603 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5604 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5608 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)(arg & ~1);
5609 CHECK(!val->result_ok);
5610 LDKDecodeError err_var = (*val->contents.err);
5611 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5612 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5613 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5617 return ((LDKCResult_ClosingSignedDecodeErrorZ*)arg)->result_ok;
5619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5620 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5621 CHECK(val->result_ok);
5622 LDKClosingSigned res_var = (*val->contents.result);
5623 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5624 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5625 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5628 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ClosingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5629 LDKCResult_ClosingSignedDecodeErrorZ *val = (LDKCResult_ClosingSignedDecodeErrorZ*)(arg & ~1);
5630 CHECK(!val->result_ok);
5631 LDKDecodeError err_var = (*val->contents.err);
5632 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5633 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5634 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5637 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5638 return ((LDKCResult_CommitmentSignedDecodeErrorZ*)arg)->result_ok;
5640 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5641 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5642 CHECK(val->result_ok);
5643 LDKCommitmentSigned res_var = (*val->contents.result);
5644 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5645 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5646 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5650 LDKCResult_CommitmentSignedDecodeErrorZ *val = (LDKCResult_CommitmentSignedDecodeErrorZ*)(arg & ~1);
5651 CHECK(!val->result_ok);
5652 LDKDecodeError err_var = (*val->contents.err);
5653 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5654 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5655 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5658 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5659 return ((LDKCResult_FundingCreatedDecodeErrorZ*)arg)->result_ok;
5661 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5662 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5663 CHECK(val->result_ok);
5664 LDKFundingCreated res_var = (*val->contents.result);
5665 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5666 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5667 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingCreatedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5671 LDKCResult_FundingCreatedDecodeErrorZ *val = (LDKCResult_FundingCreatedDecodeErrorZ*)(arg & ~1);
5672 CHECK(!val->result_ok);
5673 LDKDecodeError err_var = (*val->contents.err);
5674 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5675 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5676 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5679 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5680 return ((LDKCResult_FundingSignedDecodeErrorZ*)arg)->result_ok;
5682 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5683 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5684 CHECK(val->result_ok);
5685 LDKFundingSigned res_var = (*val->contents.result);
5686 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5687 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5688 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingSignedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5692 LDKCResult_FundingSignedDecodeErrorZ *val = (LDKCResult_FundingSignedDecodeErrorZ*)(arg & ~1);
5693 CHECK(!val->result_ok);
5694 LDKDecodeError err_var = (*val->contents.err);
5695 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5696 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5697 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5701 return ((LDKCResult_FundingLockedDecodeErrorZ*)arg)->result_ok;
5703 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5704 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5705 CHECK(val->result_ok);
5706 LDKFundingLocked res_var = (*val->contents.result);
5707 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5708 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5709 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1FundingLockedDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5713 LDKCResult_FundingLockedDecodeErrorZ *val = (LDKCResult_FundingLockedDecodeErrorZ*)(arg & ~1);
5714 CHECK(!val->result_ok);
5715 LDKDecodeError err_var = (*val->contents.err);
5716 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5717 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5718 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5722 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
5724 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5725 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5726 CHECK(val->result_ok);
5727 LDKInit res_var = (*val->contents.result);
5728 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5729 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5730 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5734 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)(arg & ~1);
5735 CHECK(!val->result_ok);
5736 LDKDecodeError err_var = (*val->contents.err);
5737 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5738 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5739 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5742 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5743 return ((LDKCResult_OpenChannelDecodeErrorZ*)arg)->result_ok;
5745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5746 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5747 CHECK(val->result_ok);
5748 LDKOpenChannel res_var = (*val->contents.result);
5749 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5750 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5751 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OpenChannelDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5755 LDKCResult_OpenChannelDecodeErrorZ *val = (LDKCResult_OpenChannelDecodeErrorZ*)(arg & ~1);
5756 CHECK(!val->result_ok);
5757 LDKDecodeError err_var = (*val->contents.err);
5758 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5759 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5760 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5763 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5764 return ((LDKCResult_RevokeAndACKDecodeErrorZ*)arg)->result_ok;
5766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5767 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5768 CHECK(val->result_ok);
5769 LDKRevokeAndACK res_var = (*val->contents.result);
5770 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5771 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5772 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RevokeAndACKDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5776 LDKCResult_RevokeAndACKDecodeErrorZ *val = (LDKCResult_RevokeAndACKDecodeErrorZ*)(arg & ~1);
5777 CHECK(!val->result_ok);
5778 LDKDecodeError err_var = (*val->contents.err);
5779 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5780 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5781 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5784 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5785 return ((LDKCResult_ShutdownDecodeErrorZ*)arg)->result_ok;
5787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5788 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5789 CHECK(val->result_ok);
5790 LDKShutdown res_var = (*val->contents.result);
5791 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5792 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5793 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5796 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ShutdownDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5797 LDKCResult_ShutdownDecodeErrorZ *val = (LDKCResult_ShutdownDecodeErrorZ*)(arg & ~1);
5798 CHECK(!val->result_ok);
5799 LDKDecodeError err_var = (*val->contents.err);
5800 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5801 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5802 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5805 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5806 return ((LDKCResult_UpdateFailHTLCDecodeErrorZ*)arg)->result_ok;
5808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5809 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5810 CHECK(val->result_ok);
5811 LDKUpdateFailHTLC res_var = (*val->contents.result);
5812 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5813 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5814 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5818 LDKCResult_UpdateFailHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(arg & ~1);
5819 CHECK(!val->result_ok);
5820 LDKDecodeError err_var = (*val->contents.err);
5821 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5822 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5823 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5826 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5827 return ((LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)arg)->result_ok;
5829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5830 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5831 CHECK(val->result_ok);
5832 LDKUpdateFailMalformedHTLC res_var = (*val->contents.result);
5833 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5834 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5835 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFailMalformedHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5839 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *val = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(arg & ~1);
5840 CHECK(!val->result_ok);
5841 LDKDecodeError err_var = (*val->contents.err);
5842 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5843 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5844 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5847 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5848 return ((LDKCResult_UpdateFeeDecodeErrorZ*)arg)->result_ok;
5850 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5851 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5852 CHECK(val->result_ok);
5853 LDKUpdateFee res_var = (*val->contents.result);
5854 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5855 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5856 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFeeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5860 LDKCResult_UpdateFeeDecodeErrorZ *val = (LDKCResult_UpdateFeeDecodeErrorZ*)(arg & ~1);
5861 CHECK(!val->result_ok);
5862 LDKDecodeError err_var = (*val->contents.err);
5863 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5864 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5865 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5868 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5869 return ((LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)arg)->result_ok;
5871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5872 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5873 CHECK(val->result_ok);
5874 LDKUpdateFulfillHTLC res_var = (*val->contents.result);
5875 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5876 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5877 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5880 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateFulfillHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5881 LDKCResult_UpdateFulfillHTLCDecodeErrorZ *val = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(arg & ~1);
5882 CHECK(!val->result_ok);
5883 LDKDecodeError err_var = (*val->contents.err);
5884 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5885 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5886 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5889 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5890 return ((LDKCResult_UpdateAddHTLCDecodeErrorZ*)arg)->result_ok;
5892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5893 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5894 CHECK(val->result_ok);
5895 LDKUpdateAddHTLC res_var = (*val->contents.result);
5896 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5897 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5898 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UpdateAddHTLCDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5902 LDKCResult_UpdateAddHTLCDecodeErrorZ *val = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(arg & ~1);
5903 CHECK(!val->result_ok);
5904 LDKDecodeError err_var = (*val->contents.err);
5905 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5906 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5907 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5910 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5911 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
5913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5914 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5915 CHECK(val->result_ok);
5916 LDKPing res_var = (*val->contents.result);
5917 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5918 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5919 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5923 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)(arg & ~1);
5924 CHECK(!val->result_ok);
5925 LDKDecodeError err_var = (*val->contents.err);
5926 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5927 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5928 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5932 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
5934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5935 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5936 CHECK(val->result_ok);
5937 LDKPong res_var = (*val->contents.result);
5938 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5939 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5940 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5944 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)(arg & ~1);
5945 CHECK(!val->result_ok);
5946 LDKDecodeError err_var = (*val->contents.err);
5947 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5948 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5949 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5952 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5953 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5955 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5956 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5957 CHECK(val->result_ok);
5958 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
5959 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5960 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5961 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5965 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5966 CHECK(!val->result_ok);
5967 LDKDecodeError err_var = (*val->contents.err);
5968 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5969 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5970 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5973 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5974 return ((LDKCResult_ChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
5976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5977 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5978 CHECK(val->result_ok);
5979 LDKChannelAnnouncement res_var = (*val->contents.result);
5980 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5981 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5982 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
5985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
5986 LDKCResult_ChannelAnnouncementDecodeErrorZ *val = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(arg & ~1);
5987 CHECK(!val->result_ok);
5988 LDKDecodeError err_var = (*val->contents.err);
5989 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5990 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5991 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
5994 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5995 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
5997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
5998 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
5999 CHECK(val->result_ok);
6000 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
6001 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6002 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6003 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6007 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(arg & ~1);
6008 CHECK(!val->result_ok);
6009 LDKDecodeError err_var = (*val->contents.err);
6010 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6011 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6012 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6015 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6016 return ((LDKCResult_ChannelUpdateDecodeErrorZ*)arg)->result_ok;
6018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6019 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6020 CHECK(val->result_ok);
6021 LDKChannelUpdate res_var = (*val->contents.result);
6022 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6023 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6024 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6027 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6028 LDKCResult_ChannelUpdateDecodeErrorZ *val = (LDKCResult_ChannelUpdateDecodeErrorZ*)(arg & ~1);
6029 CHECK(!val->result_ok);
6030 LDKDecodeError err_var = (*val->contents.err);
6031 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6032 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6033 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6037 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
6039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6040 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6041 CHECK(val->result_ok);
6042 LDKErrorMessage res_var = (*val->contents.result);
6043 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6044 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6045 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6049 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)(arg & ~1);
6050 CHECK(!val->result_ok);
6051 LDKDecodeError err_var = (*val->contents.err);
6052 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6053 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6054 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6058 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6061 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6062 CHECK(val->result_ok);
6063 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
6064 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6065 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6066 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6070 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(arg & ~1);
6071 CHECK(!val->result_ok);
6072 LDKDecodeError err_var = (*val->contents.err);
6073 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6074 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6075 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6078 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6079 return ((LDKCResult_NodeAnnouncementDecodeErrorZ*)arg)->result_ok;
6081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6082 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6083 CHECK(val->result_ok);
6084 LDKNodeAnnouncement res_var = (*val->contents.result);
6085 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6086 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6087 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6091 LDKCResult_NodeAnnouncementDecodeErrorZ *val = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(arg & ~1);
6092 CHECK(!val->result_ok);
6093 LDKDecodeError err_var = (*val->contents.err);
6094 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6095 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6096 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6099 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6100 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
6102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6103 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6104 CHECK(val->result_ok);
6105 LDKQueryShortChannelIds res_var = (*val->contents.result);
6106 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6107 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6108 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6112 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(arg & ~1);
6113 CHECK(!val->result_ok);
6114 LDKDecodeError err_var = (*val->contents.err);
6115 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6116 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6117 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6120 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6121 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
6123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6124 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6125 CHECK(val->result_ok);
6126 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
6127 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6128 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6129 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6133 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(arg & ~1);
6134 CHECK(!val->result_ok);
6135 LDKDecodeError err_var = (*val->contents.err);
6136 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6137 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6138 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6142 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
6144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6145 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6146 CHECK(val->result_ok);
6147 LDKQueryChannelRange res_var = (*val->contents.result);
6148 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6149 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6150 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6154 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(arg & ~1);
6155 CHECK(!val->result_ok);
6156 LDKDecodeError err_var = (*val->contents.err);
6157 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6158 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6159 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6162 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6163 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
6165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6166 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6167 CHECK(val->result_ok);
6168 LDKReplyChannelRange res_var = (*val->contents.result);
6169 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6170 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6171 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6175 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(arg & ~1);
6176 CHECK(!val->result_ok);
6177 LDKDecodeError err_var = (*val->contents.err);
6178 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6179 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6180 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6184 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
6186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6187 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6188 CHECK(val->result_ok);
6189 LDKGossipTimestampFilter res_var = (*val->contents.result);
6190 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6191 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6192 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6196 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(arg & ~1);
6197 CHECK(!val->result_ok);
6198 LDKDecodeError err_var = (*val->contents.err);
6199 CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6200 CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6201 uint64_t err_ref = (uint64_t)err_var.inner & ~1;
6204 static jclass LDKSignOrCreationError_SignError_class = NULL;
6205 static jmethodID LDKSignOrCreationError_SignError_meth = NULL;
6206 static jclass LDKSignOrCreationError_CreationError_class = NULL;
6207 static jmethodID LDKSignOrCreationError_CreationError_meth = NULL;
6208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) {
6209 LDKSignOrCreationError_SignError_class =
6210 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;"));
6211 CHECK(LDKSignOrCreationError_SignError_class != NULL);
6212 LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "<init>", "()V");
6213 CHECK(LDKSignOrCreationError_SignError_meth != NULL);
6214 LDKSignOrCreationError_CreationError_class =
6215 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;"));
6216 CHECK(LDKSignOrCreationError_CreationError_class != NULL);
6217 LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "<init>", "(Lorg/ldk/enums/CreationError;)V");
6218 CHECK(LDKSignOrCreationError_CreationError_meth != NULL);
6220 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSignOrCreationError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
6221 LDKSignOrCreationError *obj = (LDKSignOrCreationError*)(ptr & ~1);
6223 case LDKSignOrCreationError_SignError: {
6224 return (*env)->NewObject(env, LDKSignOrCreationError_SignError_class, LDKSignOrCreationError_SignError_meth);
6226 case LDKSignOrCreationError_CreationError: {
6227 jclass creation_error_conv = LDKCreationError_to_java(env, obj->creation_error);
6228 return (*env)->NewObject(env, LDKSignOrCreationError_CreationError_class, LDKSignOrCreationError_CreationError_meth, creation_error_conv);
6233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6234 return ((LDKCResult_InvoiceSignOrCreationErrorZ*)arg)->result_ok;
6236 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
6237 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6238 CHECK(val->result_ok);
6239 LDKInvoice res_var = (*val->contents.result);
6240 CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6241 CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6242 uint64_t res_ref = (uint64_t)res_var.inner & ~1;
6245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
6246 LDKCResult_InvoiceSignOrCreationErrorZ *val = (LDKCResult_InvoiceSignOrCreationErrorZ*)(arg & ~1);
6247 CHECK(!val->result_ok);
6248 uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
6251 typedef struct LDKMessageSendEventsProvider_JCalls {
6252 atomic_size_t refcnt;
6255 jmethodID get_and_clear_pending_msg_events_meth;
6256 } LDKMessageSendEventsProvider_JCalls;
6257 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
6258 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6259 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6261 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6262 if (get_jenv_res == JNI_EDETACHED) {
6263 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6265 DO_ASSERT(get_jenv_res == JNI_OK);
6267 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6268 if (get_jenv_res == JNI_EDETACHED) {
6269 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6274 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
6275 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
6277 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6278 if (get_jenv_res == JNI_EDETACHED) {
6279 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6281 DO_ASSERT(get_jenv_res == JNI_OK);
6283 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6285 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
6286 if ((*env)->ExceptionCheck(env)) {
6287 (*env)->ExceptionDescribe(env);
6288 (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
6290 LDKCVec_MessageSendEventZ ret_constr;
6291 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6292 if (ret_constr.datalen > 0)
6293 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
6295 ret_constr.data = NULL;
6296 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
6297 for (size_t s = 0; s < ret_constr.datalen; s++) {
6298 int64_t ret_conv_18 = ret_vals[s];
6299 LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
6300 ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
6301 ret_constr.data[s] = ret_conv_18_conv;
6303 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
6304 if (get_jenv_res == JNI_EDETACHED) {
6305 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6309 static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
6310 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
6311 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6313 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6314 jclass c = (*env)->GetObjectClass(env, o);
6316 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
6317 atomic_init(&calls->refcnt, 1);
6318 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6319 calls->o = (*env)->NewWeakGlobalRef(env, o);
6320 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
6321 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
6323 LDKMessageSendEventsProvider ret = {
6324 .this_arg = (void*) calls,
6325 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall,
6326 .free = LDKMessageSendEventsProvider_JCalls_free,
6330 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6331 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6332 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
6333 return (uint64_t)res_ptr;
6335 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
6336 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)(((uint64_t)this_arg) & ~1);
6337 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
6338 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
6339 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
6340 for (size_t s = 0; s < ret_var.datalen; s++) {
6341 LDKMessageSendEvent *ret_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
6342 *ret_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
6343 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_copy;
6344 ret_arr_ptr[s] = ret_conv_18_ref;
6346 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
6351 typedef struct LDKEventHandler_JCalls {
6352 atomic_size_t refcnt;
6355 jmethodID handle_event_meth;
6356 } LDKEventHandler_JCalls;
6357 static void LDKEventHandler_JCalls_free(void* this_arg) {
6358 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6359 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6361 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6362 if (get_jenv_res == JNI_EDETACHED) {
6363 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6365 DO_ASSERT(get_jenv_res == JNI_OK);
6367 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6368 if (get_jenv_res == JNI_EDETACHED) {
6369 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6374 void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
6375 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
6377 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6378 if (get_jenv_res == JNI_EDETACHED) {
6379 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6381 DO_ASSERT(get_jenv_res == JNI_OK);
6383 LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6384 *event_copy = event;
6385 uint64_t event_ref = (uint64_t)event_copy;
6386 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6388 (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
6389 if ((*env)->ExceptionCheck(env)) {
6390 (*env)->ExceptionDescribe(env);
6391 (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
6393 if (get_jenv_res == JNI_EDETACHED) {
6394 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6397 static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
6398 LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
6399 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6401 static inline LDKEventHandler LDKEventHandler_init (JNIEnv *env, jclass clz, jobject o) {
6402 jclass c = (*env)->GetObjectClass(env, o);
6404 LDKEventHandler_JCalls *calls = MALLOC(sizeof(LDKEventHandler_JCalls), "LDKEventHandler_JCalls");
6405 atomic_init(&calls->refcnt, 1);
6406 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6407 calls->o = (*env)->NewWeakGlobalRef(env, o);
6408 calls->handle_event_meth = (*env)->GetMethodID(env, c, "handle_event", "(J)V");
6409 CHECK(calls->handle_event_meth != NULL);
6411 LDKEventHandler ret = {
6412 .this_arg = (void*) calls,
6413 .handle_event = handle_event_LDKEventHandler_jcall,
6414 .free = LDKEventHandler_JCalls_free,
6418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventHandler_1new(JNIEnv *env, jclass clz, jobject o) {
6419 LDKEventHandler *res_ptr = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6420 *res_ptr = LDKEventHandler_init(env, clz, o);
6421 return (uint64_t)res_ptr;
6423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
6424 LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
6425 LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
6426 (this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
6429 typedef struct LDKEventsProvider_JCalls {
6430 atomic_size_t refcnt;
6433 jmethodID process_pending_events_meth;
6434 } LDKEventsProvider_JCalls;
6435 static void LDKEventsProvider_JCalls_free(void* this_arg) {
6436 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6437 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6439 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6440 if (get_jenv_res == JNI_EDETACHED) {
6441 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6443 DO_ASSERT(get_jenv_res == JNI_OK);
6445 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6446 if (get_jenv_res == JNI_EDETACHED) {
6447 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6452 void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
6453 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
6455 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6456 if (get_jenv_res == JNI_EDETACHED) {
6457 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6459 DO_ASSERT(get_jenv_res == JNI_OK);
6461 LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
6463 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6465 (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
6466 if ((*env)->ExceptionCheck(env)) {
6467 (*env)->ExceptionDescribe(env);
6468 (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
6470 if (get_jenv_res == JNI_EDETACHED) {
6471 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6474 static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
6475 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
6476 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6478 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
6479 jclass c = (*env)->GetObjectClass(env, o);
6481 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
6482 atomic_init(&calls->refcnt, 1);
6483 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6484 calls->o = (*env)->NewWeakGlobalRef(env, o);
6485 calls->process_pending_events_meth = (*env)->GetMethodID(env, c, "process_pending_events", "(J)V");
6486 CHECK(calls->process_pending_events_meth != NULL);
6488 LDKEventsProvider ret = {
6489 .this_arg = (void*) calls,
6490 .process_pending_events = process_pending_events_LDKEventsProvider_jcall,
6491 .free = LDKEventsProvider_JCalls_free,
6495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
6496 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6497 *res_ptr = LDKEventsProvider_init(env, clz, o);
6498 return (uint64_t)res_ptr;
6500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1process_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg, int64_t handler) {
6501 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)(((uint64_t)this_arg) & ~1);
6502 LDKEventHandler handler_conv = *(LDKEventHandler*)(((uint64_t)handler) & ~1);
6503 if (handler_conv.free == LDKEventHandler_JCalls_free) {
6504 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6505 LDKEventHandler_JCalls_cloned(&handler_conv);
6507 (this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
6510 typedef struct LDKAccess_JCalls {
6511 atomic_size_t refcnt;
6514 jmethodID get_utxo_meth;
6516 static void LDKAccess_JCalls_free(void* this_arg) {
6517 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6518 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6520 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6521 if (get_jenv_res == JNI_EDETACHED) {
6522 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6524 DO_ASSERT(get_jenv_res == JNI_OK);
6526 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6527 if (get_jenv_res == JNI_EDETACHED) {
6528 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6533 LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
6534 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
6536 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6537 if (get_jenv_res == JNI_EDETACHED) {
6538 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6540 DO_ASSERT(get_jenv_res == JNI_OK);
6542 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
6543 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
6544 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6546 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
6547 if ((*env)->ExceptionCheck(env)) {
6548 (*env)->ExceptionDescribe(env);
6549 (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
6551 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
6552 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
6553 if (get_jenv_res == JNI_EDETACHED) {
6554 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6558 static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
6559 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
6560 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6562 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
6563 jclass c = (*env)->GetObjectClass(env, o);
6565 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
6566 atomic_init(&calls->refcnt, 1);
6567 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6568 calls->o = (*env)->NewWeakGlobalRef(env, o);
6569 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
6570 CHECK(calls->get_utxo_meth != NULL);
6573 .this_arg = (void*) calls,
6574 .get_utxo = get_utxo_LDKAccess_jcall,
6575 .free = LDKAccess_JCalls_free,
6579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
6580 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
6581 *res_ptr = LDKAccess_init(env, clz, o);
6582 return (uint64_t)res_ptr;
6584 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) {
6585 LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
6586 unsigned char genesis_hash_arr[32];
6587 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
6588 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
6589 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
6590 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6591 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
6592 return (uint64_t)ret_conv;
6595 typedef struct LDKListen_JCalls {
6596 atomic_size_t refcnt;
6599 jmethodID block_connected_meth;
6600 jmethodID block_disconnected_meth;
6602 static void LDKListen_JCalls_free(void* this_arg) {
6603 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6604 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6606 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6607 if (get_jenv_res == JNI_EDETACHED) {
6608 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6610 DO_ASSERT(get_jenv_res == JNI_OK);
6612 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6613 if (get_jenv_res == JNI_EDETACHED) {
6614 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6619 void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uint32_t height) {
6620 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6622 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6623 if (get_jenv_res == JNI_EDETACHED) {
6624 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6626 DO_ASSERT(get_jenv_res == JNI_OK);
6628 LDKu8slice block_var = block;
6629 int8_tArray block_arr = (*env)->NewByteArray(env, block_var.datalen);
6630 (*env)->SetByteArrayRegion(env, block_arr, 0, block_var.datalen, block_var.data);
6631 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6633 (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height);
6634 if ((*env)->ExceptionCheck(env)) {
6635 (*env)->ExceptionDescribe(env);
6636 (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception.");
6638 if (get_jenv_res == JNI_EDETACHED) {
6639 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6642 void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6643 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) this_arg;
6645 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6646 if (get_jenv_res == JNI_EDETACHED) {
6647 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6649 DO_ASSERT(get_jenv_res == JNI_OK);
6651 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6652 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6653 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6655 (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height);
6656 if ((*env)->ExceptionCheck(env)) {
6657 (*env)->ExceptionDescribe(env);
6658 (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception.");
6660 if (get_jenv_res == JNI_EDETACHED) {
6661 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6664 static void LDKListen_JCalls_cloned(LDKListen* new_obj) {
6665 LDKListen_JCalls *j_calls = (LDKListen_JCalls*) new_obj->this_arg;
6666 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6668 static inline LDKListen LDKListen_init (JNIEnv *env, jclass clz, jobject o) {
6669 jclass c = (*env)->GetObjectClass(env, o);
6671 LDKListen_JCalls *calls = MALLOC(sizeof(LDKListen_JCalls), "LDKListen_JCalls");
6672 atomic_init(&calls->refcnt, 1);
6673 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6674 calls->o = (*env)->NewWeakGlobalRef(env, o);
6675 calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BI)V");
6676 CHECK(calls->block_connected_meth != NULL);
6677 calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
6678 CHECK(calls->block_disconnected_meth != NULL);
6681 .this_arg = (void*) calls,
6682 .block_connected = block_connected_LDKListen_jcall,
6683 .block_disconnected = block_disconnected_LDKListen_jcall,
6684 .free = LDKListen_JCalls_free,
6688 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKListen_1new(JNIEnv *env, jclass clz, jobject o) {
6689 LDKListen *res_ptr = MALLOC(sizeof(LDKListen), "LDKListen");
6690 *res_ptr = LDKListen_init(env, clz, o);
6691 return (uint64_t)res_ptr;
6693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray block, int32_t height) {
6694 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6695 LDKu8slice block_ref;
6696 block_ref.datalen = (*env)->GetArrayLength(env, block);
6697 block_ref.data = (*env)->GetByteArrayElements (env, block, NULL);
6698 (this_arg_conv->block_connected)(this_arg_conv->this_arg, block_ref, height);
6699 (*env)->ReleaseByteArrayElements(env, block, (int8_t*)block_ref.data, 0);
6702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
6703 LDKListen* this_arg_conv = (LDKListen*)(((uint64_t)this_arg) & ~1);
6704 unsigned char header_arr[80];
6705 CHECK((*env)->GetArrayLength(env, header) == 80);
6706 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6707 unsigned char (*header_ref)[80] = &header_arr;
6708 (this_arg_conv->block_disconnected)(this_arg_conv->this_arg, header_ref, height);
6711 typedef struct LDKConfirm_JCalls {
6712 atomic_size_t refcnt;
6715 jmethodID transactions_confirmed_meth;
6716 jmethodID transaction_unconfirmed_meth;
6717 jmethodID best_block_updated_meth;
6718 jmethodID get_relevant_txids_meth;
6719 } LDKConfirm_JCalls;
6720 static void LDKConfirm_JCalls_free(void* this_arg) {
6721 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6722 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6724 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6725 if (get_jenv_res == JNI_EDETACHED) {
6726 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6728 DO_ASSERT(get_jenv_res == JNI_OK);
6730 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6731 if (get_jenv_res == JNI_EDETACHED) {
6732 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6737 void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) {
6738 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6740 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6741 if (get_jenv_res == JNI_EDETACHED) {
6742 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6744 DO_ASSERT(get_jenv_res == JNI_OK);
6746 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6747 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6748 LDKCVec_C2Tuple_usizeTransactionZZ txdata_var = txdata;
6749 int64_tArray txdata_arr = (*env)->NewLongArray(env, txdata_var.datalen);
6750 int64_t *txdata_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, txdata_arr, NULL);
6751 for (size_t y = 0; y < txdata_var.datalen; y++) {
6752 LDKC2Tuple_usizeTransactionZ* txdata_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
6753 *txdata_conv_24_ref = txdata_var.data[y];
6754 txdata_arr_ptr[y] = (uint64_t)txdata_conv_24_ref;
6756 (*env)->ReleasePrimitiveArrayCritical(env, txdata_arr, txdata_arr_ptr, 0);
6757 FREE(txdata_var.data);
6758 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6760 (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height);
6761 if ((*env)->ExceptionCheck(env)) {
6762 (*env)->ExceptionDescribe(env);
6763 (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception.");
6765 if (get_jenv_res == JNI_EDETACHED) {
6766 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6769 void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t (* txid)[32]) {
6770 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6772 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6773 if (get_jenv_res == JNI_EDETACHED) {
6774 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6776 DO_ASSERT(get_jenv_res == JNI_OK);
6778 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6779 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6780 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6782 (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr);
6783 if ((*env)->ExceptionCheck(env)) {
6784 (*env)->ExceptionDescribe(env);
6785 (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception.");
6787 if (get_jenv_res == JNI_EDETACHED) {
6788 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6791 void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* header)[80], uint32_t height) {
6792 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6794 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6795 if (get_jenv_res == JNI_EDETACHED) {
6796 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6798 DO_ASSERT(get_jenv_res == JNI_OK);
6800 int8_tArray header_arr = (*env)->NewByteArray(env, 80);
6801 (*env)->SetByteArrayRegion(env, header_arr, 0, 80, *header);
6802 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6804 (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height);
6805 if ((*env)->ExceptionCheck(env)) {
6806 (*env)->ExceptionDescribe(env);
6807 (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception.");
6809 if (get_jenv_res == JNI_EDETACHED) {
6810 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6813 LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) {
6814 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) this_arg;
6816 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6817 if (get_jenv_res == JNI_EDETACHED) {
6818 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6820 DO_ASSERT(get_jenv_res == JNI_OK);
6822 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6824 jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth);
6825 if ((*env)->ExceptionCheck(env)) {
6826 (*env)->ExceptionDescribe(env);
6827 (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception.");
6829 LDKCVec_TxidZ ret_constr;
6830 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
6831 if (ret_constr.datalen > 0)
6832 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
6834 ret_constr.data = NULL;
6835 for (size_t i = 0; i < ret_constr.datalen; i++) {
6836 int8_tArray ret_conv_8 = (*env)->GetObjectArrayElement(env, ret, i);
6837 LDKThirtyTwoBytes ret_conv_8_ref;
6838 CHECK((*env)->GetArrayLength(env, ret_conv_8) == 32);
6839 (*env)->GetByteArrayRegion(env, ret_conv_8, 0, 32, ret_conv_8_ref.data);
6840 ret_constr.data[i] = ret_conv_8_ref;
6842 if (get_jenv_res == JNI_EDETACHED) {
6843 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6847 static void LDKConfirm_JCalls_cloned(LDKConfirm* new_obj) {
6848 LDKConfirm_JCalls *j_calls = (LDKConfirm_JCalls*) new_obj->this_arg;
6849 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
6851 static inline LDKConfirm LDKConfirm_init (JNIEnv *env, jclass clz, jobject o) {
6852 jclass c = (*env)->GetObjectClass(env, o);
6854 LDKConfirm_JCalls *calls = MALLOC(sizeof(LDKConfirm_JCalls), "LDKConfirm_JCalls");
6855 atomic_init(&calls->refcnt, 1);
6856 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
6857 calls->o = (*env)->NewWeakGlobalRef(env, o);
6858 calls->transactions_confirmed_meth = (*env)->GetMethodID(env, c, "transactions_confirmed", "([B[JI)V");
6859 CHECK(calls->transactions_confirmed_meth != NULL);
6860 calls->transaction_unconfirmed_meth = (*env)->GetMethodID(env, c, "transaction_unconfirmed", "([B)V");
6861 CHECK(calls->transaction_unconfirmed_meth != NULL);
6862 calls->best_block_updated_meth = (*env)->GetMethodID(env, c, "best_block_updated", "([BI)V");
6863 CHECK(calls->best_block_updated_meth != NULL);
6864 calls->get_relevant_txids_meth = (*env)->GetMethodID(env, c, "get_relevant_txids", "()[[B");
6865 CHECK(calls->get_relevant_txids_meth != NULL);
6868 .this_arg = (void*) calls,
6869 .transactions_confirmed = transactions_confirmed_LDKConfirm_jcall,
6870 .transaction_unconfirmed = transaction_unconfirmed_LDKConfirm_jcall,
6871 .best_block_updated = best_block_updated_LDKConfirm_jcall,
6872 .get_relevant_txids = get_relevant_txids_LDKConfirm_jcall,
6873 .free = LDKConfirm_JCalls_free,
6877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKConfirm_1new(JNIEnv *env, jclass clz, jobject o) {
6878 LDKConfirm *res_ptr = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
6879 *res_ptr = LDKConfirm_init(env, clz, o);
6880 return (uint64_t)res_ptr;
6882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transactions_1confirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
6883 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6884 unsigned char header_arr[80];
6885 CHECK((*env)->GetArrayLength(env, header) == 80);
6886 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6887 unsigned char (*header_ref)[80] = &header_arr;
6888 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6889 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
6890 if (txdata_constr.datalen > 0)
6891 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6893 txdata_constr.data = NULL;
6894 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
6895 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6896 int64_t txdata_conv_24 = txdata_vals[y];
6897 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
6898 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
6899 txdata_constr.data[y] = txdata_conv_24_conv;
6901 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
6902 (this_arg_conv->transactions_confirmed)(this_arg_conv->this_arg, header_ref, txdata_constr, height);
6905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid) {
6906 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6907 unsigned char txid_arr[32];
6908 CHECK((*env)->GetArrayLength(env, txid) == 32);
6909 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
6910 unsigned char (*txid_ref)[32] = &txid_arr;
6911 (this_arg_conv->transaction_unconfirmed)(this_arg_conv->this_arg, txid_ref);
6914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height) {
6915 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6916 unsigned char header_arr[80];
6917 CHECK((*env)->GetArrayLength(env, header) == 80);
6918 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
6919 unsigned char (*header_ref)[80] = &header_arr;
6920 (this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
6923 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
6924 LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
6925 LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
6926 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
6928 for (size_t i = 0; i < ret_var.datalen; i++) {
6929 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
6930 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
6931 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
6937 typedef struct LDKFilter_JCalls {
6938 atomic_size_t refcnt;
6941 jmethodID register_tx_meth;
6942 jmethodID register_output_meth;
6944 static void LDKFilter_JCalls_free(void* this_arg) {
6945 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6946 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
6948 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6949 if (get_jenv_res == JNI_EDETACHED) {
6950 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6952 DO_ASSERT(get_jenv_res == JNI_OK);
6954 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
6955 if (get_jenv_res == JNI_EDETACHED) {
6956 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6961 void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
6962 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6964 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6965 if (get_jenv_res == JNI_EDETACHED) {
6966 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6968 DO_ASSERT(get_jenv_res == JNI_OK);
6970 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
6971 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
6972 LDKu8slice script_pubkey_var = script_pubkey;
6973 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
6974 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
6975 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
6977 (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
6978 if ((*env)->ExceptionCheck(env)) {
6979 (*env)->ExceptionDescribe(env);
6980 (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
6982 if (get_jenv_res == JNI_EDETACHED) {
6983 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
6986 LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
6987 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
6989 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
6990 if (get_jenv_res == JNI_EDETACHED) {
6991 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
6993 DO_ASSERT(get_jenv_res == JNI_OK);
6995 LDKWatchedOutput output_var = output;
6996 CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6997 CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6998 uint64_t output_ref = (uint64_t)output_var.inner;
6999 if (output_var.is_owned) {
7002 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7004 LDKCOption_C2Tuple_usizeTransactionZZ* ret = (LDKCOption_C2Tuple_usizeTransactionZZ*)(*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
7005 if ((*env)->ExceptionCheck(env)) {
7006 (*env)->ExceptionDescribe(env);
7007 (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
7009 LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
7010 ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
7011 if (get_jenv_res == JNI_EDETACHED) {
7012 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7016 static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
7017 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
7018 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7020 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
7021 jclass c = (*env)->GetObjectClass(env, o);
7023 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
7024 atomic_init(&calls->refcnt, 1);
7025 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7026 calls->o = (*env)->NewWeakGlobalRef(env, o);
7027 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
7028 CHECK(calls->register_tx_meth != NULL);
7029 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
7030 CHECK(calls->register_output_meth != NULL);
7033 .this_arg = (void*) calls,
7034 .register_tx = register_tx_LDKFilter_jcall,
7035 .register_output = register_output_LDKFilter_jcall,
7036 .free = LDKFilter_JCalls_free,
7040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
7041 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
7042 *res_ptr = LDKFilter_init(env, clz, o);
7043 return (uint64_t)res_ptr;
7045 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) {
7046 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7047 unsigned char txid_arr[32];
7048 CHECK((*env)->GetArrayLength(env, txid) == 32);
7049 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
7050 unsigned char (*txid_ref)[32] = &txid_arr;
7051 LDKu8slice script_pubkey_ref;
7052 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
7053 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
7054 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
7055 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
7058 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
7059 LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
7060 LDKWatchedOutput output_conv;
7061 output_conv.inner = (void*)(output & (~1));
7062 output_conv.is_owned = (output & 1) || (output == 0);
7063 output_conv = WatchedOutput_clone(&output_conv);
7064 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
7065 *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
7066 uint64_t ret_ref = (uint64_t)ret_copy;
7070 typedef struct LDKPersist_JCalls {
7071 atomic_size_t refcnt;
7074 jmethodID persist_new_channel_meth;
7075 jmethodID update_persisted_channel_meth;
7076 } LDKPersist_JCalls;
7077 static void LDKPersist_JCalls_free(void* this_arg) {
7078 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7079 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7081 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7082 if (get_jenv_res == JNI_EDETACHED) {
7083 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7085 DO_ASSERT(get_jenv_res == JNI_OK);
7087 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7088 if (get_jenv_res == JNI_EDETACHED) {
7089 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7094 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
7095 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7097 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7098 if (get_jenv_res == JNI_EDETACHED) {
7099 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7101 DO_ASSERT(get_jenv_res == JNI_OK);
7103 LDKOutPoint id_var = id;
7104 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7105 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7106 uint64_t id_ref = (uint64_t)id_var.inner;
7107 if (id_var.is_owned) {
7110 LDKChannelMonitor data_var = *data;
7111 data_var = ChannelMonitor_clone(data);
7112 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7113 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7114 uint64_t data_ref = (uint64_t)data_var.inner;
7115 if (data_var.is_owned) {
7118 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7120 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
7121 if ((*env)->ExceptionCheck(env)) {
7122 (*env)->ExceptionDescribe(env);
7123 (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception.");
7125 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7126 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7127 if (get_jenv_res == JNI_EDETACHED) {
7128 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7132 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
7133 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
7135 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7136 if (get_jenv_res == JNI_EDETACHED) {
7137 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7139 DO_ASSERT(get_jenv_res == JNI_OK);
7141 LDKOutPoint id_var = id;
7142 CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7143 CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7144 uint64_t id_ref = (uint64_t)id_var.inner;
7145 if (id_var.is_owned) {
7148 LDKChannelMonitorUpdate update_var = *update;
7149 update_var = ChannelMonitorUpdate_clone(update);
7150 CHECK((((uint64_t)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7151 CHECK((((uint64_t)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7152 uint64_t update_ref = (uint64_t)update_var.inner;
7153 if (update_var.is_owned) {
7156 LDKChannelMonitor data_var = *data;
7157 data_var = ChannelMonitor_clone(data);
7158 CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7159 CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7160 uint64_t data_ref = (uint64_t)data_var.inner;
7161 if (data_var.is_owned) {
7164 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7166 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
7167 if ((*env)->ExceptionCheck(env)) {
7168 (*env)->ExceptionDescribe(env);
7169 (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception.");
7171 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
7172 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
7173 if (get_jenv_res == JNI_EDETACHED) {
7174 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7178 static void LDKPersist_JCalls_cloned(LDKPersist* new_obj) {
7179 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) new_obj->this_arg;
7180 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7182 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
7183 jclass c = (*env)->GetObjectClass(env, o);
7185 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
7186 atomic_init(&calls->refcnt, 1);
7187 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7188 calls->o = (*env)->NewWeakGlobalRef(env, o);
7189 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
7190 CHECK(calls->persist_new_channel_meth != NULL);
7191 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
7192 CHECK(calls->update_persisted_channel_meth != NULL);
7195 .this_arg = (void*) calls,
7196 .persist_new_channel = persist_new_channel_LDKPersist_jcall,
7197 .update_persisted_channel = update_persisted_channel_LDKPersist_jcall,
7198 .free = LDKPersist_JCalls_free,
7202 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
7203 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
7204 *res_ptr = LDKPersist_init(env, clz, o);
7205 return (uint64_t)res_ptr;
7207 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) {
7208 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7209 LDKOutPoint id_conv;
7210 id_conv.inner = (void*)(id & (~1));
7211 id_conv.is_owned = (id & 1) || (id == 0);
7212 id_conv = OutPoint_clone(&id_conv);
7213 LDKChannelMonitor data_conv;
7214 data_conv.inner = (void*)(data & (~1));
7215 data_conv.is_owned = false;
7216 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7217 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
7218 return (uint64_t)ret_conv;
7221 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) {
7222 LDKPersist* this_arg_conv = (LDKPersist*)(((uint64_t)this_arg) & ~1);
7223 LDKOutPoint id_conv;
7224 id_conv.inner = (void*)(id & (~1));
7225 id_conv.is_owned = (id & 1) || (id == 0);
7226 id_conv = OutPoint_clone(&id_conv);
7227 LDKChannelMonitorUpdate update_conv;
7228 update_conv.inner = (void*)(update & (~1));
7229 update_conv.is_owned = false;
7230 LDKChannelMonitor data_conv;
7231 data_conv.inner = (void*)(data & (~1));
7232 data_conv.is_owned = false;
7233 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
7234 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
7235 return (uint64_t)ret_conv;
7238 typedef struct LDKChannelMessageHandler_JCalls {
7239 atomic_size_t refcnt;
7242 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
7243 jmethodID handle_open_channel_meth;
7244 jmethodID handle_accept_channel_meth;
7245 jmethodID handle_funding_created_meth;
7246 jmethodID handle_funding_signed_meth;
7247 jmethodID handle_funding_locked_meth;
7248 jmethodID handle_shutdown_meth;
7249 jmethodID handle_closing_signed_meth;
7250 jmethodID handle_update_add_htlc_meth;
7251 jmethodID handle_update_fulfill_htlc_meth;
7252 jmethodID handle_update_fail_htlc_meth;
7253 jmethodID handle_update_fail_malformed_htlc_meth;
7254 jmethodID handle_commitment_signed_meth;
7255 jmethodID handle_revoke_and_ack_meth;
7256 jmethodID handle_update_fee_meth;
7257 jmethodID handle_announcement_signatures_meth;
7258 jmethodID peer_disconnected_meth;
7259 jmethodID peer_connected_meth;
7260 jmethodID handle_channel_reestablish_meth;
7261 jmethodID handle_channel_update_meth;
7262 jmethodID handle_error_meth;
7263 } LDKChannelMessageHandler_JCalls;
7264 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
7265 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7266 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
7268 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7269 if (get_jenv_res == JNI_EDETACHED) {
7270 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7272 DO_ASSERT(get_jenv_res == JNI_OK);
7274 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
7275 if (get_jenv_res == JNI_EDETACHED) {
7276 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7281 void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
7282 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7284 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7285 if (get_jenv_res == JNI_EDETACHED) {
7286 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7288 DO_ASSERT(get_jenv_res == JNI_OK);
7290 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7291 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7292 LDKInitFeatures their_features_var = their_features;
7293 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7294 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7295 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7296 if (their_features_var.is_owned) {
7297 their_features_ref |= 1;
7299 LDKOpenChannel msg_var = *msg;
7300 msg_var = OpenChannel_clone(msg);
7301 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7302 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7303 uint64_t msg_ref = (uint64_t)msg_var.inner;
7304 if (msg_var.is_owned) {
7307 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7309 (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7310 if ((*env)->ExceptionCheck(env)) {
7311 (*env)->ExceptionDescribe(env);
7312 (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception.");
7314 if (get_jenv_res == JNI_EDETACHED) {
7315 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7318 void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
7319 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7321 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7322 if (get_jenv_res == JNI_EDETACHED) {
7323 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7325 DO_ASSERT(get_jenv_res == JNI_OK);
7327 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7328 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7329 LDKInitFeatures their_features_var = their_features;
7330 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7331 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7332 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7333 if (their_features_var.is_owned) {
7334 their_features_ref |= 1;
7336 LDKAcceptChannel msg_var = *msg;
7337 msg_var = AcceptChannel_clone(msg);
7338 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7339 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7340 uint64_t msg_ref = (uint64_t)msg_var.inner;
7341 if (msg_var.is_owned) {
7344 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7346 (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
7347 if ((*env)->ExceptionCheck(env)) {
7348 (*env)->ExceptionDescribe(env);
7349 (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception.");
7351 if (get_jenv_res == JNI_EDETACHED) {
7352 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7355 void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
7356 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7358 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7359 if (get_jenv_res == JNI_EDETACHED) {
7360 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7362 DO_ASSERT(get_jenv_res == JNI_OK);
7364 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7365 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7366 LDKFundingCreated msg_var = *msg;
7367 msg_var = FundingCreated_clone(msg);
7368 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7369 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7370 uint64_t msg_ref = (uint64_t)msg_var.inner;
7371 if (msg_var.is_owned) {
7374 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7376 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
7377 if ((*env)->ExceptionCheck(env)) {
7378 (*env)->ExceptionDescribe(env);
7379 (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception.");
7381 if (get_jenv_res == JNI_EDETACHED) {
7382 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7385 void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
7386 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7388 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7389 if (get_jenv_res == JNI_EDETACHED) {
7390 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7392 DO_ASSERT(get_jenv_res == JNI_OK);
7394 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7395 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7396 LDKFundingSigned msg_var = *msg;
7397 msg_var = FundingSigned_clone(msg);
7398 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7399 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7400 uint64_t msg_ref = (uint64_t)msg_var.inner;
7401 if (msg_var.is_owned) {
7404 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7406 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
7407 if ((*env)->ExceptionCheck(env)) {
7408 (*env)->ExceptionDescribe(env);
7409 (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception.");
7411 if (get_jenv_res == JNI_EDETACHED) {
7412 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7415 void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
7416 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7418 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7419 if (get_jenv_res == JNI_EDETACHED) {
7420 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7422 DO_ASSERT(get_jenv_res == JNI_OK);
7424 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7425 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7426 LDKFundingLocked msg_var = *msg;
7427 msg_var = FundingLocked_clone(msg);
7428 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7429 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7430 uint64_t msg_ref = (uint64_t)msg_var.inner;
7431 if (msg_var.is_owned) {
7434 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7436 (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
7437 if ((*env)->ExceptionCheck(env)) {
7438 (*env)->ExceptionDescribe(env);
7439 (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception.");
7441 if (get_jenv_res == JNI_EDETACHED) {
7442 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7445 void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInitFeatures * their_features, const LDKShutdown * msg) {
7446 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7448 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7449 if (get_jenv_res == JNI_EDETACHED) {
7450 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7452 DO_ASSERT(get_jenv_res == JNI_OK);
7454 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7455 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7456 LDKInitFeatures their_features_var = *their_features;
7457 their_features_var = InitFeatures_clone(their_features);
7458 CHECK((((uint64_t)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7459 CHECK((((uint64_t)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7460 uint64_t their_features_ref = (uint64_t)their_features_var.inner;
7461 if (their_features_var.is_owned) {
7462 their_features_ref |= 1;
7464 LDKShutdown msg_var = *msg;
7465 msg_var = Shutdown_clone(msg);
7466 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7467 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7468 uint64_t msg_ref = (uint64_t)msg_var.inner;
7469 if (msg_var.is_owned) {
7472 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7474 (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref);
7475 if ((*env)->ExceptionCheck(env)) {
7476 (*env)->ExceptionDescribe(env);
7477 (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception.");
7479 if (get_jenv_res == JNI_EDETACHED) {
7480 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7483 void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
7484 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7486 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7487 if (get_jenv_res == JNI_EDETACHED) {
7488 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7490 DO_ASSERT(get_jenv_res == JNI_OK);
7492 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7493 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7494 LDKClosingSigned msg_var = *msg;
7495 msg_var = ClosingSigned_clone(msg);
7496 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7497 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7498 uint64_t msg_ref = (uint64_t)msg_var.inner;
7499 if (msg_var.is_owned) {
7502 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7504 (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
7505 if ((*env)->ExceptionCheck(env)) {
7506 (*env)->ExceptionDescribe(env);
7507 (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception.");
7509 if (get_jenv_res == JNI_EDETACHED) {
7510 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7513 void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
7514 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7516 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7517 if (get_jenv_res == JNI_EDETACHED) {
7518 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7520 DO_ASSERT(get_jenv_res == JNI_OK);
7522 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7523 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7524 LDKUpdateAddHTLC msg_var = *msg;
7525 msg_var = UpdateAddHTLC_clone(msg);
7526 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7527 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7528 uint64_t msg_ref = (uint64_t)msg_var.inner;
7529 if (msg_var.is_owned) {
7532 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7534 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
7535 if ((*env)->ExceptionCheck(env)) {
7536 (*env)->ExceptionDescribe(env);
7537 (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception.");
7539 if (get_jenv_res == JNI_EDETACHED) {
7540 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7543 void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
7544 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7546 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7547 if (get_jenv_res == JNI_EDETACHED) {
7548 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7550 DO_ASSERT(get_jenv_res == JNI_OK);
7552 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7553 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7554 LDKUpdateFulfillHTLC msg_var = *msg;
7555 msg_var = UpdateFulfillHTLC_clone(msg);
7556 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7557 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7558 uint64_t msg_ref = (uint64_t)msg_var.inner;
7559 if (msg_var.is_owned) {
7562 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7564 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
7565 if ((*env)->ExceptionCheck(env)) {
7566 (*env)->ExceptionDescribe(env);
7567 (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception.");
7569 if (get_jenv_res == JNI_EDETACHED) {
7570 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7573 void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
7574 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7576 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7577 if (get_jenv_res == JNI_EDETACHED) {
7578 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7580 DO_ASSERT(get_jenv_res == JNI_OK);
7582 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7583 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7584 LDKUpdateFailHTLC msg_var = *msg;
7585 msg_var = UpdateFailHTLC_clone(msg);
7586 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7587 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7588 uint64_t msg_ref = (uint64_t)msg_var.inner;
7589 if (msg_var.is_owned) {
7592 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7594 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
7595 if ((*env)->ExceptionCheck(env)) {
7596 (*env)->ExceptionDescribe(env);
7597 (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception.");
7599 if (get_jenv_res == JNI_EDETACHED) {
7600 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7603 void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
7604 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7606 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7607 if (get_jenv_res == JNI_EDETACHED) {
7608 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7610 DO_ASSERT(get_jenv_res == JNI_OK);
7612 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7613 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7614 LDKUpdateFailMalformedHTLC msg_var = *msg;
7615 msg_var = UpdateFailMalformedHTLC_clone(msg);
7616 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7617 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7618 uint64_t msg_ref = (uint64_t)msg_var.inner;
7619 if (msg_var.is_owned) {
7622 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7624 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
7625 if ((*env)->ExceptionCheck(env)) {
7626 (*env)->ExceptionDescribe(env);
7627 (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception.");
7629 if (get_jenv_res == JNI_EDETACHED) {
7630 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7633 void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
7634 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7636 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7637 if (get_jenv_res == JNI_EDETACHED) {
7638 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7640 DO_ASSERT(get_jenv_res == JNI_OK);
7642 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7643 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7644 LDKCommitmentSigned msg_var = *msg;
7645 msg_var = CommitmentSigned_clone(msg);
7646 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7647 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7648 uint64_t msg_ref = (uint64_t)msg_var.inner;
7649 if (msg_var.is_owned) {
7652 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7654 (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
7655 if ((*env)->ExceptionCheck(env)) {
7656 (*env)->ExceptionDescribe(env);
7657 (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception.");
7659 if (get_jenv_res == JNI_EDETACHED) {
7660 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7663 void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
7664 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7666 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7667 if (get_jenv_res == JNI_EDETACHED) {
7668 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7670 DO_ASSERT(get_jenv_res == JNI_OK);
7672 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7673 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7674 LDKRevokeAndACK msg_var = *msg;
7675 msg_var = RevokeAndACK_clone(msg);
7676 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7677 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7678 uint64_t msg_ref = (uint64_t)msg_var.inner;
7679 if (msg_var.is_owned) {
7682 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7684 (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
7685 if ((*env)->ExceptionCheck(env)) {
7686 (*env)->ExceptionDescribe(env);
7687 (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception.");
7689 if (get_jenv_res == JNI_EDETACHED) {
7690 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7693 void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
7694 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7696 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7697 if (get_jenv_res == JNI_EDETACHED) {
7698 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7700 DO_ASSERT(get_jenv_res == JNI_OK);
7702 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7703 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7704 LDKUpdateFee msg_var = *msg;
7705 msg_var = UpdateFee_clone(msg);
7706 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7707 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7708 uint64_t msg_ref = (uint64_t)msg_var.inner;
7709 if (msg_var.is_owned) {
7712 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7714 (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
7715 if ((*env)->ExceptionCheck(env)) {
7716 (*env)->ExceptionDescribe(env);
7717 (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception.");
7719 if (get_jenv_res == JNI_EDETACHED) {
7720 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7723 void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
7724 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7726 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7727 if (get_jenv_res == JNI_EDETACHED) {
7728 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7730 DO_ASSERT(get_jenv_res == JNI_OK);
7732 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7733 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7734 LDKAnnouncementSignatures msg_var = *msg;
7735 msg_var = AnnouncementSignatures_clone(msg);
7736 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7737 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7738 uint64_t msg_ref = (uint64_t)msg_var.inner;
7739 if (msg_var.is_owned) {
7742 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7744 (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
7745 if ((*env)->ExceptionCheck(env)) {
7746 (*env)->ExceptionDescribe(env);
7747 (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception.");
7749 if (get_jenv_res == JNI_EDETACHED) {
7750 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7753 void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
7754 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7756 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7757 if (get_jenv_res == JNI_EDETACHED) {
7758 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7760 DO_ASSERT(get_jenv_res == JNI_OK);
7762 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7763 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7764 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7766 (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
7767 if ((*env)->ExceptionCheck(env)) {
7768 (*env)->ExceptionDescribe(env);
7769 (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception.");
7771 if (get_jenv_res == JNI_EDETACHED) {
7772 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7775 void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
7776 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7778 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7779 if (get_jenv_res == JNI_EDETACHED) {
7780 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7782 DO_ASSERT(get_jenv_res == JNI_OK);
7784 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7785 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7786 LDKInit msg_var = *msg;
7787 msg_var = Init_clone(msg);
7788 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7789 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7790 uint64_t msg_ref = (uint64_t)msg_var.inner;
7791 if (msg_var.is_owned) {
7794 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7796 (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
7797 if ((*env)->ExceptionCheck(env)) {
7798 (*env)->ExceptionDescribe(env);
7799 (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception.");
7801 if (get_jenv_res == JNI_EDETACHED) {
7802 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7805 void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
7806 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7808 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7809 if (get_jenv_res == JNI_EDETACHED) {
7810 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7812 DO_ASSERT(get_jenv_res == JNI_OK);
7814 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7815 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7816 LDKChannelReestablish msg_var = *msg;
7817 msg_var = ChannelReestablish_clone(msg);
7818 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7819 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7820 uint64_t msg_ref = (uint64_t)msg_var.inner;
7821 if (msg_var.is_owned) {
7824 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7826 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
7827 if ((*env)->ExceptionCheck(env)) {
7828 (*env)->ExceptionDescribe(env);
7829 (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception.");
7831 if (get_jenv_res == JNI_EDETACHED) {
7832 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7835 void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelUpdate * msg) {
7836 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7838 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7839 if (get_jenv_res == JNI_EDETACHED) {
7840 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7842 DO_ASSERT(get_jenv_res == JNI_OK);
7844 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7845 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7846 LDKChannelUpdate msg_var = *msg;
7847 msg_var = ChannelUpdate_clone(msg);
7848 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7849 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7850 uint64_t msg_ref = (uint64_t)msg_var.inner;
7851 if (msg_var.is_owned) {
7854 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7856 (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref);
7857 if ((*env)->ExceptionCheck(env)) {
7858 (*env)->ExceptionDescribe(env);
7859 (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception.");
7861 if (get_jenv_res == JNI_EDETACHED) {
7862 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7865 void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
7866 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
7868 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
7869 if (get_jenv_res == JNI_EDETACHED) {
7870 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
7872 DO_ASSERT(get_jenv_res == JNI_OK);
7874 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
7875 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
7876 LDKErrorMessage msg_var = *msg;
7877 msg_var = ErrorMessage_clone(msg);
7878 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7879 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7880 uint64_t msg_ref = (uint64_t)msg_var.inner;
7881 if (msg_var.is_owned) {
7884 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
7886 (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
7887 if ((*env)->ExceptionCheck(env)) {
7888 (*env)->ExceptionDescribe(env);
7889 (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception.");
7891 if (get_jenv_res == JNI_EDETACHED) {
7892 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
7895 static void LDKChannelMessageHandler_JCalls_cloned(LDKChannelMessageHandler* new_obj) {
7896 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) new_obj->this_arg;
7897 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
7898 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
7900 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7901 jclass c = (*env)->GetObjectClass(env, o);
7903 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
7904 atomic_init(&calls->refcnt, 1);
7905 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
7906 calls->o = (*env)->NewWeakGlobalRef(env, o);
7907 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
7908 CHECK(calls->handle_open_channel_meth != NULL);
7909 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
7910 CHECK(calls->handle_accept_channel_meth != NULL);
7911 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
7912 CHECK(calls->handle_funding_created_meth != NULL);
7913 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
7914 CHECK(calls->handle_funding_signed_meth != NULL);
7915 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
7916 CHECK(calls->handle_funding_locked_meth != NULL);
7917 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJJ)V");
7918 CHECK(calls->handle_shutdown_meth != NULL);
7919 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
7920 CHECK(calls->handle_closing_signed_meth != NULL);
7921 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
7922 CHECK(calls->handle_update_add_htlc_meth != NULL);
7923 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
7924 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
7925 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
7926 CHECK(calls->handle_update_fail_htlc_meth != NULL);
7927 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
7928 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
7929 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
7930 CHECK(calls->handle_commitment_signed_meth != NULL);
7931 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
7932 CHECK(calls->handle_revoke_and_ack_meth != NULL);
7933 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
7934 CHECK(calls->handle_update_fee_meth != NULL);
7935 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
7936 CHECK(calls->handle_announcement_signatures_meth != NULL);
7937 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
7938 CHECK(calls->peer_disconnected_meth != NULL);
7939 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
7940 CHECK(calls->peer_connected_meth != NULL);
7941 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
7942 CHECK(calls->handle_channel_reestablish_meth != NULL);
7943 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "([BJ)V");
7944 CHECK(calls->handle_channel_update_meth != NULL);
7945 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
7946 CHECK(calls->handle_error_meth != NULL);
7948 LDKChannelMessageHandler ret = {
7949 .this_arg = (void*) calls,
7950 .handle_open_channel = handle_open_channel_LDKChannelMessageHandler_jcall,
7951 .handle_accept_channel = handle_accept_channel_LDKChannelMessageHandler_jcall,
7952 .handle_funding_created = handle_funding_created_LDKChannelMessageHandler_jcall,
7953 .handle_funding_signed = handle_funding_signed_LDKChannelMessageHandler_jcall,
7954 .handle_funding_locked = handle_funding_locked_LDKChannelMessageHandler_jcall,
7955 .handle_shutdown = handle_shutdown_LDKChannelMessageHandler_jcall,
7956 .handle_closing_signed = handle_closing_signed_LDKChannelMessageHandler_jcall,
7957 .handle_update_add_htlc = handle_update_add_htlc_LDKChannelMessageHandler_jcall,
7958 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall,
7959 .handle_update_fail_htlc = handle_update_fail_htlc_LDKChannelMessageHandler_jcall,
7960 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall,
7961 .handle_commitment_signed = handle_commitment_signed_LDKChannelMessageHandler_jcall,
7962 .handle_revoke_and_ack = handle_revoke_and_ack_LDKChannelMessageHandler_jcall,
7963 .handle_update_fee = handle_update_fee_LDKChannelMessageHandler_jcall,
7964 .handle_announcement_signatures = handle_announcement_signatures_LDKChannelMessageHandler_jcall,
7965 .peer_disconnected = peer_disconnected_LDKChannelMessageHandler_jcall,
7966 .peer_connected = peer_connected_LDKChannelMessageHandler_jcall,
7967 .handle_channel_reestablish = handle_channel_reestablish_LDKChannelMessageHandler_jcall,
7968 .handle_channel_update = handle_channel_update_LDKChannelMessageHandler_jcall,
7969 .handle_error = handle_error_LDKChannelMessageHandler_jcall,
7970 .free = LDKChannelMessageHandler_JCalls_free,
7971 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
7973 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
7976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
7977 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7978 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
7979 return (uint64_t)res_ptr;
7981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
7982 LDKChannelMessageHandler *inp = (LDKChannelMessageHandler *)(arg & ~1);
7983 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
7984 DO_ASSERT((res_ptr & 1) == 0);
7985 return (int64_t)(res_ptr | 1);
7987 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) {
7988 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
7989 LDKPublicKey their_node_id_ref;
7990 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
7991 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
7992 LDKInitFeatures their_features_conv;
7993 their_features_conv.inner = (void*)(their_features & (~1));
7994 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
7995 their_features_conv = InitFeatures_clone(&their_features_conv);
7996 LDKOpenChannel msg_conv;
7997 msg_conv.inner = (void*)(msg & (~1));
7998 msg_conv.is_owned = false;
7999 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8002 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) {
8003 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8004 LDKPublicKey their_node_id_ref;
8005 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8006 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8007 LDKInitFeatures their_features_conv;
8008 their_features_conv.inner = (void*)(their_features & (~1));
8009 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
8010 their_features_conv = InitFeatures_clone(&their_features_conv);
8011 LDKAcceptChannel msg_conv;
8012 msg_conv.inner = (void*)(msg & (~1));
8013 msg_conv.is_owned = false;
8014 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
8017 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) {
8018 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8019 LDKPublicKey their_node_id_ref;
8020 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8021 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8022 LDKFundingCreated msg_conv;
8023 msg_conv.inner = (void*)(msg & (~1));
8024 msg_conv.is_owned = false;
8025 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8028 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) {
8029 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8030 LDKPublicKey their_node_id_ref;
8031 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8032 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8033 LDKFundingSigned msg_conv;
8034 msg_conv.inner = (void*)(msg & (~1));
8035 msg_conv.is_owned = false;
8036 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8039 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) {
8040 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8041 LDKPublicKey their_node_id_ref;
8042 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8043 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8044 LDKFundingLocked msg_conv;
8045 msg_conv.inner = (void*)(msg & (~1));
8046 msg_conv.is_owned = false;
8047 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8050 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 their_features, int64_t msg) {
8051 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8052 LDKPublicKey their_node_id_ref;
8053 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8054 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8055 LDKInitFeatures their_features_conv;
8056 their_features_conv.inner = (void*)(their_features & (~1));
8057 their_features_conv.is_owned = false;
8058 LDKShutdown msg_conv;
8059 msg_conv.inner = (void*)(msg & (~1));
8060 msg_conv.is_owned = false;
8061 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &their_features_conv, &msg_conv);
8064 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) {
8065 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8066 LDKPublicKey their_node_id_ref;
8067 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8068 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8069 LDKClosingSigned msg_conv;
8070 msg_conv.inner = (void*)(msg & (~1));
8071 msg_conv.is_owned = false;
8072 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8075 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) {
8076 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8077 LDKPublicKey their_node_id_ref;
8078 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8079 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8080 LDKUpdateAddHTLC msg_conv;
8081 msg_conv.inner = (void*)(msg & (~1));
8082 msg_conv.is_owned = false;
8083 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8086 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) {
8087 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8088 LDKPublicKey their_node_id_ref;
8089 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8090 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8091 LDKUpdateFulfillHTLC msg_conv;
8092 msg_conv.inner = (void*)(msg & (~1));
8093 msg_conv.is_owned = false;
8094 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8097 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) {
8098 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8099 LDKPublicKey their_node_id_ref;
8100 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8101 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8102 LDKUpdateFailHTLC msg_conv;
8103 msg_conv.inner = (void*)(msg & (~1));
8104 msg_conv.is_owned = false;
8105 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8108 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) {
8109 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8110 LDKPublicKey their_node_id_ref;
8111 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8112 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8113 LDKUpdateFailMalformedHTLC msg_conv;
8114 msg_conv.inner = (void*)(msg & (~1));
8115 msg_conv.is_owned = false;
8116 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8119 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) {
8120 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8121 LDKPublicKey their_node_id_ref;
8122 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8123 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8124 LDKCommitmentSigned msg_conv;
8125 msg_conv.inner = (void*)(msg & (~1));
8126 msg_conv.is_owned = false;
8127 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8130 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) {
8131 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8132 LDKPublicKey their_node_id_ref;
8133 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8134 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8135 LDKRevokeAndACK msg_conv;
8136 msg_conv.inner = (void*)(msg & (~1));
8137 msg_conv.is_owned = false;
8138 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8141 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) {
8142 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8143 LDKPublicKey their_node_id_ref;
8144 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8145 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8146 LDKUpdateFee msg_conv;
8147 msg_conv.inner = (void*)(msg & (~1));
8148 msg_conv.is_owned = false;
8149 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8152 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) {
8153 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8154 LDKPublicKey their_node_id_ref;
8155 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8156 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8157 LDKAnnouncementSignatures msg_conv;
8158 msg_conv.inner = (void*)(msg & (~1));
8159 msg_conv.is_owned = false;
8160 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8163 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) {
8164 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8165 LDKPublicKey their_node_id_ref;
8166 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8167 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8168 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
8171 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) {
8172 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8173 LDKPublicKey their_node_id_ref;
8174 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8175 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8177 msg_conv.inner = (void*)(msg & (~1));
8178 msg_conv.is_owned = false;
8179 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8182 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) {
8183 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8184 LDKPublicKey their_node_id_ref;
8185 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8186 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8187 LDKChannelReestablish msg_conv;
8188 msg_conv.inner = (void*)(msg & (~1));
8189 msg_conv.is_owned = false;
8190 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
8194 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8195 LDKPublicKey their_node_id_ref;
8196 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8197 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8198 LDKChannelUpdate msg_conv;
8199 msg_conv.inner = (void*)(msg & (~1));
8200 msg_conv.is_owned = false;
8201 (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8204 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) {
8205 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)(((uint64_t)this_arg) & ~1);
8206 LDKPublicKey their_node_id_ref;
8207 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8208 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8209 LDKErrorMessage msg_conv;
8210 msg_conv.inner = (void*)(msg & (~1));
8211 msg_conv.is_owned = false;
8212 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
8215 typedef struct LDKRoutingMessageHandler_JCalls {
8216 atomic_size_t refcnt;
8219 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
8220 jmethodID handle_node_announcement_meth;
8221 jmethodID handle_channel_announcement_meth;
8222 jmethodID handle_channel_update_meth;
8223 jmethodID handle_htlc_fail_channel_update_meth;
8224 jmethodID get_next_channel_announcements_meth;
8225 jmethodID get_next_node_announcements_meth;
8226 jmethodID sync_routing_table_meth;
8227 jmethodID handle_reply_channel_range_meth;
8228 jmethodID handle_reply_short_channel_ids_end_meth;
8229 jmethodID handle_query_channel_range_meth;
8230 jmethodID handle_query_short_channel_ids_meth;
8231 } LDKRoutingMessageHandler_JCalls;
8232 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
8233 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8234 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8236 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8237 if (get_jenv_res == JNI_EDETACHED) {
8238 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8240 DO_ASSERT(get_jenv_res == JNI_OK);
8242 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8243 if (get_jenv_res == JNI_EDETACHED) {
8244 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8249 LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
8250 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8252 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8253 if (get_jenv_res == JNI_EDETACHED) {
8254 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8256 DO_ASSERT(get_jenv_res == JNI_OK);
8258 LDKNodeAnnouncement msg_var = *msg;
8259 msg_var = NodeAnnouncement_clone(msg);
8260 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8261 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8262 uint64_t msg_ref = (uint64_t)msg_var.inner;
8263 if (msg_var.is_owned) {
8266 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8268 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
8269 if ((*env)->ExceptionCheck(env)) {
8270 (*env)->ExceptionDescribe(env);
8271 (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8273 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8274 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8275 if (get_jenv_res == JNI_EDETACHED) {
8276 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8280 LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
8281 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8283 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8284 if (get_jenv_res == JNI_EDETACHED) {
8285 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8287 DO_ASSERT(get_jenv_res == JNI_OK);
8289 LDKChannelAnnouncement msg_var = *msg;
8290 msg_var = ChannelAnnouncement_clone(msg);
8291 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8292 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8293 uint64_t msg_ref = (uint64_t)msg_var.inner;
8294 if (msg_var.is_owned) {
8297 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8299 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
8300 if ((*env)->ExceptionCheck(env)) {
8301 (*env)->ExceptionDescribe(env);
8302 (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception.");
8304 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8305 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8306 if (get_jenv_res == JNI_EDETACHED) {
8307 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8311 LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
8312 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8314 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8315 if (get_jenv_res == JNI_EDETACHED) {
8316 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8318 DO_ASSERT(get_jenv_res == JNI_OK);
8320 LDKChannelUpdate msg_var = *msg;
8321 msg_var = ChannelUpdate_clone(msg);
8322 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8323 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8324 uint64_t msg_ref = (uint64_t)msg_var.inner;
8325 if (msg_var.is_owned) {
8328 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8330 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
8331 if ((*env)->ExceptionCheck(env)) {
8332 (*env)->ExceptionDescribe(env);
8333 (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8335 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1);
8336 ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
8337 if (get_jenv_res == JNI_EDETACHED) {
8338 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8342 void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
8343 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8345 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8346 if (get_jenv_res == JNI_EDETACHED) {
8347 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8349 DO_ASSERT(get_jenv_res == JNI_OK);
8351 uint64_t ret_update = (uint64_t)update;
8352 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8354 (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
8355 if ((*env)->ExceptionCheck(env)) {
8356 (*env)->ExceptionDescribe(env);
8357 (*env)->FatalError(env, "A call to handle_htlc_fail_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
8359 if (get_jenv_res == JNI_EDETACHED) {
8360 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8363 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
8364 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8366 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8367 if (get_jenv_res == JNI_EDETACHED) {
8368 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8370 DO_ASSERT(get_jenv_res == JNI_OK);
8372 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8374 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
8375 if ((*env)->ExceptionCheck(env)) {
8376 (*env)->ExceptionDescribe(env);
8377 (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8379 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
8380 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8381 if (ret_constr.datalen > 0)
8382 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
8384 ret_constr.data = NULL;
8385 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8386 for (size_t l = 0; l < ret_constr.datalen; l++) {
8387 int64_t ret_conv_63 = ret_vals[l];
8388 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1);
8389 ret_conv_63_conv = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone((LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)ret_conv_63) & ~1));
8390 ret_constr.data[l] = ret_conv_63_conv;
8392 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8393 if (get_jenv_res == JNI_EDETACHED) {
8394 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8398 LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
8399 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8401 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8402 if (get_jenv_res == JNI_EDETACHED) {
8403 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8405 DO_ASSERT(get_jenv_res == JNI_OK);
8407 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
8408 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
8409 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8411 int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
8412 if ((*env)->ExceptionCheck(env)) {
8413 (*env)->ExceptionDescribe(env);
8414 (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception.");
8416 LDKCVec_NodeAnnouncementZ ret_constr;
8417 ret_constr.datalen = (*env)->GetArrayLength(env, ret);
8418 if (ret_constr.datalen > 0)
8419 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
8421 ret_constr.data = NULL;
8422 int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
8423 for (size_t s = 0; s < ret_constr.datalen; s++) {
8424 int64_t ret_conv_18 = ret_vals[s];
8425 LDKNodeAnnouncement ret_conv_18_conv;
8426 ret_conv_18_conv.inner = (void*)(ret_conv_18 & (~1));
8427 ret_conv_18_conv.is_owned = (ret_conv_18 & 1) || (ret_conv_18 == 0);
8428 ret_conv_18_conv = NodeAnnouncement_clone(&ret_conv_18_conv);
8429 ret_constr.data[s] = ret_conv_18_conv;
8431 (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
8432 if (get_jenv_res == JNI_EDETACHED) {
8433 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8437 void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
8438 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8440 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8441 if (get_jenv_res == JNI_EDETACHED) {
8442 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8444 DO_ASSERT(get_jenv_res == JNI_OK);
8446 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8447 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8448 LDKInit init_var = *init;
8449 init_var = Init_clone(init);
8450 CHECK((((uint64_t)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8451 CHECK((((uint64_t)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8452 uint64_t init_ref = (uint64_t)init_var.inner;
8453 if (init_var.is_owned) {
8456 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8458 (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
8459 if ((*env)->ExceptionCheck(env)) {
8460 (*env)->ExceptionDescribe(env);
8461 (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception.");
8463 if (get_jenv_res == JNI_EDETACHED) {
8464 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8467 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
8468 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8470 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8471 if (get_jenv_res == JNI_EDETACHED) {
8472 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8474 DO_ASSERT(get_jenv_res == JNI_OK);
8476 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8477 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8478 LDKReplyChannelRange msg_var = msg;
8479 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8480 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8481 uint64_t msg_ref = (uint64_t)msg_var.inner;
8482 if (msg_var.is_owned) {
8485 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8487 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
8488 if ((*env)->ExceptionCheck(env)) {
8489 (*env)->ExceptionDescribe(env);
8490 (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
8492 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8493 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8494 if (get_jenv_res == JNI_EDETACHED) {
8495 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8499 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
8500 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8502 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8503 if (get_jenv_res == JNI_EDETACHED) {
8504 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8506 DO_ASSERT(get_jenv_res == JNI_OK);
8508 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8509 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8510 LDKReplyShortChannelIdsEnd msg_var = msg;
8511 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8512 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8513 uint64_t msg_ref = (uint64_t)msg_var.inner;
8514 if (msg_var.is_owned) {
8517 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8519 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
8520 if ((*env)->ExceptionCheck(env)) {
8521 (*env)->ExceptionDescribe(env);
8522 (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception.");
8524 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8525 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8526 if (get_jenv_res == JNI_EDETACHED) {
8527 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8531 LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
8532 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8534 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8535 if (get_jenv_res == JNI_EDETACHED) {
8536 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8538 DO_ASSERT(get_jenv_res == JNI_OK);
8540 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8541 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8542 LDKQueryChannelRange msg_var = msg;
8543 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8544 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8545 uint64_t msg_ref = (uint64_t)msg_var.inner;
8546 if (msg_var.is_owned) {
8549 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8551 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
8552 if ((*env)->ExceptionCheck(env)) {
8553 (*env)->ExceptionDescribe(env);
8554 (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception.");
8556 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8557 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8558 if (get_jenv_res == JNI_EDETACHED) {
8559 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8563 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
8564 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
8566 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8567 if (get_jenv_res == JNI_EDETACHED) {
8568 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8570 DO_ASSERT(get_jenv_res == JNI_OK);
8572 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
8573 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
8574 LDKQueryShortChannelIds msg_var = msg;
8575 CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8576 CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8577 uint64_t msg_ref = (uint64_t)msg_var.inner;
8578 if (msg_var.is_owned) {
8581 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8583 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
8584 if ((*env)->ExceptionCheck(env)) {
8585 (*env)->ExceptionDescribe(env);
8586 (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception.");
8588 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
8589 ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
8590 if (get_jenv_res == JNI_EDETACHED) {
8591 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8595 static void LDKRoutingMessageHandler_JCalls_cloned(LDKRoutingMessageHandler* new_obj) {
8596 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) new_obj->this_arg;
8597 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8598 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
8600 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8601 jclass c = (*env)->GetObjectClass(env, o);
8603 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
8604 atomic_init(&calls->refcnt, 1);
8605 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8606 calls->o = (*env)->NewWeakGlobalRef(env, o);
8607 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
8608 CHECK(calls->handle_node_announcement_meth != NULL);
8609 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
8610 CHECK(calls->handle_channel_announcement_meth != NULL);
8611 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
8612 CHECK(calls->handle_channel_update_meth != NULL);
8613 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
8614 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
8615 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
8616 CHECK(calls->get_next_channel_announcements_meth != NULL);
8617 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
8618 CHECK(calls->get_next_node_announcements_meth != NULL);
8619 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
8620 CHECK(calls->sync_routing_table_meth != NULL);
8621 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
8622 CHECK(calls->handle_reply_channel_range_meth != NULL);
8623 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
8624 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
8625 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
8626 CHECK(calls->handle_query_channel_range_meth != NULL);
8627 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
8628 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
8630 LDKRoutingMessageHandler ret = {
8631 .this_arg = (void*) calls,
8632 .handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
8633 .handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
8634 .handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
8635 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
8636 .get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
8637 .get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
8638 .sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
8639 .handle_reply_channel_range = handle_reply_channel_range_LDKRoutingMessageHandler_jcall,
8640 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_LDKRoutingMessageHandler_jcall,
8641 .handle_query_channel_range = handle_query_channel_range_LDKRoutingMessageHandler_jcall,
8642 .handle_query_short_channel_ids = handle_query_short_channel_ids_LDKRoutingMessageHandler_jcall,
8643 .free = LDKRoutingMessageHandler_JCalls_free,
8644 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
8646 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
8649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
8650 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
8651 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
8652 return (uint64_t)res_ptr;
8654 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t arg) {
8655 LDKRoutingMessageHandler *inp = (LDKRoutingMessageHandler *)(arg & ~1);
8656 uint64_t res_ptr = (uint64_t)&inp->MessageSendEventsProvider;
8657 DO_ASSERT((res_ptr & 1) == 0);
8658 return (int64_t)(res_ptr | 1);
8660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8661 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8662 LDKNodeAnnouncement msg_conv;
8663 msg_conv.inner = (void*)(msg & (~1));
8664 msg_conv.is_owned = false;
8665 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8666 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
8667 return (uint64_t)ret_conv;
8670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8671 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8672 LDKChannelAnnouncement msg_conv;
8673 msg_conv.inner = (void*)(msg & (~1));
8674 msg_conv.is_owned = false;
8675 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8676 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
8677 return (uint64_t)ret_conv;
8680 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
8681 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8682 LDKChannelUpdate msg_conv;
8683 msg_conv.inner = (void*)(msg & (~1));
8684 msg_conv.is_owned = false;
8685 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
8686 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
8687 return (uint64_t)ret_conv;
8690 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) {
8691 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8692 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
8693 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
8696 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) {
8697 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8698 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
8699 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8700 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8701 for (size_t l = 0; l < ret_var.datalen; l++) {
8702 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
8703 *ret_conv_63_ref = ret_var.data[l];
8704 ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
8706 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8711 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) {
8712 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8713 LDKPublicKey starting_point_ref;
8714 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
8715 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
8716 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
8717 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8718 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8719 for (size_t s = 0; s < ret_var.datalen; s++) {
8720 LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
8721 CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8722 CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8723 uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
8724 if (ret_conv_18_var.is_owned) {
8725 ret_conv_18_ref |= 1;
8727 ret_arr_ptr[s] = ret_conv_18_ref;
8729 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8734 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) {
8735 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8736 LDKPublicKey their_node_id_ref;
8737 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8738 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8740 init_conv.inner = (void*)(init & (~1));
8741 init_conv.is_owned = false;
8742 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
8745 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) {
8746 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8747 LDKPublicKey their_node_id_ref;
8748 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8749 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8750 LDKReplyChannelRange msg_conv;
8751 msg_conv.inner = (void*)(msg & (~1));
8752 msg_conv.is_owned = (msg & 1) || (msg == 0);
8753 msg_conv = ReplyChannelRange_clone(&msg_conv);
8754 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8755 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8756 return (uint64_t)ret_conv;
8759 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) {
8760 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8761 LDKPublicKey their_node_id_ref;
8762 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8763 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8764 LDKReplyShortChannelIdsEnd msg_conv;
8765 msg_conv.inner = (void*)(msg & (~1));
8766 msg_conv.is_owned = (msg & 1) || (msg == 0);
8767 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
8768 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8769 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8770 return (uint64_t)ret_conv;
8773 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) {
8774 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8775 LDKPublicKey their_node_id_ref;
8776 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8777 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8778 LDKQueryChannelRange msg_conv;
8779 msg_conv.inner = (void*)(msg & (~1));
8780 msg_conv.is_owned = (msg & 1) || (msg == 0);
8781 msg_conv = QueryChannelRange_clone(&msg_conv);
8782 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8783 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8784 return (uint64_t)ret_conv;
8787 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) {
8788 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
8789 LDKPublicKey their_node_id_ref;
8790 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
8791 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
8792 LDKQueryShortChannelIds msg_conv;
8793 msg_conv.inner = (void*)(msg & (~1));
8794 msg_conv.is_owned = (msg & 1) || (msg == 0);
8795 msg_conv = QueryShortChannelIds_clone(&msg_conv);
8796 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
8797 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
8798 return (uint64_t)ret_conv;
8801 typedef struct LDKSocketDescriptor_JCalls {
8802 atomic_size_t refcnt;
8805 jmethodID send_data_meth;
8806 jmethodID disconnect_socket_meth;
8808 jmethodID hash_meth;
8809 } LDKSocketDescriptor_JCalls;
8810 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
8811 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8812 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8814 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8815 if (get_jenv_res == JNI_EDETACHED) {
8816 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8818 DO_ASSERT(get_jenv_res == JNI_OK);
8820 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8821 if (get_jenv_res == JNI_EDETACHED) {
8822 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8827 uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
8828 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8830 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8831 if (get_jenv_res == JNI_EDETACHED) {
8832 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8834 DO_ASSERT(get_jenv_res == JNI_OK);
8836 LDKu8slice data_var = data;
8837 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
8838 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
8839 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8841 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
8842 if ((*env)->ExceptionCheck(env)) {
8843 (*env)->ExceptionDescribe(env);
8844 (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception.");
8846 if (get_jenv_res == JNI_EDETACHED) {
8847 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8851 void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) {
8852 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8854 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8855 if (get_jenv_res == JNI_EDETACHED) {
8856 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8858 DO_ASSERT(get_jenv_res == JNI_OK);
8860 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8862 (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
8863 if ((*env)->ExceptionCheck(env)) {
8864 (*env)->ExceptionDescribe(env);
8865 (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception.");
8867 if (get_jenv_res == JNI_EDETACHED) {
8868 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8871 bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
8872 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8874 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8875 if (get_jenv_res == JNI_EDETACHED) {
8876 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8878 DO_ASSERT(get_jenv_res == JNI_OK);
8880 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8881 *other_arg_clone = SocketDescriptor_clone(other_arg);
8882 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8884 jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone);
8885 if ((*env)->ExceptionCheck(env)) {
8886 (*env)->ExceptionDescribe(env);
8887 (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception.");
8889 if (get_jenv_res == JNI_EDETACHED) {
8890 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8894 uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) {
8895 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
8897 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8898 if (get_jenv_res == JNI_EDETACHED) {
8899 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8901 DO_ASSERT(get_jenv_res == JNI_OK);
8903 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
8905 int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
8906 if ((*env)->ExceptionCheck(env)) {
8907 (*env)->ExceptionDescribe(env);
8908 (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception.");
8910 if (get_jenv_res == JNI_EDETACHED) {
8911 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8915 static void LDKSocketDescriptor_JCalls_cloned(LDKSocketDescriptor* new_obj) {
8916 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) new_obj->this_arg;
8917 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
8919 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
8920 jclass c = (*env)->GetObjectClass(env, o);
8922 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
8923 atomic_init(&calls->refcnt, 1);
8924 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
8925 calls->o = (*env)->NewWeakGlobalRef(env, o);
8926 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
8927 CHECK(calls->send_data_meth != NULL);
8928 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
8929 CHECK(calls->disconnect_socket_meth != NULL);
8930 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
8931 CHECK(calls->eq_meth != NULL);
8932 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
8933 CHECK(calls->hash_meth != NULL);
8935 LDKSocketDescriptor ret = {
8936 .this_arg = (void*) calls,
8937 .send_data = send_data_LDKSocketDescriptor_jcall,
8938 .disconnect_socket = disconnect_socket_LDKSocketDescriptor_jcall,
8939 .eq = eq_LDKSocketDescriptor_jcall,
8940 .hash = hash_LDKSocketDescriptor_jcall,
8941 .cloned = LDKSocketDescriptor_JCalls_cloned,
8942 .free = LDKSocketDescriptor_JCalls_free,
8946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
8947 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
8948 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
8949 return (uint64_t)res_ptr;
8951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
8952 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8953 LDKu8slice data_ref;
8954 data_ref.datalen = (*env)->GetArrayLength(env, data);
8955 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
8956 int64_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
8957 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
8961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
8962 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8963 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
8966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
8967 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)(((uint64_t)this_arg) & ~1);
8968 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
8972 typedef struct LDKChannelManagerPersister_JCalls {
8973 atomic_size_t refcnt;
8976 jmethodID persist_manager_meth;
8977 } LDKChannelManagerPersister_JCalls;
8978 static void LDKChannelManagerPersister_JCalls_free(void* this_arg) {
8979 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8980 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
8982 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8983 if (get_jenv_res == JNI_EDETACHED) {
8984 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
8986 DO_ASSERT(get_jenv_res == JNI_OK);
8988 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
8989 if (get_jenv_res == JNI_EDETACHED) {
8990 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
8995 LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const void* this_arg, const LDKChannelManager * channel_manager) {
8996 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) this_arg;
8998 jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
8999 if (get_jenv_res == JNI_EDETACHED) {
9000 DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
9002 DO_ASSERT(get_jenv_res == JNI_OK);
9004 LDKChannelManager channel_manager_var = *channel_manager;
9005 // Warning: we may need a move here but no clone is available for LDKChannelManager
9006 CHECK((((uint64_t)channel_manager_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9007 CHECK((((uint64_t)&channel_manager_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9008 uint64_t channel_manager_ref = (uint64_t)channel_manager_var.inner;
9009 if (channel_manager_var.is_owned) {
9010 channel_manager_ref |= 1;
9012 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
9014 LDKCResult_NoneErrorZ* ret = (LDKCResult_NoneErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref);
9015 if ((*env)->ExceptionCheck(env)) {
9016 (*env)->ExceptionDescribe(env);
9017 (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception.");
9019 LDKCResult_NoneErrorZ ret_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1);
9020 ret_conv = CResult_NoneErrorZ_clone((LDKCResult_NoneErrorZ*)(((uint64_t)ret) & ~1));
9021 if (get_jenv_res == JNI_EDETACHED) {
9022 DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
9026 static void LDKChannelManagerPersister_JCalls_cloned(LDKChannelManagerPersister* new_obj) {
9027 LDKChannelManagerPersister_JCalls *j_calls = (LDKChannelManagerPersister_JCalls*) new_obj->this_arg;
9028 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
9030 static inline LDKChannelManagerPersister LDKChannelManagerPersister_init (JNIEnv *env, jclass clz, jobject o) {
9031 jclass c = (*env)->GetObjectClass(env, o);
9033 LDKChannelManagerPersister_JCalls *calls = MALLOC(sizeof(LDKChannelManagerPersister_JCalls), "LDKChannelManagerPersister_JCalls");
9034 atomic_init(&calls->refcnt, 1);
9035 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
9036 calls->o = (*env)->NewWeakGlobalRef(env, o);
9037 calls->persist_manager_meth = (*env)->GetMethodID(env, c, "persist_manager", "(J)J");
9038 CHECK(calls->persist_manager_meth != NULL);
9040 LDKChannelManagerPersister ret = {
9041 .this_arg = (void*) calls,
9042 .persist_manager = persist_manager_LDKChannelManagerPersister_jcall,
9043 .free = LDKChannelManagerPersister_JCalls_free,
9047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKChannelManagerPersister_1new(JNIEnv *env, jclass clz, jobject o) {
9048 LDKChannelManagerPersister *res_ptr = MALLOC(sizeof(LDKChannelManagerPersister), "LDKChannelManagerPersister");
9049 *res_ptr = LDKChannelManagerPersister_init(env, clz, o);
9050 return (uint64_t)res_ptr;
9052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1persist_1manager(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_manager) {
9053 LDKChannelManagerPersister* this_arg_conv = (LDKChannelManagerPersister*)(((uint64_t)this_arg) & ~1);
9054 LDKChannelManager channel_manager_conv;
9055 channel_manager_conv.inner = (void*)(channel_manager & (~1));
9056 channel_manager_conv.is_owned = false;
9057 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9058 *ret_conv = (this_arg_conv->persist_manager)(this_arg_conv->this_arg, &channel_manager_conv);
9059 return (uint64_t)ret_conv;
9062 static jclass LDKFallback_SegWitProgram_class = NULL;
9063 static jmethodID LDKFallback_SegWitProgram_meth = NULL;
9064 static jclass LDKFallback_PubKeyHash_class = NULL;
9065 static jmethodID LDKFallback_PubKeyHash_meth = NULL;
9066 static jclass LDKFallback_ScriptHash_class = NULL;
9067 static jmethodID LDKFallback_ScriptHash_meth = NULL;
9068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) {
9069 LDKFallback_SegWitProgram_class =
9070 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;"));
9071 CHECK(LDKFallback_SegWitProgram_class != NULL);
9072 LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "<init>", "(B[B)V");
9073 CHECK(LDKFallback_SegWitProgram_meth != NULL);
9074 LDKFallback_PubKeyHash_class =
9075 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;"));
9076 CHECK(LDKFallback_PubKeyHash_class != NULL);
9077 LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "<init>", "([B)V");
9078 CHECK(LDKFallback_PubKeyHash_meth != NULL);
9079 LDKFallback_ScriptHash_class =
9080 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;"));
9081 CHECK(LDKFallback_ScriptHash_class != NULL);
9082 LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "<init>", "([B)V");
9083 CHECK(LDKFallback_ScriptHash_meth != NULL);
9085 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFallback_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
9086 LDKFallback *obj = (LDKFallback*)(ptr & ~1);
9088 case LDKFallback_SegWitProgram: {
9089 uint8_t version_val = obj->seg_wit_program.version._0;
9090 LDKCVec_u8Z program_var = obj->seg_wit_program.program;
9091 int8_tArray program_arr = (*env)->NewByteArray(env, program_var.datalen);
9092 (*env)->SetByteArrayRegion(env, program_arr, 0, program_var.datalen, program_var.data);
9093 return (*env)->NewObject(env, LDKFallback_SegWitProgram_class, LDKFallback_SegWitProgram_meth, version_val, program_arr);
9095 case LDKFallback_PubKeyHash: {
9096 int8_tArray pub_key_hash_arr = (*env)->NewByteArray(env, 20);
9097 (*env)->SetByteArrayRegion(env, pub_key_hash_arr, 0, 20, obj->pub_key_hash.data);
9098 return (*env)->NewObject(env, LDKFallback_PubKeyHash_class, LDKFallback_PubKeyHash_meth, pub_key_hash_arr);
9100 case LDKFallback_ScriptHash: {
9101 int8_tArray script_hash_arr = (*env)->NewByteArray(env, 20);
9102 (*env)->SetByteArrayRegion(env, script_hash_arr, 0, 20, obj->script_hash.data);
9103 return (*env)->NewObject(env, LDKFallback_ScriptHash_class, LDKFallback_ScriptHash_meth, script_hash_arr);
9108 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9109 LDKStr ret_str = _ldk_get_compiled_version();
9110 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9115 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings__1ldk_1c_1bindings_1get_1compiled_1version(JNIEnv *env, jclass clz) {
9116 LDKStr ret_str = _ldk_c_bindings_get_compiled_version();
9117 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
9122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
9123 LDKTransaction _res_ref;
9124 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
9125 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
9126 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
9127 _res_ref.data_is_owned = true;
9128 Transaction_free(_res_ref);
9131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
9132 if ((_res & 1) != 0) return;
9133 LDKTxOut _res_conv = *(LDKTxOut*)(((uint64_t)_res) & ~1);
9135 TxOut_free(_res_conv);
9138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9139 LDKTxOut* orig_conv = (LDKTxOut*)(orig & ~1);
9140 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
9141 *ret_ref = TxOut_clone(orig_conv);
9142 return (uint64_t)ret_ref;
9145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Str_1free(JNIEnv *env, jclass clz, jstring _res) {
9146 LDKStr dummy = { .chars = NULL, .len = 0, .chars_is_owned = false };
9150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9152 CHECK((*env)->GetArrayLength(env, o) == 32);
9153 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
9154 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9155 *ret_conv = CResult_SecretKeyErrorZ_ok(o_ref);
9156 return (uint64_t)ret_conv;
9159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9160 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9161 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
9162 *ret_conv = CResult_SecretKeyErrorZ_err(e_conv);
9163 return (uint64_t)ret_conv;
9166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9167 if ((_res & 1) != 0) return;
9168 LDKCResult_SecretKeyErrorZ _res_conv = *(LDKCResult_SecretKeyErrorZ*)(((uint64_t)_res) & ~1);
9170 CResult_SecretKeyErrorZ_free(_res_conv);
9173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
9175 CHECK((*env)->GetArrayLength(env, o) == 33);
9176 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
9177 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9178 *ret_conv = CResult_PublicKeyErrorZ_ok(o_ref);
9179 return (uint64_t)ret_conv;
9182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9183 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9184 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9185 *ret_conv = CResult_PublicKeyErrorZ_err(e_conv);
9186 return (uint64_t)ret_conv;
9189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9190 if ((_res & 1) != 0) return;
9191 LDKCResult_PublicKeyErrorZ _res_conv = *(LDKCResult_PublicKeyErrorZ*)(((uint64_t)_res) & ~1);
9193 CResult_PublicKeyErrorZ_free(_res_conv);
9196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9197 LDKCResult_PublicKeyErrorZ* orig_conv = (LDKCResult_PublicKeyErrorZ*)(orig & ~1);
9198 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
9199 *ret_conv = CResult_PublicKeyErrorZ_clone(orig_conv);
9200 return (uint64_t)ret_conv;
9203 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9204 LDKTxCreationKeys o_conv;
9205 o_conv.inner = (void*)(o & (~1));
9206 o_conv.is_owned = (o & 1) || (o == 0);
9207 o_conv = TxCreationKeys_clone(&o_conv);
9208 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9209 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_ok(o_conv);
9210 return (uint64_t)ret_conv;
9213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9214 LDKDecodeError e_conv;
9215 e_conv.inner = (void*)(e & (~1));
9216 e_conv.is_owned = (e & 1) || (e == 0);
9217 e_conv = DecodeError_clone(&e_conv);
9218 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9219 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_err(e_conv);
9220 return (uint64_t)ret_conv;
9223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9224 if ((_res & 1) != 0) return;
9225 LDKCResult_TxCreationKeysDecodeErrorZ _res_conv = *(LDKCResult_TxCreationKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9227 CResult_TxCreationKeysDecodeErrorZ_free(_res_conv);
9230 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9231 LDKCResult_TxCreationKeysDecodeErrorZ* orig_conv = (LDKCResult_TxCreationKeysDecodeErrorZ*)(orig & ~1);
9232 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
9233 *ret_conv = CResult_TxCreationKeysDecodeErrorZ_clone(orig_conv);
9234 return (uint64_t)ret_conv;
9237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9238 LDKChannelPublicKeys o_conv;
9239 o_conv.inner = (void*)(o & (~1));
9240 o_conv.is_owned = (o & 1) || (o == 0);
9241 o_conv = ChannelPublicKeys_clone(&o_conv);
9242 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9243 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_ok(o_conv);
9244 return (uint64_t)ret_conv;
9247 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9248 LDKDecodeError e_conv;
9249 e_conv.inner = (void*)(e & (~1));
9250 e_conv.is_owned = (e & 1) || (e == 0);
9251 e_conv = DecodeError_clone(&e_conv);
9252 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9253 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_err(e_conv);
9254 return (uint64_t)ret_conv;
9257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9258 if ((_res & 1) != 0) return;
9259 LDKCResult_ChannelPublicKeysDecodeErrorZ _res_conv = *(LDKCResult_ChannelPublicKeysDecodeErrorZ*)(((uint64_t)_res) & ~1);
9261 CResult_ChannelPublicKeysDecodeErrorZ_free(_res_conv);
9264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelPublicKeysDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9265 LDKCResult_ChannelPublicKeysDecodeErrorZ* orig_conv = (LDKCResult_ChannelPublicKeysDecodeErrorZ*)(orig & ~1);
9266 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
9267 *ret_conv = CResult_ChannelPublicKeysDecodeErrorZ_clone(orig_conv);
9268 return (uint64_t)ret_conv;
9271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9272 LDKTxCreationKeys o_conv;
9273 o_conv.inner = (void*)(o & (~1));
9274 o_conv.is_owned = (o & 1) || (o == 0);
9275 o_conv = TxCreationKeys_clone(&o_conv);
9276 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9277 *ret_conv = CResult_TxCreationKeysErrorZ_ok(o_conv);
9278 return (uint64_t)ret_conv;
9281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9282 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
9283 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9284 *ret_conv = CResult_TxCreationKeysErrorZ_err(e_conv);
9285 return (uint64_t)ret_conv;
9288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9289 if ((_res & 1) != 0) return;
9290 LDKCResult_TxCreationKeysErrorZ _res_conv = *(LDKCResult_TxCreationKeysErrorZ*)(((uint64_t)_res) & ~1);
9292 CResult_TxCreationKeysErrorZ_free(_res_conv);
9295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9296 LDKCResult_TxCreationKeysErrorZ* orig_conv = (LDKCResult_TxCreationKeysErrorZ*)(orig & ~1);
9297 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
9298 *ret_conv = CResult_TxCreationKeysErrorZ_clone(orig_conv);
9299 return (uint64_t)ret_conv;
9302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1some(JNIEnv *env, jclass clz, int32_t o) {
9303 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9304 *ret_copy = COption_u32Z_some(o);
9305 uint64_t ret_ref = (uint64_t)ret_copy;
9309 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1none(JNIEnv *env, jclass clz) {
9310 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9311 *ret_copy = COption_u32Z_none();
9312 uint64_t ret_ref = (uint64_t)ret_copy;
9316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9317 if ((_res & 1) != 0) return;
9318 LDKCOption_u32Z _res_conv = *(LDKCOption_u32Z*)(((uint64_t)_res) & ~1);
9320 COption_u32Z_free(_res_conv);
9323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u32Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9324 LDKCOption_u32Z* orig_conv = (LDKCOption_u32Z*)orig;
9325 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
9326 *ret_copy = COption_u32Z_clone(orig_conv);
9327 uint64_t ret_ref = (uint64_t)ret_copy;
9331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9332 LDKHTLCOutputInCommitment o_conv;
9333 o_conv.inner = (void*)(o & (~1));
9334 o_conv.is_owned = (o & 1) || (o == 0);
9335 o_conv = HTLCOutputInCommitment_clone(&o_conv);
9336 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9337 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o_conv);
9338 return (uint64_t)ret_conv;
9341 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9342 LDKDecodeError e_conv;
9343 e_conv.inner = (void*)(e & (~1));
9344 e_conv.is_owned = (e & 1) || (e == 0);
9345 e_conv = DecodeError_clone(&e_conv);
9346 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9347 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e_conv);
9348 return (uint64_t)ret_conv;
9351 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9352 if ((_res & 1) != 0) return;
9353 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res_conv = *(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(((uint64_t)_res) & ~1);
9355 CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res_conv);
9358 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9359 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* orig_conv = (LDKCResult_HTLCOutputInCommitmentDecodeErrorZ*)(orig & ~1);
9360 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
9361 *ret_conv = CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig_conv);
9362 return (uint64_t)ret_conv;
9365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9366 LDKCounterpartyChannelTransactionParameters o_conv;
9367 o_conv.inner = (void*)(o & (~1));
9368 o_conv.is_owned = (o & 1) || (o == 0);
9369 o_conv = CounterpartyChannelTransactionParameters_clone(&o_conv);
9370 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9371 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9372 return (uint64_t)ret_conv;
9375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9376 LDKDecodeError e_conv;
9377 e_conv.inner = (void*)(e & (~1));
9378 e_conv.is_owned = (e & 1) || (e == 0);
9379 e_conv = DecodeError_clone(&e_conv);
9380 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9381 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e_conv);
9382 return (uint64_t)ret_conv;
9385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9386 if ((_res & 1) != 0) return;
9387 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9389 CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9393 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9394 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
9395 *ret_conv = CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9396 return (uint64_t)ret_conv;
9399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9400 LDKChannelTransactionParameters o_conv;
9401 o_conv.inner = (void*)(o & (~1));
9402 o_conv.is_owned = (o & 1) || (o == 0);
9403 o_conv = ChannelTransactionParameters_clone(&o_conv);
9404 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9405 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_ok(o_conv);
9406 return (uint64_t)ret_conv;
9409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9410 LDKDecodeError e_conv;
9411 e_conv.inner = (void*)(e & (~1));
9412 e_conv.is_owned = (e & 1) || (e == 0);
9413 e_conv = DecodeError_clone(&e_conv);
9414 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9415 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_err(e_conv);
9416 return (uint64_t)ret_conv;
9419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9420 if ((_res & 1) != 0) return;
9421 LDKCResult_ChannelTransactionParametersDecodeErrorZ _res_conv = *(LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(((uint64_t)_res) & ~1);
9423 CResult_ChannelTransactionParametersDecodeErrorZ_free(_res_conv);
9426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTransactionParametersDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9427 LDKCResult_ChannelTransactionParametersDecodeErrorZ* orig_conv = (LDKCResult_ChannelTransactionParametersDecodeErrorZ*)(orig & ~1);
9428 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
9429 *ret_conv = CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig_conv);
9430 return (uint64_t)ret_conv;
9433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9434 LDKCVec_SignatureZ _res_constr;
9435 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9436 if (_res_constr.datalen > 0)
9437 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9439 _res_constr.data = NULL;
9440 for (size_t i = 0; i < _res_constr.datalen; i++) {
9441 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9442 LDKSignature _res_conv_8_ref;
9443 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 64);
9444 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 64, _res_conv_8_ref.compact_form);
9445 _res_constr.data[i] = _res_conv_8_ref;
9447 CVec_SignatureZ_free(_res_constr);
9450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9451 LDKHolderCommitmentTransaction o_conv;
9452 o_conv.inner = (void*)(o & (~1));
9453 o_conv.is_owned = (o & 1) || (o == 0);
9454 o_conv = HolderCommitmentTransaction_clone(&o_conv);
9455 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9456 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o_conv);
9457 return (uint64_t)ret_conv;
9460 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9461 LDKDecodeError e_conv;
9462 e_conv.inner = (void*)(e & (~1));
9463 e_conv.is_owned = (e & 1) || (e == 0);
9464 e_conv = DecodeError_clone(&e_conv);
9465 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9466 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_err(e_conv);
9467 return (uint64_t)ret_conv;
9470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9471 if ((_res & 1) != 0) return;
9472 LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9474 CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res_conv);
9477 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HolderCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9478 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_HolderCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9479 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
9480 *ret_conv = CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9481 return (uint64_t)ret_conv;
9484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9485 LDKBuiltCommitmentTransaction o_conv;
9486 o_conv.inner = (void*)(o & (~1));
9487 o_conv.is_owned = (o & 1) || (o == 0);
9488 o_conv = BuiltCommitmentTransaction_clone(&o_conv);
9489 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9490 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o_conv);
9491 return (uint64_t)ret_conv;
9494 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9495 LDKDecodeError e_conv;
9496 e_conv.inner = (void*)(e & (~1));
9497 e_conv.is_owned = (e & 1) || (e == 0);
9498 e_conv = DecodeError_clone(&e_conv);
9499 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9500 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e_conv);
9501 return (uint64_t)ret_conv;
9504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9505 if ((_res & 1) != 0) return;
9506 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9508 CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res_conv);
9511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9512 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_BuiltCommitmentTransactionDecodeErrorZ*)(orig & ~1);
9513 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
9514 *ret_conv = CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig_conv);
9515 return (uint64_t)ret_conv;
9518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9519 LDKCommitmentTransaction o_conv;
9520 o_conv.inner = (void*)(o & (~1));
9521 o_conv.is_owned = (o & 1) || (o == 0);
9522 o_conv = CommitmentTransaction_clone(&o_conv);
9523 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9524 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_ok(o_conv);
9525 return (uint64_t)ret_conv;
9528 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9529 LDKDecodeError e_conv;
9530 e_conv.inner = (void*)(e & (~1));
9531 e_conv.is_owned = (e & 1) || (e == 0);
9532 e_conv = DecodeError_clone(&e_conv);
9533 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9534 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_err(e_conv);
9535 return (uint64_t)ret_conv;
9538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9539 if ((_res & 1) != 0) return;
9540 LDKCResult_CommitmentTransactionDecodeErrorZ _res_conv = *(LDKCResult_CommitmentTransactionDecodeErrorZ*)(((uint64_t)_res) & ~1);
9542 CResult_CommitmentTransactionDecodeErrorZ_free(_res_conv);
9545 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9546 LDKCResult_CommitmentTransactionDecodeErrorZ* orig_conv = (LDKCResult_CommitmentTransactionDecodeErrorZ*)(orig & ~1);
9547 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
9548 *ret_conv = CResult_CommitmentTransactionDecodeErrorZ_clone(orig_conv);
9549 return (uint64_t)ret_conv;
9552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9553 LDKTrustedCommitmentTransaction o_conv;
9554 o_conv.inner = (void*)(o & (~1));
9555 o_conv.is_owned = (o & 1) || (o == 0);
9556 // Warning: we need a move here but no clone is available for LDKTrustedCommitmentTransaction
9557 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9558 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
9559 return (uint64_t)ret_conv;
9562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
9563 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
9564 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
9565 return (uint64_t)ret_conv;
9568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9569 if ((_res & 1) != 0) return;
9570 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)(((uint64_t)_res) & ~1);
9572 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
9575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
9576 LDKCVec_SignatureZ o_constr;
9577 o_constr.datalen = (*env)->GetArrayLength(env, o);
9578 if (o_constr.datalen > 0)
9579 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9581 o_constr.data = NULL;
9582 for (size_t i = 0; i < o_constr.datalen; i++) {
9583 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
9584 LDKSignature o_conv_8_ref;
9585 CHECK((*env)->GetArrayLength(env, o_conv_8) == 64);
9586 (*env)->GetByteArrayRegion(env, o_conv_8, 0, 64, o_conv_8_ref.compact_form);
9587 o_constr.data[i] = o_conv_8_ref;
9589 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9590 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
9591 return (uint64_t)ret_conv;
9594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
9595 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9596 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
9597 return (uint64_t)ret_conv;
9600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9601 if ((_res & 1) != 0) return;
9602 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)(((uint64_t)_res) & ~1);
9604 CResult_CVec_SignatureZNoneZ_free(_res_conv);
9607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9608 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)(orig & ~1);
9609 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
9610 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
9611 return (uint64_t)ret_conv;
9614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1ok(JNIEnv *env, jclass clz) {
9615 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9616 *ret_conv = CResult_NoneErrorZ_ok();
9617 return (uint64_t)ret_conv;
9620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9621 LDKIOError e_conv = LDKIOError_from_java(env, e);
9622 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9623 *ret_conv = CResult_NoneErrorZ_err(e_conv);
9624 return (uint64_t)ret_conv;
9627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9628 if ((_res & 1) != 0) return;
9629 LDKCResult_NoneErrorZ _res_conv = *(LDKCResult_NoneErrorZ*)(((uint64_t)_res) & ~1);
9631 CResult_NoneErrorZ_free(_res_conv);
9634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9635 LDKCResult_NoneErrorZ* orig_conv = (LDKCResult_NoneErrorZ*)(orig & ~1);
9636 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
9637 *ret_conv = CResult_NoneErrorZ_clone(orig_conv);
9638 return (uint64_t)ret_conv;
9641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9643 o_conv.inner = (void*)(o & (~1));
9644 o_conv.is_owned = (o & 1) || (o == 0);
9645 o_conv = RouteHop_clone(&o_conv);
9646 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9647 *ret_conv = CResult_RouteHopDecodeErrorZ_ok(o_conv);
9648 return (uint64_t)ret_conv;
9651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9652 LDKDecodeError e_conv;
9653 e_conv.inner = (void*)(e & (~1));
9654 e_conv.is_owned = (e & 1) || (e == 0);
9655 e_conv = DecodeError_clone(&e_conv);
9656 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9657 *ret_conv = CResult_RouteHopDecodeErrorZ_err(e_conv);
9658 return (uint64_t)ret_conv;
9661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9662 if ((_res & 1) != 0) return;
9663 LDKCResult_RouteHopDecodeErrorZ _res_conv = *(LDKCResult_RouteHopDecodeErrorZ*)(((uint64_t)_res) & ~1);
9665 CResult_RouteHopDecodeErrorZ_free(_res_conv);
9668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteHopDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9669 LDKCResult_RouteHopDecodeErrorZ* orig_conv = (LDKCResult_RouteHopDecodeErrorZ*)(orig & ~1);
9670 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
9671 *ret_conv = CResult_RouteHopDecodeErrorZ_clone(orig_conv);
9672 return (uint64_t)ret_conv;
9675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9676 LDKCVec_RouteHopZ _res_constr;
9677 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9678 if (_res_constr.datalen > 0)
9679 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9681 _res_constr.data = NULL;
9682 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9683 for (size_t k = 0; k < _res_constr.datalen; k++) {
9684 int64_t _res_conv_10 = _res_vals[k];
9685 LDKRouteHop _res_conv_10_conv;
9686 _res_conv_10_conv.inner = (void*)(_res_conv_10 & (~1));
9687 _res_conv_10_conv.is_owned = (_res_conv_10 & 1) || (_res_conv_10 == 0);
9688 _res_constr.data[k] = _res_conv_10_conv;
9690 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9691 CVec_RouteHopZ_free(_res_constr);
9694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9695 LDKCVec_CVec_RouteHopZZ _res_constr;
9696 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9697 if (_res_constr.datalen > 0)
9698 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
9700 _res_constr.data = NULL;
9701 for (size_t m = 0; m < _res_constr.datalen; m++) {
9702 int64_tArray _res_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
9703 LDKCVec_RouteHopZ _res_conv_12_constr;
9704 _res_conv_12_constr.datalen = (*env)->GetArrayLength(env, _res_conv_12);
9705 if (_res_conv_12_constr.datalen > 0)
9706 _res_conv_12_constr.data = MALLOC(_res_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
9708 _res_conv_12_constr.data = NULL;
9709 int64_t* _res_conv_12_vals = (*env)->GetLongArrayElements (env, _res_conv_12, NULL);
9710 for (size_t k = 0; k < _res_conv_12_constr.datalen; k++) {
9711 int64_t _res_conv_12_conv_10 = _res_conv_12_vals[k];
9712 LDKRouteHop _res_conv_12_conv_10_conv;
9713 _res_conv_12_conv_10_conv.inner = (void*)(_res_conv_12_conv_10 & (~1));
9714 _res_conv_12_conv_10_conv.is_owned = (_res_conv_12_conv_10 & 1) || (_res_conv_12_conv_10 == 0);
9715 _res_conv_12_constr.data[k] = _res_conv_12_conv_10_conv;
9717 (*env)->ReleaseLongArrayElements(env, _res_conv_12, _res_conv_12_vals, 0);
9718 _res_constr.data[m] = _res_conv_12_constr;
9720 CVec_CVec_RouteHopZZ_free(_res_constr);
9723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9725 o_conv.inner = (void*)(o & (~1));
9726 o_conv.is_owned = (o & 1) || (o == 0);
9727 o_conv = Route_clone(&o_conv);
9728 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9729 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
9730 return (uint64_t)ret_conv;
9733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9734 LDKDecodeError e_conv;
9735 e_conv.inner = (void*)(e & (~1));
9736 e_conv.is_owned = (e & 1) || (e == 0);
9737 e_conv = DecodeError_clone(&e_conv);
9738 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9739 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
9740 return (uint64_t)ret_conv;
9743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9744 if ((_res & 1) != 0) return;
9745 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)(((uint64_t)_res) & ~1);
9747 CResult_RouteDecodeErrorZ_free(_res_conv);
9750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9751 LDKCResult_RouteDecodeErrorZ* orig_conv = (LDKCResult_RouteDecodeErrorZ*)(orig & ~1);
9752 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
9753 *ret_conv = CResult_RouteDecodeErrorZ_clone(orig_conv);
9754 return (uint64_t)ret_conv;
9757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1some(JNIEnv *env, jclass clz, int64_t o) {
9758 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9759 *ret_copy = COption_u64Z_some(o);
9760 uint64_t ret_ref = (uint64_t)ret_copy;
9764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1none(JNIEnv *env, jclass clz) {
9765 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9766 *ret_copy = COption_u64Z_none();
9767 uint64_t ret_ref = (uint64_t)ret_copy;
9771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
9772 if ((_res & 1) != 0) return;
9773 LDKCOption_u64Z _res_conv = *(LDKCOption_u64Z*)(((uint64_t)_res) & ~1);
9775 COption_u64Z_free(_res_conv);
9778 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u64Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9779 LDKCOption_u64Z* orig_conv = (LDKCOption_u64Z*)orig;
9780 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
9781 *ret_copy = COption_u64Z_clone(orig_conv);
9782 uint64_t ret_ref = (uint64_t)ret_copy;
9786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9787 LDKCVec_ChannelDetailsZ _res_constr;
9788 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9789 if (_res_constr.datalen > 0)
9790 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
9792 _res_constr.data = NULL;
9793 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9794 for (size_t q = 0; q < _res_constr.datalen; q++) {
9795 int64_t _res_conv_16 = _res_vals[q];
9796 LDKChannelDetails _res_conv_16_conv;
9797 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
9798 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
9799 _res_constr.data[q] = _res_conv_16_conv;
9801 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9802 CVec_ChannelDetailsZ_free(_res_constr);
9805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9806 LDKCVec_RouteHintZ _res_constr;
9807 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9808 if (_res_constr.datalen > 0)
9809 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
9811 _res_constr.data = NULL;
9812 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9813 for (size_t l = 0; l < _res_constr.datalen; l++) {
9814 int64_t _res_conv_11 = _res_vals[l];
9815 LDKRouteHint _res_conv_11_conv;
9816 _res_conv_11_conv.inner = (void*)(_res_conv_11 & (~1));
9817 _res_conv_11_conv.is_owned = (_res_conv_11 & 1) || (_res_conv_11 == 0);
9818 _res_constr.data[l] = _res_conv_11_conv;
9820 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9821 CVec_RouteHintZ_free(_res_constr);
9824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9826 o_conv.inner = (void*)(o & (~1));
9827 o_conv.is_owned = (o & 1) || (o == 0);
9828 o_conv = Route_clone(&o_conv);
9829 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9830 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
9831 return (uint64_t)ret_conv;
9834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
9835 LDKLightningError e_conv;
9836 e_conv.inner = (void*)(e & (~1));
9837 e_conv.is_owned = (e & 1) || (e == 0);
9838 e_conv = LightningError_clone(&e_conv);
9839 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9840 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
9841 return (uint64_t)ret_conv;
9844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9845 if ((_res & 1) != 0) return;
9846 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)(((uint64_t)_res) & ~1);
9848 CResult_RouteLightningErrorZ_free(_res_conv);
9851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9852 LDKCResult_RouteLightningErrorZ* orig_conv = (LDKCResult_RouteLightningErrorZ*)(orig & ~1);
9853 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
9854 *ret_conv = CResult_RouteLightningErrorZ_clone(orig_conv);
9855 return (uint64_t)ret_conv;
9858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
9859 LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
9860 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9861 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
9862 return (uint64_t)ret_conv;
9865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
9866 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
9867 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9868 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
9869 return (uint64_t)ret_conv;
9872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9873 if ((_res & 1) != 0) return;
9874 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)_res) & ~1);
9876 CResult_TxOutAccessErrorZ_free(_res_conv);
9879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9880 LDKCResult_TxOutAccessErrorZ* orig_conv = (LDKCResult_TxOutAccessErrorZ*)(orig & ~1);
9881 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
9882 *ret_conv = CResult_TxOutAccessErrorZ_clone(orig_conv);
9883 return (uint64_t)ret_conv;
9886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9887 LDKC2Tuple_usizeTransactionZ* orig_conv = (LDKC2Tuple_usizeTransactionZ*)(orig & ~1);
9888 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9889 *ret_ref = C2Tuple_usizeTransactionZ_clone(orig_conv);
9890 return (uint64_t)ret_ref;
9893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
9894 LDKTransaction b_ref;
9895 b_ref.datalen = (*env)->GetArrayLength(env, b);
9896 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
9897 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
9898 b_ref.data_is_owned = true;
9899 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
9900 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
9901 return (uint64_t)ret_ref;
9904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9905 if ((_res & 1) != 0) return;
9906 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res) & ~1);
9908 C2Tuple_usizeTransactionZ_free(_res_conv);
9911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9912 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
9913 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9914 if (_res_constr.datalen > 0)
9915 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9917 _res_constr.data = NULL;
9918 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9919 for (size_t y = 0; y < _res_constr.datalen; y++) {
9920 int64_t _res_conv_24 = _res_vals[y];
9921 LDKC2Tuple_usizeTransactionZ _res_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)_res_conv_24) & ~1);
9922 FREE((void*)_res_conv_24);
9923 _res_constr.data[y] = _res_conv_24_conv;
9925 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9926 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
9929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxidZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
9930 LDKCVec_TxidZ _res_constr;
9931 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9932 if (_res_constr.datalen > 0)
9933 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKThirtyTwoBytes), "LDKCVec_TxidZ Elements");
9935 _res_constr.data = NULL;
9936 for (size_t i = 0; i < _res_constr.datalen; i++) {
9937 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
9938 LDKThirtyTwoBytes _res_conv_8_ref;
9939 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 32);
9940 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 32, _res_conv_8_ref.data);
9941 _res_constr.data[i] = _res_conv_8_ref;
9943 CVec_TxidZ_free(_res_constr);
9946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
9947 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9948 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
9949 return (uint64_t)ret_conv;
9952 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
9953 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
9954 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9955 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
9956 return (uint64_t)ret_conv;
9959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
9960 if ((_res & 1) != 0) return;
9961 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)_res) & ~1);
9963 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
9966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9967 LDKCResult_NoneChannelMonitorUpdateErrZ* orig_conv = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(orig & ~1);
9968 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
9969 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone(orig_conv);
9970 return (uint64_t)ret_conv;
9973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
9974 LDKCVec_MonitorEventZ _res_constr;
9975 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
9976 if (_res_constr.datalen > 0)
9977 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
9979 _res_constr.data = NULL;
9980 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
9981 for (size_t o = 0; o < _res_constr.datalen; o++) {
9982 int64_t _res_conv_14 = _res_vals[o];
9983 LDKMonitorEvent _res_conv_14_conv = *(LDKMonitorEvent*)(((uint64_t)_res_conv_14) & ~1);
9984 FREE((void*)_res_conv_14);
9985 _res_constr.data[o] = _res_conv_14_conv;
9987 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
9988 CVec_MonitorEventZ_free(_res_constr);
9991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
9992 LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
9993 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
9994 *ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
9995 uint64_t ret_ref = (uint64_t)ret_copy;
9999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1none(JNIEnv *env, jclass clz) {
10000 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10001 *ret_copy = COption_C2Tuple_usizeTransactionZZ_none();
10002 uint64_t ret_ref = (uint64_t)ret_copy;
10006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10007 if ((_res & 1) != 0) return;
10008 LDKCOption_C2Tuple_usizeTransactionZZ _res_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)_res) & ~1);
10010 COption_C2Tuple_usizeTransactionZZ_free(_res_conv);
10013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10014 LDKCOption_C2Tuple_usizeTransactionZZ* orig_conv = (LDKCOption_C2Tuple_usizeTransactionZZ*)orig;
10015 LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
10016 *ret_copy = COption_C2Tuple_usizeTransactionZZ_clone(orig_conv);
10017 uint64_t ret_ref = (uint64_t)ret_copy;
10021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10022 LDKCVec_SpendableOutputDescriptorZ _res_constr;
10023 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10024 if (_res_constr.datalen > 0)
10025 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
10027 _res_constr.data = NULL;
10028 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10029 for (size_t b = 0; b < _res_constr.datalen; b++) {
10030 int64_t _res_conv_27 = _res_vals[b];
10031 LDKSpendableOutputDescriptor _res_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)_res_conv_27) & ~1);
10032 FREE((void*)_res_conv_27);
10033 _res_constr.data[b] = _res_conv_27_conv;
10035 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10036 CVec_SpendableOutputDescriptorZ_free(_res_constr);
10039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10040 LDKCVec_MessageSendEventZ _res_constr;
10041 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10042 if (_res_constr.datalen > 0)
10043 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
10045 _res_constr.data = NULL;
10046 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10047 for (size_t s = 0; s < _res_constr.datalen; s++) {
10048 int64_t _res_conv_18 = _res_vals[s];
10049 LDKMessageSendEvent _res_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)_res_conv_18) & ~1);
10050 FREE((void*)_res_conv_18);
10051 _res_constr.data[s] = _res_conv_18_conv;
10053 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10054 CVec_MessageSendEventZ_free(_res_constr);
10057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10058 LDKInitFeatures o_conv;
10059 o_conv.inner = (void*)(o & (~1));
10060 o_conv.is_owned = (o & 1) || (o == 0);
10061 o_conv = InitFeatures_clone(&o_conv);
10062 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10063 *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv);
10064 return (uint64_t)ret_conv;
10067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10068 LDKDecodeError e_conv;
10069 e_conv.inner = (void*)(e & (~1));
10070 e_conv.is_owned = (e & 1) || (e == 0);
10071 e_conv = DecodeError_clone(&e_conv);
10072 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
10073 *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv);
10074 return (uint64_t)ret_conv;
10077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10078 if ((_res & 1) != 0) return;
10079 LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10081 CResult_InitFeaturesDecodeErrorZ_free(_res_conv);
10084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10085 LDKNodeFeatures o_conv;
10086 o_conv.inner = (void*)(o & (~1));
10087 o_conv.is_owned = (o & 1) || (o == 0);
10088 o_conv = NodeFeatures_clone(&o_conv);
10089 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10090 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv);
10091 return (uint64_t)ret_conv;
10094 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10095 LDKDecodeError e_conv;
10096 e_conv.inner = (void*)(e & (~1));
10097 e_conv.is_owned = (e & 1) || (e == 0);
10098 e_conv = DecodeError_clone(&e_conv);
10099 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
10100 *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv);
10101 return (uint64_t)ret_conv;
10104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10105 if ((_res & 1) != 0) return;
10106 LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10108 CResult_NodeFeaturesDecodeErrorZ_free(_res_conv);
10111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10112 LDKChannelFeatures o_conv;
10113 o_conv.inner = (void*)(o & (~1));
10114 o_conv.is_owned = (o & 1) || (o == 0);
10115 o_conv = ChannelFeatures_clone(&o_conv);
10116 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10117 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_ok(o_conv);
10118 return (uint64_t)ret_conv;
10121 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10122 LDKDecodeError e_conv;
10123 e_conv.inner = (void*)(e & (~1));
10124 e_conv.is_owned = (e & 1) || (e == 0);
10125 e_conv = DecodeError_clone(&e_conv);
10126 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
10127 *ret_conv = CResult_ChannelFeaturesDecodeErrorZ_err(e_conv);
10128 return (uint64_t)ret_conv;
10131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10132 if ((_res & 1) != 0) return;
10133 LDKCResult_ChannelFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10135 CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv);
10138 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10139 LDKInvoiceFeatures o_conv;
10140 o_conv.inner = (void*)(o & (~1));
10141 o_conv.is_owned = (o & 1) || (o == 0);
10142 o_conv = InvoiceFeatures_clone(&o_conv);
10143 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10144 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv);
10145 return (uint64_t)ret_conv;
10148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10149 LDKDecodeError e_conv;
10150 e_conv.inner = (void*)(e & (~1));
10151 e_conv.is_owned = (e & 1) || (e == 0);
10152 e_conv = DecodeError_clone(&e_conv);
10153 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
10154 *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv);
10155 return (uint64_t)ret_conv;
10158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10159 if ((_res & 1) != 0) return;
10160 LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
10162 CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv);
10165 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10166 LDKDelayedPaymentOutputDescriptor o_conv;
10167 o_conv.inner = (void*)(o & (~1));
10168 o_conv.is_owned = (o & 1) || (o == 0);
10169 o_conv = DelayedPaymentOutputDescriptor_clone(&o_conv);
10170 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10171 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10172 return (uint64_t)ret_conv;
10175 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10176 LDKDecodeError e_conv;
10177 e_conv.inner = (void*)(e & (~1));
10178 e_conv.is_owned = (e & 1) || (e == 0);
10179 e_conv = DecodeError_clone(&e_conv);
10180 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10181 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10182 return (uint64_t)ret_conv;
10185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10186 if ((_res & 1) != 0) return;
10187 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10189 CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10192 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10193 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10194 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
10195 *ret_conv = CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10196 return (uint64_t)ret_conv;
10199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10200 LDKStaticPaymentOutputDescriptor o_conv;
10201 o_conv.inner = (void*)(o & (~1));
10202 o_conv.is_owned = (o & 1) || (o == 0);
10203 o_conv = StaticPaymentOutputDescriptor_clone(&o_conv);
10204 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10205 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o_conv);
10206 return (uint64_t)ret_conv;
10209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10210 LDKDecodeError e_conv;
10211 e_conv.inner = (void*)(e & (~1));
10212 e_conv.is_owned = (e & 1) || (e == 0);
10213 e_conv = DecodeError_clone(&e_conv);
10214 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10215 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e_conv);
10216 return (uint64_t)ret_conv;
10219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10220 if ((_res & 1) != 0) return;
10221 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10223 CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res_conv);
10226 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StaticPaymentOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10227 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ*)(orig & ~1);
10228 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
10229 *ret_conv = CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig_conv);
10230 return (uint64_t)ret_conv;
10233 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10234 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
10235 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10236 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
10237 return (uint64_t)ret_conv;
10240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10241 LDKDecodeError e_conv;
10242 e_conv.inner = (void*)(e & (~1));
10243 e_conv.is_owned = (e & 1) || (e == 0);
10244 e_conv = DecodeError_clone(&e_conv);
10245 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10246 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
10247 return (uint64_t)ret_conv;
10250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10251 if ((_res & 1) != 0) return;
10252 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(((uint64_t)_res) & ~1);
10254 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
10257 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10258 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* orig_conv = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)(orig & ~1);
10259 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
10260 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig_conv);
10261 return (uint64_t)ret_conv;
10264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10265 LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
10266 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10267 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_clone(orig_conv);
10268 return (uint64_t)ret_ref;
10271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
10272 LDKSignature a_ref;
10273 CHECK((*env)->GetArrayLength(env, a) == 64);
10274 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
10275 LDKCVec_SignatureZ b_constr;
10276 b_constr.datalen = (*env)->GetArrayLength(env, b);
10277 if (b_constr.datalen > 0)
10278 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
10280 b_constr.data = NULL;
10281 for (size_t i = 0; i < b_constr.datalen; i++) {
10282 int8_tArray b_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
10283 LDKSignature b_conv_8_ref;
10284 CHECK((*env)->GetArrayLength(env, b_conv_8) == 64);
10285 (*env)->GetByteArrayRegion(env, b_conv_8, 0, 64, b_conv_8_ref.compact_form);
10286 b_constr.data[i] = b_conv_8_ref;
10288 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
10289 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
10290 return (uint64_t)ret_ref;
10293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10294 if ((_res & 1) != 0) return;
10295 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)_res) & ~1);
10297 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
10300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10301 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
10302 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10303 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
10304 return (uint64_t)ret_conv;
10307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
10308 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10309 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
10310 return (uint64_t)ret_conv;
10313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10314 if ((_res & 1) != 0) return;
10315 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)_res) & ~1);
10317 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
10320 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10321 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(orig & ~1);
10322 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
10323 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
10324 return (uint64_t)ret_conv;
10327 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10328 LDKSignature o_ref;
10329 CHECK((*env)->GetArrayLength(env, o) == 64);
10330 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
10331 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10332 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
10333 return (uint64_t)ret_conv;
10336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10337 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10338 *ret_conv = CResult_SignatureNoneZ_err();
10339 return (uint64_t)ret_conv;
10342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10343 if ((_res & 1) != 0) return;
10344 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)_res) & ~1);
10346 CResult_SignatureNoneZ_free(_res_conv);
10349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10350 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)(orig & ~1);
10351 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
10352 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
10353 return (uint64_t)ret_conv;
10356 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10357 LDKSign o_conv = *(LDKSign*)(((uint64_t)o) & ~1);
10358 if (o_conv.free == LDKSign_JCalls_free) {
10359 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10360 LDKSign_JCalls_cloned(&o_conv);
10362 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10363 *ret_conv = CResult_SignDecodeErrorZ_ok(o_conv);
10364 return (uint64_t)ret_conv;
10367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10368 LDKDecodeError e_conv;
10369 e_conv.inner = (void*)(e & (~1));
10370 e_conv.is_owned = (e & 1) || (e == 0);
10371 e_conv = DecodeError_clone(&e_conv);
10372 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10373 *ret_conv = CResult_SignDecodeErrorZ_err(e_conv);
10374 return (uint64_t)ret_conv;
10377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10378 if ((_res & 1) != 0) return;
10379 LDKCResult_SignDecodeErrorZ _res_conv = *(LDKCResult_SignDecodeErrorZ*)(((uint64_t)_res) & ~1);
10381 CResult_SignDecodeErrorZ_free(_res_conv);
10384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10385 LDKCResult_SignDecodeErrorZ* orig_conv = (LDKCResult_SignDecodeErrorZ*)(orig & ~1);
10386 LDKCResult_SignDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SignDecodeErrorZ), "LDKCResult_SignDecodeErrorZ");
10387 *ret_conv = CResult_SignDecodeErrorZ_clone(orig_conv);
10388 return (uint64_t)ret_conv;
10391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
10392 LDKCVec_u8Z _res_ref;
10393 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
10394 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
10395 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
10396 CVec_u8Z_free(_res_ref);
10399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray arg) {
10400 LDKRecoverableSignature arg_ref;
10401 CHECK((*env)->GetArrayLength(env, arg) == 68);
10402 (*env)->GetByteArrayRegion(env, arg, 0, 68, arg_ref.serialized_form);
10403 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10404 *ret_conv = CResult_RecoverableSignatureNoneZ_ok(arg_ref);
10405 return (uint64_t)ret_conv;
10408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1err(JNIEnv *env, jclass clz) {
10409 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10410 *ret_conv = CResult_RecoverableSignatureNoneZ_err();
10411 return (uint64_t)ret_conv;
10414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10415 if ((_res & 1) != 0) return;
10416 LDKCResult_RecoverableSignatureNoneZ _res_conv = *(LDKCResult_RecoverableSignatureNoneZ*)(((uint64_t)_res) & ~1);
10418 CResult_RecoverableSignatureNoneZ_free(_res_conv);
10421 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RecoverableSignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10422 LDKCResult_RecoverableSignatureNoneZ* orig_conv = (LDKCResult_RecoverableSignatureNoneZ*)(orig & ~1);
10423 LDKCResult_RecoverableSignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_RecoverableSignatureNoneZ), "LDKCResult_RecoverableSignatureNoneZ");
10424 *ret_conv = CResult_RecoverableSignatureNoneZ_clone(orig_conv);
10425 return (uint64_t)ret_conv;
10428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1u8ZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
10429 LDKCVec_CVec_u8ZZ _res_constr;
10430 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10431 if (_res_constr.datalen > 0)
10432 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10434 _res_constr.data = NULL;
10435 for (size_t i = 0; i < _res_constr.datalen; i++) {
10436 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
10437 LDKCVec_u8Z _res_conv_8_ref;
10438 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
10439 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10440 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
10441 _res_constr.data[i] = _res_conv_8_ref;
10443 CVec_CVec_u8ZZ_free(_res_constr);
10446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
10447 LDKCVec_CVec_u8ZZ o_constr;
10448 o_constr.datalen = (*env)->GetArrayLength(env, o);
10449 if (o_constr.datalen > 0)
10450 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKCVec_u8Z), "LDKCVec_CVec_u8ZZ Elements");
10452 o_constr.data = NULL;
10453 for (size_t i = 0; i < o_constr.datalen; i++) {
10454 int8_tArray o_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
10455 LDKCVec_u8Z o_conv_8_ref;
10456 o_conv_8_ref.datalen = (*env)->GetArrayLength(env, o_conv_8);
10457 o_conv_8_ref.data = MALLOC(o_conv_8_ref.datalen, "LDKCVec_u8Z Bytes");
10458 (*env)->GetByteArrayRegion(env, o_conv_8, 0, o_conv_8_ref.datalen, o_conv_8_ref.data);
10459 o_constr.data[i] = o_conv_8_ref;
10461 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10462 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_ok(o_constr);
10463 return (uint64_t)ret_conv;
10466 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1err(JNIEnv *env, jclass clz) {
10467 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10468 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_err();
10469 return (uint64_t)ret_conv;
10472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10473 if ((_res & 1) != 0) return;
10474 LDKCResult_CVec_CVec_u8ZZNoneZ _res_conv = *(LDKCResult_CVec_CVec_u8ZZNoneZ*)(((uint64_t)_res) & ~1);
10476 CResult_CVec_CVec_u8ZZNoneZ_free(_res_conv);
10479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1CVec_1u8ZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10480 LDKCResult_CVec_CVec_u8ZZNoneZ* orig_conv = (LDKCResult_CVec_CVec_u8ZZNoneZ*)(orig & ~1);
10481 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
10482 *ret_conv = CResult_CVec_CVec_u8ZZNoneZ_clone(orig_conv);
10483 return (uint64_t)ret_conv;
10486 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10487 LDKInMemorySigner o_conv;
10488 o_conv.inner = (void*)(o & (~1));
10489 o_conv.is_owned = (o & 1) || (o == 0);
10490 o_conv = InMemorySigner_clone(&o_conv);
10491 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10492 *ret_conv = CResult_InMemorySignerDecodeErrorZ_ok(o_conv);
10493 return (uint64_t)ret_conv;
10496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10497 LDKDecodeError e_conv;
10498 e_conv.inner = (void*)(e & (~1));
10499 e_conv.is_owned = (e & 1) || (e == 0);
10500 e_conv = DecodeError_clone(&e_conv);
10501 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10502 *ret_conv = CResult_InMemorySignerDecodeErrorZ_err(e_conv);
10503 return (uint64_t)ret_conv;
10506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10507 if ((_res & 1) != 0) return;
10508 LDKCResult_InMemorySignerDecodeErrorZ _res_conv = *(LDKCResult_InMemorySignerDecodeErrorZ*)(((uint64_t)_res) & ~1);
10510 CResult_InMemorySignerDecodeErrorZ_free(_res_conv);
10513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemorySignerDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10514 LDKCResult_InMemorySignerDecodeErrorZ* orig_conv = (LDKCResult_InMemorySignerDecodeErrorZ*)(orig & ~1);
10515 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
10516 *ret_conv = CResult_InMemorySignerDecodeErrorZ_clone(orig_conv);
10517 return (uint64_t)ret_conv;
10520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10521 LDKCVec_TxOutZ _res_constr;
10522 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10523 if (_res_constr.datalen > 0)
10524 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
10526 _res_constr.data = NULL;
10527 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10528 for (size_t h = 0; h < _res_constr.datalen; h++) {
10529 int64_t _res_conv_7 = _res_vals[h];
10530 LDKTxOut _res_conv_7_conv = *(LDKTxOut*)(((uint64_t)_res_conv_7) & ~1);
10531 FREE((void*)_res_conv_7);
10532 _res_constr.data[h] = _res_conv_7_conv;
10534 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10535 CVec_TxOutZ_free(_res_constr);
10538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10539 LDKTransaction o_ref;
10540 o_ref.datalen = (*env)->GetArrayLength(env, o);
10541 o_ref.data = MALLOC(o_ref.datalen, "LDKTransaction Bytes");
10542 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
10543 o_ref.data_is_owned = true;
10544 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10545 *ret_conv = CResult_TransactionNoneZ_ok(o_ref);
10546 return (uint64_t)ret_conv;
10549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1err(JNIEnv *env, jclass clz) {
10550 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10551 *ret_conv = CResult_TransactionNoneZ_err();
10552 return (uint64_t)ret_conv;
10555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10556 if ((_res & 1) != 0) return;
10557 LDKCResult_TransactionNoneZ _res_conv = *(LDKCResult_TransactionNoneZ*)(((uint64_t)_res) & ~1);
10559 CResult_TransactionNoneZ_free(_res_conv);
10562 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TransactionNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10563 LDKCResult_TransactionNoneZ* orig_conv = (LDKCResult_TransactionNoneZ*)(orig & ~1);
10564 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
10565 *ret_conv = CResult_TransactionNoneZ_clone(orig_conv);
10566 return (uint64_t)ret_conv;
10569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10570 LDKThirtyTwoBytes a_ref;
10571 CHECK((*env)->GetArrayLength(env, a) == 32);
10572 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10573 LDKChannelMonitor b_conv;
10574 b_conv.inner = (void*)(b & (~1));
10575 b_conv.is_owned = (b & 1) || (b == 0);
10576 b_conv = ChannelMonitor_clone(&b_conv);
10577 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
10578 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
10579 return (uint64_t)ret_ref;
10582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10583 if ((_res & 1) != 0) return;
10584 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res) & ~1);
10586 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
10589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1BlockHashChannelMonitorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10590 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res_constr;
10591 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10592 if (_res_constr.datalen > 0)
10593 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10595 _res_constr.data = NULL;
10596 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10597 for (size_t i = 0; i < _res_constr.datalen; i++) {
10598 int64_t _res_conv_34 = _res_vals[i];
10599 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)_res_conv_34) & ~1);
10600 FREE((void*)_res_conv_34);
10601 _res_constr.data[i] = _res_conv_34_conv;
10603 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10604 CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res_constr);
10607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1ok(JNIEnv *env, jclass clz, int64_tArray o) {
10608 LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o_constr;
10609 o_constr.datalen = (*env)->GetArrayLength(env, o);
10610 if (o_constr.datalen > 0)
10611 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKCVec_C2Tuple_BlockHashChannelMonitorZZ Elements");
10613 o_constr.data = NULL;
10614 int64_t* o_vals = (*env)->GetLongArrayElements (env, o, NULL);
10615 for (size_t i = 0; i < o_constr.datalen; i++) {
10616 int64_t o_conv_34 = o_vals[i];
10617 LDKC2Tuple_BlockHashChannelMonitorZ o_conv_34_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o_conv_34) & ~1);
10618 // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
10619 o_constr.data[i] = o_conv_34_conv;
10621 (*env)->ReleaseLongArrayElements(env, o, o_vals, 0);
10622 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10623 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o_constr);
10624 return (uint64_t)ret_conv;
10627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
10628 LDKIOError e_conv = LDKIOError_from_java(env, e);
10629 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
10630 *ret_conv = CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e_conv);
10631 return (uint64_t)ret_conv;
10634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1C2Tuple_1BlockHashChannelMonitorZZErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10635 if ((_res & 1) != 0) return;
10636 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res_conv = *(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ*)(((uint64_t)_res) & ~1);
10638 CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(_res_conv);
10641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1some(JNIEnv *env, jclass clz, int16_t o) {
10642 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10643 *ret_copy = COption_u16Z_some(o);
10644 uint64_t ret_ref = (uint64_t)ret_copy;
10648 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1none(JNIEnv *env, jclass clz) {
10649 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10650 *ret_copy = COption_u16Z_none();
10651 uint64_t ret_ref = (uint64_t)ret_copy;
10655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
10656 if ((_res & 1) != 0) return;
10657 LDKCOption_u16Z _res_conv = *(LDKCOption_u16Z*)(((uint64_t)_res) & ~1);
10659 COption_u16Z_free(_res_conv);
10662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1u16Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10663 LDKCOption_u16Z* orig_conv = (LDKCOption_u16Z*)orig;
10664 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
10665 *ret_copy = COption_u16Z_clone(orig_conv);
10666 uint64_t ret_ref = (uint64_t)ret_copy;
10670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
10671 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10672 *ret_conv = CResult_NoneAPIErrorZ_ok();
10673 return (uint64_t)ret_conv;
10676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10677 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10678 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10679 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
10680 return (uint64_t)ret_conv;
10683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10684 if ((_res & 1) != 0) return;
10685 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res) & ~1);
10687 CResult_NoneAPIErrorZ_free(_res_conv);
10690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10691 LDKCResult_NoneAPIErrorZ* orig_conv = (LDKCResult_NoneAPIErrorZ*)(orig & ~1);
10692 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
10693 *ret_conv = CResult_NoneAPIErrorZ_clone(orig_conv);
10694 return (uint64_t)ret_conv;
10697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CResult_1NoneAPIErrorZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10698 LDKCVec_CResult_NoneAPIErrorZZ _res_constr;
10699 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10700 if (_res_constr.datalen > 0)
10701 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCResult_NoneAPIErrorZ), "LDKCVec_CResult_NoneAPIErrorZZ Elements");
10703 _res_constr.data = NULL;
10704 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10705 for (size_t w = 0; w < _res_constr.datalen; w++) {
10706 int64_t _res_conv_22 = _res_vals[w];
10707 LDKCResult_NoneAPIErrorZ _res_conv_22_conv = *(LDKCResult_NoneAPIErrorZ*)(((uint64_t)_res_conv_22) & ~1);
10708 FREE((void*)_res_conv_22);
10709 _res_constr.data[w] = _res_conv_22_conv;
10711 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10712 CVec_CResult_NoneAPIErrorZZ_free(_res_constr);
10715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1APIErrorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10716 LDKCVec_APIErrorZ _res_constr;
10717 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10718 if (_res_constr.datalen > 0)
10719 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKAPIError), "LDKCVec_APIErrorZ Elements");
10721 _res_constr.data = NULL;
10722 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10723 for (size_t k = 0; k < _res_constr.datalen; k++) {
10724 int64_t _res_conv_10 = _res_vals[k];
10725 LDKAPIError _res_conv_10_conv = *(LDKAPIError*)(((uint64_t)_res_conv_10) & ~1);
10726 FREE((void*)_res_conv_10);
10727 _res_constr.data[k] = _res_conv_10_conv;
10729 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10730 CVec_APIErrorZ_free(_res_constr);
10733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
10734 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10735 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
10736 return (uint64_t)ret_conv;
10739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10740 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10741 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10742 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
10743 return (uint64_t)ret_conv;
10746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10747 if ((_res & 1) != 0) return;
10748 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10750 CResult_NonePaymentSendFailureZ_free(_res_conv);
10753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10754 LDKCResult_NonePaymentSendFailureZ* orig_conv = (LDKCResult_NonePaymentSendFailureZ*)(orig & ~1);
10755 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
10756 *ret_conv = CResult_NonePaymentSendFailureZ_clone(orig_conv);
10757 return (uint64_t)ret_conv;
10760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10761 LDKThirtyTwoBytes o_ref;
10762 CHECK((*env)->GetArrayLength(env, o) == 32);
10763 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10764 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10765 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_ok(o_ref);
10766 return (uint64_t)ret_conv;
10769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10770 LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
10771 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10772 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
10773 return (uint64_t)ret_conv;
10776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10777 if ((_res & 1) != 0) return;
10778 LDKCResult_PaymentHashPaymentSendFailureZ _res_conv = *(LDKCResult_PaymentHashPaymentSendFailureZ*)(((uint64_t)_res) & ~1);
10780 CResult_PaymentHashPaymentSendFailureZ_free(_res_conv);
10783 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10784 LDKCResult_PaymentHashPaymentSendFailureZ* orig_conv = (LDKCResult_PaymentHashPaymentSendFailureZ*)(orig & ~1);
10785 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
10786 *ret_conv = CResult_PaymentHashPaymentSendFailureZ_clone(orig_conv);
10787 return (uint64_t)ret_conv;
10790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10791 LDKCVec_NetAddressZ _res_constr;
10792 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10793 if (_res_constr.datalen > 0)
10794 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10796 _res_constr.data = NULL;
10797 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10798 for (size_t m = 0; m < _res_constr.datalen; m++) {
10799 int64_t _res_conv_12 = _res_vals[m];
10800 LDKNetAddress _res_conv_12_conv = *(LDKNetAddress*)(((uint64_t)_res_conv_12) & ~1);
10801 FREE((void*)_res_conv_12);
10802 _res_constr.data[m] = _res_conv_12_conv;
10804 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10805 CVec_NetAddressZ_free(_res_constr);
10808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10809 LDKC2Tuple_PaymentHashPaymentSecretZ* orig_conv = (LDKC2Tuple_PaymentHashPaymentSecretZ*)(orig & ~1);
10810 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10811 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_clone(orig_conv);
10812 return (uint64_t)ret_ref;
10815 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int8_tArray b) {
10816 LDKThirtyTwoBytes a_ref;
10817 CHECK((*env)->GetArrayLength(env, a) == 32);
10818 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10819 LDKThirtyTwoBytes b_ref;
10820 CHECK((*env)->GetArrayLength(env, b) == 32);
10821 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
10822 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
10823 *ret_ref = C2Tuple_PaymentHashPaymentSecretZ_new(a_ref, b_ref);
10824 return (uint64_t)ret_ref;
10827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10828 if ((_res & 1) != 0) return;
10829 LDKC2Tuple_PaymentHashPaymentSecretZ _res_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)_res) & ~1);
10831 C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv);
10834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
10835 LDKThirtyTwoBytes o_ref;
10836 CHECK((*env)->GetArrayLength(env, o) == 32);
10837 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data);
10838 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10839 *ret_conv = CResult_PaymentSecretAPIErrorZ_ok(o_ref);
10840 return (uint64_t)ret_conv;
10843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10844 LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
10845 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10846 *ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
10847 return (uint64_t)ret_conv;
10850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10851 if ((_res & 1) != 0) return;
10852 LDKCResult_PaymentSecretAPIErrorZ _res_conv = *(LDKCResult_PaymentSecretAPIErrorZ*)(((uint64_t)_res) & ~1);
10854 CResult_PaymentSecretAPIErrorZ_free(_res_conv);
10857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10858 LDKCResult_PaymentSecretAPIErrorZ* orig_conv = (LDKCResult_PaymentSecretAPIErrorZ*)(orig & ~1);
10859 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
10860 *ret_conv = CResult_PaymentSecretAPIErrorZ_clone(orig_conv);
10861 return (uint64_t)ret_conv;
10864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
10865 LDKCVec_ChannelMonitorZ _res_constr;
10866 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
10867 if (_res_constr.datalen > 0)
10868 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
10870 _res_constr.data = NULL;
10871 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
10872 for (size_t q = 0; q < _res_constr.datalen; q++) {
10873 int64_t _res_conv_16 = _res_vals[q];
10874 LDKChannelMonitor _res_conv_16_conv;
10875 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
10876 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
10877 _res_constr.data[q] = _res_conv_16_conv;
10879 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
10880 CVec_ChannelMonitorZ_free(_res_constr);
10883 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
10884 LDKThirtyTwoBytes a_ref;
10885 CHECK((*env)->GetArrayLength(env, a) == 32);
10886 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
10887 LDKChannelManager b_conv;
10888 b_conv.inner = (void*)(b & (~1));
10889 b_conv.is_owned = (b & 1) || (b == 0);
10890 // Warning: we need a move here but no clone is available for LDKChannelManager
10891 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
10892 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
10893 return (uint64_t)ret_ref;
10896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10897 if ((_res & 1) != 0) return;
10898 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)_res) & ~1);
10900 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
10903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10904 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
10905 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10906 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
10907 return (uint64_t)ret_conv;
10910 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10911 LDKDecodeError e_conv;
10912 e_conv.inner = (void*)(e & (~1));
10913 e_conv.is_owned = (e & 1) || (e == 0);
10914 e_conv = DecodeError_clone(&e_conv);
10915 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
10916 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
10917 return (uint64_t)ret_conv;
10920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10921 if ((_res & 1) != 0) return;
10922 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)(((uint64_t)_res) & ~1);
10924 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
10927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10928 LDKChannelConfig o_conv;
10929 o_conv.inner = (void*)(o & (~1));
10930 o_conv.is_owned = (o & 1) || (o == 0);
10931 o_conv = ChannelConfig_clone(&o_conv);
10932 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10933 *ret_conv = CResult_ChannelConfigDecodeErrorZ_ok(o_conv);
10934 return (uint64_t)ret_conv;
10937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10938 LDKDecodeError e_conv;
10939 e_conv.inner = (void*)(e & (~1));
10940 e_conv.is_owned = (e & 1) || (e == 0);
10941 e_conv = DecodeError_clone(&e_conv);
10942 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10943 *ret_conv = CResult_ChannelConfigDecodeErrorZ_err(e_conv);
10944 return (uint64_t)ret_conv;
10947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10948 if ((_res & 1) != 0) return;
10949 LDKCResult_ChannelConfigDecodeErrorZ _res_conv = *(LDKCResult_ChannelConfigDecodeErrorZ*)(((uint64_t)_res) & ~1);
10951 CResult_ChannelConfigDecodeErrorZ_free(_res_conv);
10954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelConfigDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10955 LDKCResult_ChannelConfigDecodeErrorZ* orig_conv = (LDKCResult_ChannelConfigDecodeErrorZ*)(orig & ~1);
10956 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
10957 *ret_conv = CResult_ChannelConfigDecodeErrorZ_clone(orig_conv);
10958 return (uint64_t)ret_conv;
10961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
10962 LDKOutPoint o_conv;
10963 o_conv.inner = (void*)(o & (~1));
10964 o_conv.is_owned = (o & 1) || (o == 0);
10965 o_conv = OutPoint_clone(&o_conv);
10966 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10967 *ret_conv = CResult_OutPointDecodeErrorZ_ok(o_conv);
10968 return (uint64_t)ret_conv;
10971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
10972 LDKDecodeError e_conv;
10973 e_conv.inner = (void*)(e & (~1));
10974 e_conv.is_owned = (e & 1) || (e == 0);
10975 e_conv = DecodeError_clone(&e_conv);
10976 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10977 *ret_conv = CResult_OutPointDecodeErrorZ_err(e_conv);
10978 return (uint64_t)ret_conv;
10981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
10982 if ((_res & 1) != 0) return;
10983 LDKCResult_OutPointDecodeErrorZ _res_conv = *(LDKCResult_OutPointDecodeErrorZ*)(((uint64_t)_res) & ~1);
10985 CResult_OutPointDecodeErrorZ_free(_res_conv);
10988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10989 LDKCResult_OutPointDecodeErrorZ* orig_conv = (LDKCResult_OutPointDecodeErrorZ*)(orig & ~1);
10990 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
10991 *ret_conv = CResult_OutPointDecodeErrorZ_clone(orig_conv);
10992 return (uint64_t)ret_conv;
10995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
10996 LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
10997 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
10998 *ret_conv = CResult_SiPrefixNoneZ_ok(o_conv);
10999 return (uint64_t)ret_conv;
11002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1err(JNIEnv *env, jclass clz) {
11003 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11004 *ret_conv = CResult_SiPrefixNoneZ_err();
11005 return (uint64_t)ret_conv;
11008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11009 if ((_res & 1) != 0) return;
11010 LDKCResult_SiPrefixNoneZ _res_conv = *(LDKCResult_SiPrefixNoneZ*)(((uint64_t)_res) & ~1);
11012 CResult_SiPrefixNoneZ_free(_res_conv);
11015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11016 LDKCResult_SiPrefixNoneZ* orig_conv = (LDKCResult_SiPrefixNoneZ*)(orig & ~1);
11017 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
11018 *ret_conv = CResult_SiPrefixNoneZ_clone(orig_conv);
11019 return (uint64_t)ret_conv;
11022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11024 o_conv.inner = (void*)(o & (~1));
11025 o_conv.is_owned = (o & 1) || (o == 0);
11026 o_conv = Invoice_clone(&o_conv);
11027 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11028 *ret_conv = CResult_InvoiceNoneZ_ok(o_conv);
11029 return (uint64_t)ret_conv;
11032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
11033 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11034 *ret_conv = CResult_InvoiceNoneZ_err();
11035 return (uint64_t)ret_conv;
11038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11039 if ((_res & 1) != 0) return;
11040 LDKCResult_InvoiceNoneZ _res_conv = *(LDKCResult_InvoiceNoneZ*)(((uint64_t)_res) & ~1);
11042 CResult_InvoiceNoneZ_free(_res_conv);
11045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11046 LDKCResult_InvoiceNoneZ* orig_conv = (LDKCResult_InvoiceNoneZ*)(orig & ~1);
11047 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
11048 *ret_conv = CResult_InvoiceNoneZ_clone(orig_conv);
11049 return (uint64_t)ret_conv;
11052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11053 LDKSignedRawInvoice o_conv;
11054 o_conv.inner = (void*)(o & (~1));
11055 o_conv.is_owned = (o & 1) || (o == 0);
11056 o_conv = SignedRawInvoice_clone(&o_conv);
11057 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11058 *ret_conv = CResult_SignedRawInvoiceNoneZ_ok(o_conv);
11059 return (uint64_t)ret_conv;
11062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1err(JNIEnv *env, jclass clz) {
11063 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11064 *ret_conv = CResult_SignedRawInvoiceNoneZ_err();
11065 return (uint64_t)ret_conv;
11068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11069 if ((_res & 1) != 0) return;
11070 LDKCResult_SignedRawInvoiceNoneZ _res_conv = *(LDKCResult_SignedRawInvoiceNoneZ*)(((uint64_t)_res) & ~1);
11072 CResult_SignedRawInvoiceNoneZ_free(_res_conv);
11075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignedRawInvoiceNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11076 LDKCResult_SignedRawInvoiceNoneZ* orig_conv = (LDKCResult_SignedRawInvoiceNoneZ*)(orig & ~1);
11077 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
11078 *ret_conv = CResult_SignedRawInvoiceNoneZ_clone(orig_conv);
11079 return (uint64_t)ret_conv;
11082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11083 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* orig_conv = (LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(orig & ~1);
11084 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11085 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig_conv);
11086 return (uint64_t)ret_ref;
11089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b, int64_t c) {
11090 LDKRawInvoice a_conv;
11091 a_conv.inner = (void*)(a & (~1));
11092 a_conv.is_owned = (a & 1) || (a == 0);
11093 a_conv = RawInvoice_clone(&a_conv);
11094 LDKThirtyTwoBytes b_ref;
11095 CHECK((*env)->GetArrayLength(env, b) == 32);
11096 (*env)->GetByteArrayRegion(env, b, 0, 32, b_ref.data);
11097 LDKInvoiceSignature c_conv;
11098 c_conv.inner = (void*)(c & (~1));
11099 c_conv.is_owned = (c & 1) || (c == 0);
11100 c_conv = InvoiceSignature_clone(&c_conv);
11101 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
11102 *ret_ref = C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a_conv, b_ref, c_conv);
11103 return (uint64_t)ret_ref;
11106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1RawInvoice_1u832InvoiceSignatureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11107 if ((_res & 1) != 0) return;
11108 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res_conv = *(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ*)(((uint64_t)_res) & ~1);
11110 C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res_conv);
11113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11114 LDKPayeePubKey o_conv;
11115 o_conv.inner = (void*)(o & (~1));
11116 o_conv.is_owned = (o & 1) || (o == 0);
11117 o_conv = PayeePubKey_clone(&o_conv);
11118 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11119 *ret_conv = CResult_PayeePubKeyErrorZ_ok(o_conv);
11120 return (uint64_t)ret_conv;
11123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11124 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11125 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11126 *ret_conv = CResult_PayeePubKeyErrorZ_err(e_conv);
11127 return (uint64_t)ret_conv;
11130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11131 if ((_res & 1) != 0) return;
11132 LDKCResult_PayeePubKeyErrorZ _res_conv = *(LDKCResult_PayeePubKeyErrorZ*)(((uint64_t)_res) & ~1);
11134 CResult_PayeePubKeyErrorZ_free(_res_conv);
11137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PayeePubKeyErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11138 LDKCResult_PayeePubKeyErrorZ* orig_conv = (LDKCResult_PayeePubKeyErrorZ*)(orig & ~1);
11139 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
11140 *ret_conv = CResult_PayeePubKeyErrorZ_clone(orig_conv);
11141 return (uint64_t)ret_conv;
11144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PrivateRouteZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11145 LDKCVec_PrivateRouteZ _res_constr;
11146 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11147 if (_res_constr.datalen > 0)
11148 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPrivateRoute), "LDKCVec_PrivateRouteZ Elements");
11150 _res_constr.data = NULL;
11151 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11152 for (size_t o = 0; o < _res_constr.datalen; o++) {
11153 int64_t _res_conv_14 = _res_vals[o];
11154 LDKPrivateRoute _res_conv_14_conv;
11155 _res_conv_14_conv.inner = (void*)(_res_conv_14 & (~1));
11156 _res_conv_14_conv.is_owned = (_res_conv_14 & 1) || (_res_conv_14 == 0);
11157 _res_constr.data[o] = _res_conv_14_conv;
11159 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11160 CVec_PrivateRouteZ_free(_res_constr);
11163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11164 LDKPositiveTimestamp o_conv;
11165 o_conv.inner = (void*)(o & (~1));
11166 o_conv.is_owned = (o & 1) || (o == 0);
11167 o_conv = PositiveTimestamp_clone(&o_conv);
11168 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11169 *ret_conv = CResult_PositiveTimestampCreationErrorZ_ok(o_conv);
11170 return (uint64_t)ret_conv;
11173 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11174 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11175 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11176 *ret_conv = CResult_PositiveTimestampCreationErrorZ_err(e_conv);
11177 return (uint64_t)ret_conv;
11180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11181 if ((_res & 1) != 0) return;
11182 LDKCResult_PositiveTimestampCreationErrorZ _res_conv = *(LDKCResult_PositiveTimestampCreationErrorZ*)(((uint64_t)_res) & ~1);
11184 CResult_PositiveTimestampCreationErrorZ_free(_res_conv);
11187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PositiveTimestampCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11188 LDKCResult_PositiveTimestampCreationErrorZ* orig_conv = (LDKCResult_PositiveTimestampCreationErrorZ*)(orig & ~1);
11189 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
11190 *ret_conv = CResult_PositiveTimestampCreationErrorZ_clone(orig_conv);
11191 return (uint64_t)ret_conv;
11194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1ok(JNIEnv *env, jclass clz) {
11195 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11196 *ret_conv = CResult_NoneSemanticErrorZ_ok();
11197 return (uint64_t)ret_conv;
11200 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11201 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
11202 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11203 *ret_conv = CResult_NoneSemanticErrorZ_err(e_conv);
11204 return (uint64_t)ret_conv;
11207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11208 if ((_res & 1) != 0) return;
11209 LDKCResult_NoneSemanticErrorZ _res_conv = *(LDKCResult_NoneSemanticErrorZ*)(((uint64_t)_res) & ~1);
11211 CResult_NoneSemanticErrorZ_free(_res_conv);
11214 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11215 LDKCResult_NoneSemanticErrorZ* orig_conv = (LDKCResult_NoneSemanticErrorZ*)(orig & ~1);
11216 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
11217 *ret_conv = CResult_NoneSemanticErrorZ_clone(orig_conv);
11218 return (uint64_t)ret_conv;
11221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11223 o_conv.inner = (void*)(o & (~1));
11224 o_conv.is_owned = (o & 1) || (o == 0);
11225 o_conv = Invoice_clone(&o_conv);
11226 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11227 *ret_conv = CResult_InvoiceSemanticErrorZ_ok(o_conv);
11228 return (uint64_t)ret_conv;
11231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11232 LDKSemanticError e_conv = LDKSemanticError_from_java(env, e);
11233 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11234 *ret_conv = CResult_InvoiceSemanticErrorZ_err(e_conv);
11235 return (uint64_t)ret_conv;
11238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11239 if ((_res & 1) != 0) return;
11240 LDKCResult_InvoiceSemanticErrorZ _res_conv = *(LDKCResult_InvoiceSemanticErrorZ*)(((uint64_t)_res) & ~1);
11242 CResult_InvoiceSemanticErrorZ_free(_res_conv);
11245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSemanticErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11246 LDKCResult_InvoiceSemanticErrorZ* orig_conv = (LDKCResult_InvoiceSemanticErrorZ*)(orig & ~1);
11247 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
11248 *ret_conv = CResult_InvoiceSemanticErrorZ_clone(orig_conv);
11249 return (uint64_t)ret_conv;
11252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11253 LDKDescription o_conv;
11254 o_conv.inner = (void*)(o & (~1));
11255 o_conv.is_owned = (o & 1) || (o == 0);
11256 o_conv = Description_clone(&o_conv);
11257 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11258 *ret_conv = CResult_DescriptionCreationErrorZ_ok(o_conv);
11259 return (uint64_t)ret_conv;
11262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11263 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11264 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11265 *ret_conv = CResult_DescriptionCreationErrorZ_err(e_conv);
11266 return (uint64_t)ret_conv;
11269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11270 if ((_res & 1) != 0) return;
11271 LDKCResult_DescriptionCreationErrorZ _res_conv = *(LDKCResult_DescriptionCreationErrorZ*)(((uint64_t)_res) & ~1);
11273 CResult_DescriptionCreationErrorZ_free(_res_conv);
11276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DescriptionCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11277 LDKCResult_DescriptionCreationErrorZ* orig_conv = (LDKCResult_DescriptionCreationErrorZ*)(orig & ~1);
11278 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
11279 *ret_conv = CResult_DescriptionCreationErrorZ_clone(orig_conv);
11280 return (uint64_t)ret_conv;
11283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11284 LDKExpiryTime o_conv;
11285 o_conv.inner = (void*)(o & (~1));
11286 o_conv.is_owned = (o & 1) || (o == 0);
11287 o_conv = ExpiryTime_clone(&o_conv);
11288 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11289 *ret_conv = CResult_ExpiryTimeCreationErrorZ_ok(o_conv);
11290 return (uint64_t)ret_conv;
11293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11294 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11295 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11296 *ret_conv = CResult_ExpiryTimeCreationErrorZ_err(e_conv);
11297 return (uint64_t)ret_conv;
11300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11301 if ((_res & 1) != 0) return;
11302 LDKCResult_ExpiryTimeCreationErrorZ _res_conv = *(LDKCResult_ExpiryTimeCreationErrorZ*)(((uint64_t)_res) & ~1);
11304 CResult_ExpiryTimeCreationErrorZ_free(_res_conv);
11307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ExpiryTimeCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11308 LDKCResult_ExpiryTimeCreationErrorZ* orig_conv = (LDKCResult_ExpiryTimeCreationErrorZ*)(orig & ~1);
11309 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
11310 *ret_conv = CResult_ExpiryTimeCreationErrorZ_clone(orig_conv);
11311 return (uint64_t)ret_conv;
11314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11315 LDKPrivateRoute o_conv;
11316 o_conv.inner = (void*)(o & (~1));
11317 o_conv.is_owned = (o & 1) || (o == 0);
11318 o_conv = PrivateRoute_clone(&o_conv);
11319 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11320 *ret_conv = CResult_PrivateRouteCreationErrorZ_ok(o_conv);
11321 return (uint64_t)ret_conv;
11324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11325 LDKCreationError e_conv = LDKCreationError_from_java(env, e);
11326 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11327 *ret_conv = CResult_PrivateRouteCreationErrorZ_err(e_conv);
11328 return (uint64_t)ret_conv;
11331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11332 if ((_res & 1) != 0) return;
11333 LDKCResult_PrivateRouteCreationErrorZ _res_conv = *(LDKCResult_PrivateRouteCreationErrorZ*)(((uint64_t)_res) & ~1);
11335 CResult_PrivateRouteCreationErrorZ_free(_res_conv);
11338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PrivateRouteCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11339 LDKCResult_PrivateRouteCreationErrorZ* orig_conv = (LDKCResult_PrivateRouteCreationErrorZ*)(orig & ~1);
11340 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
11341 *ret_conv = CResult_PrivateRouteCreationErrorZ_clone(orig_conv);
11342 return (uint64_t)ret_conv;
11345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1ok(JNIEnv *env, jclass clz, jstring o) {
11346 LDKStr o_conv = java_to_owned_str(env, o);
11347 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11348 *ret_conv = CResult_StringErrorZ_ok(o_conv);
11349 return (uint64_t)ret_conv;
11352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
11353 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
11354 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
11355 *ret_conv = CResult_StringErrorZ_err(e_conv);
11356 return (uint64_t)ret_conv;
11359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1StringErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11360 if ((_res & 1) != 0) return;
11361 LDKCResult_StringErrorZ _res_conv = *(LDKCResult_StringErrorZ*)(((uint64_t)_res) & ~1);
11363 CResult_StringErrorZ_free(_res_conv);
11366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11367 LDKChannelMonitorUpdate o_conv;
11368 o_conv.inner = (void*)(o & (~1));
11369 o_conv.is_owned = (o & 1) || (o == 0);
11370 o_conv = ChannelMonitorUpdate_clone(&o_conv);
11371 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11372 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
11373 return (uint64_t)ret_conv;
11376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11377 LDKDecodeError e_conv;
11378 e_conv.inner = (void*)(e & (~1));
11379 e_conv.is_owned = (e & 1) || (e == 0);
11380 e_conv = DecodeError_clone(&e_conv);
11381 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11382 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
11383 return (uint64_t)ret_conv;
11386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11387 if ((_res & 1) != 0) return;
11388 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11390 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
11393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11394 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)(orig & ~1);
11395 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
11396 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig_conv);
11397 return (uint64_t)ret_conv;
11400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11401 LDKHTLCUpdate o_conv;
11402 o_conv.inner = (void*)(o & (~1));
11403 o_conv.is_owned = (o & 1) || (o == 0);
11404 o_conv = HTLCUpdate_clone(&o_conv);
11405 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11406 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_ok(o_conv);
11407 return (uint64_t)ret_conv;
11410 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11411 LDKDecodeError e_conv;
11412 e_conv.inner = (void*)(e & (~1));
11413 e_conv.is_owned = (e & 1) || (e == 0);
11414 e_conv = DecodeError_clone(&e_conv);
11415 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11416 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_err(e_conv);
11417 return (uint64_t)ret_conv;
11420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11421 if ((_res & 1) != 0) return;
11422 LDKCResult_HTLCUpdateDecodeErrorZ _res_conv = *(LDKCResult_HTLCUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
11424 CResult_HTLCUpdateDecodeErrorZ_free(_res_conv);
11427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11428 LDKCResult_HTLCUpdateDecodeErrorZ* orig_conv = (LDKCResult_HTLCUpdateDecodeErrorZ*)(orig & ~1);
11429 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
11430 *ret_conv = CResult_HTLCUpdateDecodeErrorZ_clone(orig_conv);
11431 return (uint64_t)ret_conv;
11434 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
11435 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11436 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
11437 return (uint64_t)ret_conv;
11440 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11441 LDKMonitorUpdateError e_conv;
11442 e_conv.inner = (void*)(e & (~1));
11443 e_conv.is_owned = (e & 1) || (e == 0);
11444 e_conv = MonitorUpdateError_clone(&e_conv);
11445 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11446 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
11447 return (uint64_t)ret_conv;
11450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11451 if ((_res & 1) != 0) return;
11452 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(((uint64_t)_res) & ~1);
11454 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
11457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11458 LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1);
11459 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
11460 *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv);
11461 return (uint64_t)ret_conv;
11464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11465 LDKC2Tuple_OutPointScriptZ* orig_conv = (LDKC2Tuple_OutPointScriptZ*)(orig & ~1);
11466 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11467 *ret_ref = C2Tuple_OutPointScriptZ_clone(orig_conv);
11468 return (uint64_t)ret_ref;
11471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
11472 LDKOutPoint a_conv;
11473 a_conv.inner = (void*)(a & (~1));
11474 a_conv.is_owned = (a & 1) || (a == 0);
11475 a_conv = OutPoint_clone(&a_conv);
11477 b_ref.datalen = (*env)->GetArrayLength(env, b);
11478 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11479 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11480 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
11481 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
11482 return (uint64_t)ret_ref;
11485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11486 if ((_res & 1) != 0) return;
11487 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)(((uint64_t)_res) & ~1);
11489 C2Tuple_OutPointScriptZ_free(_res_conv);
11492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11493 LDKC2Tuple_u32ScriptZ* orig_conv = (LDKC2Tuple_u32ScriptZ*)(orig & ~1);
11494 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11495 *ret_ref = C2Tuple_u32ScriptZ_clone(orig_conv);
11496 return (uint64_t)ret_ref;
11499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1new(JNIEnv *env, jclass clz, int32_t a, int8_tArray b) {
11501 b_ref.datalen = (*env)->GetArrayLength(env, b);
11502 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
11503 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
11504 LDKC2Tuple_u32ScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32ScriptZ), "LDKC2Tuple_u32ScriptZ");
11505 *ret_ref = C2Tuple_u32ScriptZ_new(a, b_ref);
11506 return (uint64_t)ret_ref;
11509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32ScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11510 if ((_res & 1) != 0) return;
11511 LDKC2Tuple_u32ScriptZ _res_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res) & ~1);
11513 C2Tuple_u32ScriptZ_free(_res_conv);
11516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32ScriptZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11517 LDKCVec_C2Tuple_u32ScriptZZ _res_constr;
11518 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11519 if (_res_constr.datalen > 0)
11520 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11522 _res_constr.data = NULL;
11523 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11524 for (size_t b = 0; b < _res_constr.datalen; b++) {
11525 int64_t _res_conv_27 = _res_vals[b];
11526 LDKC2Tuple_u32ScriptZ _res_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)_res_conv_27) & ~1);
11527 FREE((void*)_res_conv_27);
11528 _res_constr.data[b] = _res_conv_27_conv;
11530 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11531 CVec_C2Tuple_u32ScriptZZ_free(_res_constr);
11534 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11535 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(orig & ~1);
11536 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11537 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig_conv);
11538 return (uint64_t)ret_ref;
11541 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11542 LDKThirtyTwoBytes a_ref;
11543 CHECK((*env)->GetArrayLength(env, a) == 32);
11544 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11545 LDKCVec_C2Tuple_u32ScriptZZ b_constr;
11546 b_constr.datalen = (*env)->GetArrayLength(env, b);
11547 if (b_constr.datalen > 0)
11548 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32ScriptZ), "LDKCVec_C2Tuple_u32ScriptZZ Elements");
11550 b_constr.data = NULL;
11551 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11552 for (size_t b = 0; b < b_constr.datalen; b++) {
11553 int64_t b_conv_27 = b_vals[b];
11554 LDKC2Tuple_u32ScriptZ b_conv_27_conv = *(LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1);
11555 b_conv_27_conv = C2Tuple_u32ScriptZ_clone((LDKC2Tuple_u32ScriptZ*)(((uint64_t)b_conv_27) & ~1));
11556 b_constr.data[b] = b_conv_27_conv;
11558 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11559 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
11560 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a_ref, b_constr);
11561 return (uint64_t)ret_ref;
11564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11565 if ((_res & 1) != 0) return;
11566 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res) & ~1);
11568 C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res_conv);
11571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32ScriptZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11572 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res_constr;
11573 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11574 if (_res_constr.datalen > 0)
11575 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ Elements");
11577 _res_constr.data = NULL;
11578 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11579 for (size_t v = 0; v < _res_constr.datalen; v++) {
11580 int64_t _res_conv_47 = _res_vals[v];
11581 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res_conv_47_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ*)(((uint64_t)_res_conv_47) & ~1);
11582 FREE((void*)_res_conv_47);
11583 _res_constr.data[v] = _res_conv_47_conv;
11585 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11586 CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res_constr);
11589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11590 LDKCVec_EventZ _res_constr;
11591 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11592 if (_res_constr.datalen > 0)
11593 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
11595 _res_constr.data = NULL;
11596 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11597 for (size_t h = 0; h < _res_constr.datalen; h++) {
11598 int64_t _res_conv_7 = _res_vals[h];
11599 LDKEvent _res_conv_7_conv = *(LDKEvent*)(((uint64_t)_res_conv_7) & ~1);
11600 FREE((void*)_res_conv_7);
11601 _res_constr.data[h] = _res_conv_7_conv;
11603 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11604 CVec_EventZ_free(_res_constr);
11607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11608 LDKCVec_TransactionZ _res_constr;
11609 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11610 if (_res_constr.datalen > 0)
11611 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
11613 _res_constr.data = NULL;
11614 for (size_t i = 0; i < _res_constr.datalen; i++) {
11615 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11616 LDKTransaction _res_conv_8_ref;
11617 _res_conv_8_ref.datalen = (*env)->GetArrayLength(env, _res_conv_8);
11618 _res_conv_8_ref.data = MALLOC(_res_conv_8_ref.datalen, "LDKTransaction Bytes");
11619 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, _res_conv_8_ref.datalen, _res_conv_8_ref.data);
11620 _res_conv_8_ref.data_is_owned = true;
11621 _res_constr.data[i] = _res_conv_8_ref;
11623 CVec_TransactionZ_free(_res_constr);
11626 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11627 LDKC2Tuple_u32TxOutZ* orig_conv = (LDKC2Tuple_u32TxOutZ*)(orig & ~1);
11628 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11629 *ret_ref = C2Tuple_u32TxOutZ_clone(orig_conv);
11630 return (uint64_t)ret_ref;
11633 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
11634 LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
11635 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
11636 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
11637 return (uint64_t)ret_ref;
11640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11641 if ((_res & 1) != 0) return;
11642 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res) & ~1);
11644 C2Tuple_u32TxOutZ_free(_res_conv);
11647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11648 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
11649 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11650 if (_res_constr.datalen > 0)
11651 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11653 _res_constr.data = NULL;
11654 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11655 for (size_t a = 0; a < _res_constr.datalen; a++) {
11656 int64_t _res_conv_26 = _res_vals[a];
11657 LDKC2Tuple_u32TxOutZ _res_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)_res_conv_26) & ~1);
11658 FREE((void*)_res_conv_26);
11659 _res_constr.data[a] = _res_conv_26_conv;
11661 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11662 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
11665 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11666 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* orig_conv = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(orig & ~1);
11667 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11668 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig_conv);
11669 return (uint64_t)ret_ref;
11672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
11673 LDKThirtyTwoBytes a_ref;
11674 CHECK((*env)->GetArrayLength(env, a) == 32);
11675 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
11676 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
11677 b_constr.datalen = (*env)->GetArrayLength(env, b);
11678 if (b_constr.datalen > 0)
11679 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
11681 b_constr.data = NULL;
11682 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
11683 for (size_t a = 0; a < b_constr.datalen; a++) {
11684 int64_t b_conv_26 = b_vals[a];
11685 LDKC2Tuple_u32TxOutZ b_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1);
11686 b_conv_26_conv = C2Tuple_u32TxOutZ_clone((LDKC2Tuple_u32TxOutZ*)(((uint64_t)b_conv_26) & ~1));
11687 b_constr.data[a] = b_conv_26_conv;
11689 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
11690 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
11691 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
11692 return (uint64_t)ret_ref;
11695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11696 if ((_res & 1) != 0) return;
11697 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res) & ~1);
11699 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
11702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11703 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
11704 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11705 if (_res_constr.datalen > 0)
11706 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
11708 _res_constr.data = NULL;
11709 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11710 for (size_t u = 0; u < _res_constr.datalen; u++) {
11711 int64_t _res_conv_46 = _res_vals[u];
11712 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)(((uint64_t)_res_conv_46) & ~1);
11713 FREE((void*)_res_conv_46);
11714 _res_constr.data[u] = _res_conv_46_conv;
11716 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11717 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
11720 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11721 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
11722 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11723 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
11724 return (uint64_t)ret_conv;
11727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11728 LDKDecodeError e_conv;
11729 e_conv.inner = (void*)(e & (~1));
11730 e_conv.is_owned = (e & 1) || (e == 0);
11731 e_conv = DecodeError_clone(&e_conv);
11732 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
11733 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
11734 return (uint64_t)ret_conv;
11737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11738 if ((_res & 1) != 0) return;
11739 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(((uint64_t)_res) & ~1);
11741 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
11744 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11745 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11746 *ret_conv = CResult_boolLightningErrorZ_ok(o);
11747 return (uint64_t)ret_conv;
11750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11751 LDKLightningError e_conv;
11752 e_conv.inner = (void*)(e & (~1));
11753 e_conv.is_owned = (e & 1) || (e == 0);
11754 e_conv = LightningError_clone(&e_conv);
11755 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11756 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
11757 return (uint64_t)ret_conv;
11760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11761 if ((_res & 1) != 0) return;
11762 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
11764 CResult_boolLightningErrorZ_free(_res_conv);
11767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11768 LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
11769 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
11770 *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
11771 return (uint64_t)ret_conv;
11774 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11775 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
11776 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11777 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
11778 return (uint64_t)ret_ref;
11781 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) {
11782 LDKChannelAnnouncement a_conv;
11783 a_conv.inner = (void*)(a & (~1));
11784 a_conv.is_owned = (a & 1) || (a == 0);
11785 a_conv = ChannelAnnouncement_clone(&a_conv);
11786 LDKChannelUpdate b_conv;
11787 b_conv.inner = (void*)(b & (~1));
11788 b_conv.is_owned = (b & 1) || (b == 0);
11789 b_conv = ChannelUpdate_clone(&b_conv);
11790 LDKChannelUpdate c_conv;
11791 c_conv.inner = (void*)(c & (~1));
11792 c_conv.is_owned = (c & 1) || (c == 0);
11793 c_conv = ChannelUpdate_clone(&c_conv);
11794 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
11795 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
11796 return (uint64_t)ret_ref;
11799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11800 if ((_res & 1) != 0) return;
11801 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res) & ~1);
11803 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
11806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11807 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
11808 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11809 if (_res_constr.datalen > 0)
11810 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
11812 _res_constr.data = NULL;
11813 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11814 for (size_t l = 0; l < _res_constr.datalen; l++) {
11815 int64_t _res_conv_63 = _res_vals[l];
11816 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(((uint64_t)_res_conv_63) & ~1);
11817 FREE((void*)_res_conv_63);
11818 _res_constr.data[l] = _res_conv_63_conv;
11820 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11821 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
11824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
11825 LDKCVec_NodeAnnouncementZ _res_constr;
11826 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11827 if (_res_constr.datalen > 0)
11828 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
11830 _res_constr.data = NULL;
11831 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
11832 for (size_t s = 0; s < _res_constr.datalen; s++) {
11833 int64_t _res_conv_18 = _res_vals[s];
11834 LDKNodeAnnouncement _res_conv_18_conv;
11835 _res_conv_18_conv.inner = (void*)(_res_conv_18 & (~1));
11836 _res_conv_18_conv.is_owned = (_res_conv_18 & 1) || (_res_conv_18 == 0);
11837 _res_constr.data[s] = _res_conv_18_conv;
11839 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
11840 CVec_NodeAnnouncementZ_free(_res_constr);
11843 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
11844 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11845 *ret_conv = CResult_NoneLightningErrorZ_ok();
11846 return (uint64_t)ret_conv;
11849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11850 LDKLightningError e_conv;
11851 e_conv.inner = (void*)(e & (~1));
11852 e_conv.is_owned = (e & 1) || (e == 0);
11853 e_conv = LightningError_clone(&e_conv);
11854 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11855 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
11856 return (uint64_t)ret_conv;
11859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11860 if ((_res & 1) != 0) return;
11861 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
11863 CResult_NoneLightningErrorZ_free(_res_conv);
11866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11867 LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
11868 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
11869 *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
11870 return (uint64_t)ret_conv;
11873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
11874 LDKCVec_PublicKeyZ _res_constr;
11875 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
11876 if (_res_constr.datalen > 0)
11877 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
11879 _res_constr.data = NULL;
11880 for (size_t i = 0; i < _res_constr.datalen; i++) {
11881 int8_tArray _res_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
11882 LDKPublicKey _res_conv_8_ref;
11883 CHECK((*env)->GetArrayLength(env, _res_conv_8) == 33);
11884 (*env)->GetByteArrayRegion(env, _res_conv_8, 0, 33, _res_conv_8_ref.compressed_form);
11885 _res_constr.data[i] = _res_conv_8_ref;
11887 CVec_PublicKeyZ_free(_res_constr);
11890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
11892 o_ref.datalen = (*env)->GetArrayLength(env, o);
11893 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
11894 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
11895 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11896 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
11897 return (uint64_t)ret_conv;
11900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11901 LDKPeerHandleError e_conv;
11902 e_conv.inner = (void*)(e & (~1));
11903 e_conv.is_owned = (e & 1) || (e == 0);
11904 e_conv = PeerHandleError_clone(&e_conv);
11905 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11906 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
11907 return (uint64_t)ret_conv;
11910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11911 if ((_res & 1) != 0) return;
11912 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11914 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
11917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11918 LDKCResult_CVec_u8ZPeerHandleErrorZ* orig_conv = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)(orig & ~1);
11919 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11920 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_clone(orig_conv);
11921 return (uint64_t)ret_conv;
11924 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
11925 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11926 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
11927 return (uint64_t)ret_conv;
11930 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11931 LDKPeerHandleError e_conv;
11932 e_conv.inner = (void*)(e & (~1));
11933 e_conv.is_owned = (e & 1) || (e == 0);
11934 e_conv = PeerHandleError_clone(&e_conv);
11935 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11936 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
11937 return (uint64_t)ret_conv;
11940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11941 if ((_res & 1) != 0) return;
11942 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11944 CResult_NonePeerHandleErrorZ_free(_res_conv);
11947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11948 LDKCResult_NonePeerHandleErrorZ* orig_conv = (LDKCResult_NonePeerHandleErrorZ*)(orig & ~1);
11949 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11950 *ret_conv = CResult_NonePeerHandleErrorZ_clone(orig_conv);
11951 return (uint64_t)ret_conv;
11954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
11955 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11956 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
11957 return (uint64_t)ret_conv;
11960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11961 LDKPeerHandleError e_conv;
11962 e_conv.inner = (void*)(e & (~1));
11963 e_conv.is_owned = (e & 1) || (e == 0);
11964 e_conv = PeerHandleError_clone(&e_conv);
11965 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11966 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
11967 return (uint64_t)ret_conv;
11970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
11971 if ((_res & 1) != 0) return;
11972 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)(((uint64_t)_res) & ~1);
11974 CResult_boolPeerHandleErrorZ_free(_res_conv);
11977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11978 LDKCResult_boolPeerHandleErrorZ* orig_conv = (LDKCResult_boolPeerHandleErrorZ*)(orig & ~1);
11979 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11980 *ret_conv = CResult_boolPeerHandleErrorZ_clone(orig_conv);
11981 return (uint64_t)ret_conv;
11984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
11985 LDKDirectionalChannelInfo o_conv;
11986 o_conv.inner = (void*)(o & (~1));
11987 o_conv.is_owned = (o & 1) || (o == 0);
11988 o_conv = DirectionalChannelInfo_clone(&o_conv);
11989 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
11990 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_ok(o_conv);
11991 return (uint64_t)ret_conv;
11994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
11995 LDKDecodeError e_conv;
11996 e_conv.inner = (void*)(e & (~1));
11997 e_conv.is_owned = (e & 1) || (e == 0);
11998 e_conv = DecodeError_clone(&e_conv);
11999 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12000 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_err(e_conv);
12001 return (uint64_t)ret_conv;
12004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12005 if ((_res & 1) != 0) return;
12006 LDKCResult_DirectionalChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12008 CResult_DirectionalChannelInfoDecodeErrorZ_free(_res_conv);
12011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12012 LDKCResult_DirectionalChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(orig & ~1);
12013 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
12014 *ret_conv = CResult_DirectionalChannelInfoDecodeErrorZ_clone(orig_conv);
12015 return (uint64_t)ret_conv;
12018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12019 LDKChannelInfo o_conv;
12020 o_conv.inner = (void*)(o & (~1));
12021 o_conv.is_owned = (o & 1) || (o == 0);
12022 o_conv = ChannelInfo_clone(&o_conv);
12023 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12024 *ret_conv = CResult_ChannelInfoDecodeErrorZ_ok(o_conv);
12025 return (uint64_t)ret_conv;
12028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12029 LDKDecodeError e_conv;
12030 e_conv.inner = (void*)(e & (~1));
12031 e_conv.is_owned = (e & 1) || (e == 0);
12032 e_conv = DecodeError_clone(&e_conv);
12033 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12034 *ret_conv = CResult_ChannelInfoDecodeErrorZ_err(e_conv);
12035 return (uint64_t)ret_conv;
12038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12039 if ((_res & 1) != 0) return;
12040 LDKCResult_ChannelInfoDecodeErrorZ _res_conv = *(LDKCResult_ChannelInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12042 CResult_ChannelInfoDecodeErrorZ_free(_res_conv);
12045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12046 LDKCResult_ChannelInfoDecodeErrorZ* orig_conv = (LDKCResult_ChannelInfoDecodeErrorZ*)(orig & ~1);
12047 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
12048 *ret_conv = CResult_ChannelInfoDecodeErrorZ_clone(orig_conv);
12049 return (uint64_t)ret_conv;
12052 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12053 LDKRoutingFees o_conv;
12054 o_conv.inner = (void*)(o & (~1));
12055 o_conv.is_owned = (o & 1) || (o == 0);
12056 o_conv = RoutingFees_clone(&o_conv);
12057 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12058 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
12059 return (uint64_t)ret_conv;
12062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12063 LDKDecodeError e_conv;
12064 e_conv.inner = (void*)(e & (~1));
12065 e_conv.is_owned = (e & 1) || (e == 0);
12066 e_conv = DecodeError_clone(&e_conv);
12067 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12068 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
12069 return (uint64_t)ret_conv;
12072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12073 if ((_res & 1) != 0) return;
12074 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12076 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
12079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12080 LDKCResult_RoutingFeesDecodeErrorZ* orig_conv = (LDKCResult_RoutingFeesDecodeErrorZ*)(orig & ~1);
12081 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
12082 *ret_conv = CResult_RoutingFeesDecodeErrorZ_clone(orig_conv);
12083 return (uint64_t)ret_conv;
12086 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12087 LDKNodeAnnouncementInfo o_conv;
12088 o_conv.inner = (void*)(o & (~1));
12089 o_conv.is_owned = (o & 1) || (o == 0);
12090 o_conv = NodeAnnouncementInfo_clone(&o_conv);
12091 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12092 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
12093 return (uint64_t)ret_conv;
12096 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12097 LDKDecodeError e_conv;
12098 e_conv.inner = (void*)(e & (~1));
12099 e_conv.is_owned = (e & 1) || (e == 0);
12100 e_conv = DecodeError_clone(&e_conv);
12101 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12102 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
12103 return (uint64_t)ret_conv;
12106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12107 if ((_res & 1) != 0) return;
12108 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12110 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
12113 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12114 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)(orig & ~1);
12115 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
12116 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig_conv);
12117 return (uint64_t)ret_conv;
12120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12121 LDKCVec_u64Z _res_constr;
12122 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12123 if (_res_constr.datalen > 0)
12124 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12126 _res_constr.data = NULL;
12127 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12128 for (size_t g = 0; g < _res_constr.datalen; g++) {
12129 int64_t _res_conv_6 = _res_vals[g];
12130 _res_constr.data[g] = _res_conv_6;
12132 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12133 CVec_u64Z_free(_res_constr);
12136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12137 LDKNodeInfo o_conv;
12138 o_conv.inner = (void*)(o & (~1));
12139 o_conv.is_owned = (o & 1) || (o == 0);
12140 o_conv = NodeInfo_clone(&o_conv);
12141 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12142 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
12143 return (uint64_t)ret_conv;
12146 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12147 LDKDecodeError e_conv;
12148 e_conv.inner = (void*)(e & (~1));
12149 e_conv.is_owned = (e & 1) || (e == 0);
12150 e_conv = DecodeError_clone(&e_conv);
12151 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12152 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
12153 return (uint64_t)ret_conv;
12156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12157 if ((_res & 1) != 0) return;
12158 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)(((uint64_t)_res) & ~1);
12160 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
12163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12164 LDKCResult_NodeInfoDecodeErrorZ* orig_conv = (LDKCResult_NodeInfoDecodeErrorZ*)(orig & ~1);
12165 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
12166 *ret_conv = CResult_NodeInfoDecodeErrorZ_clone(orig_conv);
12167 return (uint64_t)ret_conv;
12170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12171 LDKNetworkGraph o_conv;
12172 o_conv.inner = (void*)(o & (~1));
12173 o_conv.is_owned = (o & 1) || (o == 0);
12174 o_conv = NetworkGraph_clone(&o_conv);
12175 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12176 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
12177 return (uint64_t)ret_conv;
12180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12181 LDKDecodeError e_conv;
12182 e_conv.inner = (void*)(e & (~1));
12183 e_conv.is_owned = (e & 1) || (e == 0);
12184 e_conv = DecodeError_clone(&e_conv);
12185 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12186 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
12187 return (uint64_t)ret_conv;
12190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12191 if ((_res & 1) != 0) return;
12192 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)(((uint64_t)_res) & ~1);
12194 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
12197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12198 LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
12199 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
12200 *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
12201 return (uint64_t)ret_conv;
12204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
12205 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
12206 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12207 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
12208 return (uint64_t)ret_conv;
12211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
12212 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12213 *ret_conv = CResult_NetAddressu8Z_err(e);
12214 return (uint64_t)ret_conv;
12217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
12218 if ((_res & 1) != 0) return;
12219 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)_res) & ~1);
12221 CResult_NetAddressu8Z_free(_res_conv);
12224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12225 LDKCResult_NetAddressu8Z* orig_conv = (LDKCResult_NetAddressu8Z*)(orig & ~1);
12226 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
12227 *ret_conv = CResult_NetAddressu8Z_clone(orig_conv);
12228 return (uint64_t)ret_conv;
12231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12232 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
12233 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12234 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
12235 return (uint64_t)ret_conv;
12238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12239 LDKDecodeError e_conv;
12240 e_conv.inner = (void*)(e & (~1));
12241 e_conv.is_owned = (e & 1) || (e == 0);
12242 e_conv = DecodeError_clone(&e_conv);
12243 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12244 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
12245 return (uint64_t)ret_conv;
12248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12249 if ((_res & 1) != 0) return;
12250 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(((uint64_t)_res) & ~1);
12252 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
12255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12256 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* orig_conv = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)(orig & ~1);
12257 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
12258 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_clone(orig_conv);
12259 return (uint64_t)ret_conv;
12262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12263 LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
12264 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12265 *ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
12266 return (uint64_t)ret_conv;
12269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12270 LDKDecodeError e_conv;
12271 e_conv.inner = (void*)(e & (~1));
12272 e_conv.is_owned = (e & 1) || (e == 0);
12273 e_conv = DecodeError_clone(&e_conv);
12274 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12275 *ret_conv = CResult_NetAddressDecodeErrorZ_err(e_conv);
12276 return (uint64_t)ret_conv;
12279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12280 if ((_res & 1) != 0) return;
12281 LDKCResult_NetAddressDecodeErrorZ _res_conv = *(LDKCResult_NetAddressDecodeErrorZ*)(((uint64_t)_res) & ~1);
12283 CResult_NetAddressDecodeErrorZ_free(_res_conv);
12286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12287 LDKCResult_NetAddressDecodeErrorZ* orig_conv = (LDKCResult_NetAddressDecodeErrorZ*)(orig & ~1);
12288 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
12289 *ret_conv = CResult_NetAddressDecodeErrorZ_clone(orig_conv);
12290 return (uint64_t)ret_conv;
12293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12294 LDKCVec_UpdateAddHTLCZ _res_constr;
12295 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12296 if (_res_constr.datalen > 0)
12297 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12299 _res_constr.data = NULL;
12300 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12301 for (size_t p = 0; p < _res_constr.datalen; p++) {
12302 int64_t _res_conv_15 = _res_vals[p];
12303 LDKUpdateAddHTLC _res_conv_15_conv;
12304 _res_conv_15_conv.inner = (void*)(_res_conv_15 & (~1));
12305 _res_conv_15_conv.is_owned = (_res_conv_15 & 1) || (_res_conv_15 == 0);
12306 _res_constr.data[p] = _res_conv_15_conv;
12308 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12309 CVec_UpdateAddHTLCZ_free(_res_constr);
12312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12313 LDKCVec_UpdateFulfillHTLCZ _res_constr;
12314 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12315 if (_res_constr.datalen > 0)
12316 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12318 _res_constr.data = NULL;
12319 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12320 for (size_t t = 0; t < _res_constr.datalen; t++) {
12321 int64_t _res_conv_19 = _res_vals[t];
12322 LDKUpdateFulfillHTLC _res_conv_19_conv;
12323 _res_conv_19_conv.inner = (void*)(_res_conv_19 & (~1));
12324 _res_conv_19_conv.is_owned = (_res_conv_19 & 1) || (_res_conv_19 == 0);
12325 _res_constr.data[t] = _res_conv_19_conv;
12327 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12328 CVec_UpdateFulfillHTLCZ_free(_res_constr);
12331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12332 LDKCVec_UpdateFailHTLCZ _res_constr;
12333 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12334 if (_res_constr.datalen > 0)
12335 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
12337 _res_constr.data = NULL;
12338 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12339 for (size_t q = 0; q < _res_constr.datalen; q++) {
12340 int64_t _res_conv_16 = _res_vals[q];
12341 LDKUpdateFailHTLC _res_conv_16_conv;
12342 _res_conv_16_conv.inner = (void*)(_res_conv_16 & (~1));
12343 _res_conv_16_conv.is_owned = (_res_conv_16 & 1) || (_res_conv_16 == 0);
12344 _res_constr.data[q] = _res_conv_16_conv;
12346 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12347 CVec_UpdateFailHTLCZ_free(_res_constr);
12350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
12351 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
12352 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
12353 if (_res_constr.datalen > 0)
12354 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
12356 _res_constr.data = NULL;
12357 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
12358 for (size_t z = 0; z < _res_constr.datalen; z++) {
12359 int64_t _res_conv_25 = _res_vals[z];
12360 LDKUpdateFailMalformedHTLC _res_conv_25_conv;
12361 _res_conv_25_conv.inner = (void*)(_res_conv_25 & (~1));
12362 _res_conv_25_conv.is_owned = (_res_conv_25 & 1) || (_res_conv_25 == 0);
12363 _res_constr.data[z] = _res_conv_25_conv;
12365 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
12366 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
12369 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12370 LDKAcceptChannel o_conv;
12371 o_conv.inner = (void*)(o & (~1));
12372 o_conv.is_owned = (o & 1) || (o == 0);
12373 o_conv = AcceptChannel_clone(&o_conv);
12374 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12375 *ret_conv = CResult_AcceptChannelDecodeErrorZ_ok(o_conv);
12376 return (uint64_t)ret_conv;
12379 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12380 LDKDecodeError e_conv;
12381 e_conv.inner = (void*)(e & (~1));
12382 e_conv.is_owned = (e & 1) || (e == 0);
12383 e_conv = DecodeError_clone(&e_conv);
12384 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12385 *ret_conv = CResult_AcceptChannelDecodeErrorZ_err(e_conv);
12386 return (uint64_t)ret_conv;
12389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12390 if ((_res & 1) != 0) return;
12391 LDKCResult_AcceptChannelDecodeErrorZ _res_conv = *(LDKCResult_AcceptChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12393 CResult_AcceptChannelDecodeErrorZ_free(_res_conv);
12396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AcceptChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12397 LDKCResult_AcceptChannelDecodeErrorZ* orig_conv = (LDKCResult_AcceptChannelDecodeErrorZ*)(orig & ~1);
12398 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
12399 *ret_conv = CResult_AcceptChannelDecodeErrorZ_clone(orig_conv);
12400 return (uint64_t)ret_conv;
12403 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12404 LDKAnnouncementSignatures o_conv;
12405 o_conv.inner = (void*)(o & (~1));
12406 o_conv.is_owned = (o & 1) || (o == 0);
12407 o_conv = AnnouncementSignatures_clone(&o_conv);
12408 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12409 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_ok(o_conv);
12410 return (uint64_t)ret_conv;
12413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12414 LDKDecodeError e_conv;
12415 e_conv.inner = (void*)(e & (~1));
12416 e_conv.is_owned = (e & 1) || (e == 0);
12417 e_conv = DecodeError_clone(&e_conv);
12418 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12419 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_err(e_conv);
12420 return (uint64_t)ret_conv;
12423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12424 if ((_res & 1) != 0) return;
12425 LDKCResult_AnnouncementSignaturesDecodeErrorZ _res_conv = *(LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(((uint64_t)_res) & ~1);
12427 CResult_AnnouncementSignaturesDecodeErrorZ_free(_res_conv);
12430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1AnnouncementSignaturesDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12431 LDKCResult_AnnouncementSignaturesDecodeErrorZ* orig_conv = (LDKCResult_AnnouncementSignaturesDecodeErrorZ*)(orig & ~1);
12432 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
12433 *ret_conv = CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig_conv);
12434 return (uint64_t)ret_conv;
12437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12438 LDKChannelReestablish o_conv;
12439 o_conv.inner = (void*)(o & (~1));
12440 o_conv.is_owned = (o & 1) || (o == 0);
12441 o_conv = ChannelReestablish_clone(&o_conv);
12442 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12443 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
12444 return (uint64_t)ret_conv;
12447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12448 LDKDecodeError e_conv;
12449 e_conv.inner = (void*)(e & (~1));
12450 e_conv.is_owned = (e & 1) || (e == 0);
12451 e_conv = DecodeError_clone(&e_conv);
12452 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12453 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
12454 return (uint64_t)ret_conv;
12457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12458 if ((_res & 1) != 0) return;
12459 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)(((uint64_t)_res) & ~1);
12461 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
12464 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12465 LDKCResult_ChannelReestablishDecodeErrorZ* orig_conv = (LDKCResult_ChannelReestablishDecodeErrorZ*)(orig & ~1);
12466 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
12467 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_clone(orig_conv);
12468 return (uint64_t)ret_conv;
12471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12472 LDKClosingSigned o_conv;
12473 o_conv.inner = (void*)(o & (~1));
12474 o_conv.is_owned = (o & 1) || (o == 0);
12475 o_conv = ClosingSigned_clone(&o_conv);
12476 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12477 *ret_conv = CResult_ClosingSignedDecodeErrorZ_ok(o_conv);
12478 return (uint64_t)ret_conv;
12481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12482 LDKDecodeError e_conv;
12483 e_conv.inner = (void*)(e & (~1));
12484 e_conv.is_owned = (e & 1) || (e == 0);
12485 e_conv = DecodeError_clone(&e_conv);
12486 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12487 *ret_conv = CResult_ClosingSignedDecodeErrorZ_err(e_conv);
12488 return (uint64_t)ret_conv;
12491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12492 if ((_res & 1) != 0) return;
12493 LDKCResult_ClosingSignedDecodeErrorZ _res_conv = *(LDKCResult_ClosingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12495 CResult_ClosingSignedDecodeErrorZ_free(_res_conv);
12498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ClosingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12499 LDKCResult_ClosingSignedDecodeErrorZ* orig_conv = (LDKCResult_ClosingSignedDecodeErrorZ*)(orig & ~1);
12500 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
12501 *ret_conv = CResult_ClosingSignedDecodeErrorZ_clone(orig_conv);
12502 return (uint64_t)ret_conv;
12505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12506 LDKCommitmentSigned o_conv;
12507 o_conv.inner = (void*)(o & (~1));
12508 o_conv.is_owned = (o & 1) || (o == 0);
12509 o_conv = CommitmentSigned_clone(&o_conv);
12510 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12511 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_ok(o_conv);
12512 return (uint64_t)ret_conv;
12515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12516 LDKDecodeError e_conv;
12517 e_conv.inner = (void*)(e & (~1));
12518 e_conv.is_owned = (e & 1) || (e == 0);
12519 e_conv = DecodeError_clone(&e_conv);
12520 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12521 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_err(e_conv);
12522 return (uint64_t)ret_conv;
12525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12526 if ((_res & 1) != 0) return;
12527 LDKCResult_CommitmentSignedDecodeErrorZ _res_conv = *(LDKCResult_CommitmentSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12529 CResult_CommitmentSignedDecodeErrorZ_free(_res_conv);
12532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12533 LDKCResult_CommitmentSignedDecodeErrorZ* orig_conv = (LDKCResult_CommitmentSignedDecodeErrorZ*)(orig & ~1);
12534 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
12535 *ret_conv = CResult_CommitmentSignedDecodeErrorZ_clone(orig_conv);
12536 return (uint64_t)ret_conv;
12539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12540 LDKFundingCreated o_conv;
12541 o_conv.inner = (void*)(o & (~1));
12542 o_conv.is_owned = (o & 1) || (o == 0);
12543 o_conv = FundingCreated_clone(&o_conv);
12544 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12545 *ret_conv = CResult_FundingCreatedDecodeErrorZ_ok(o_conv);
12546 return (uint64_t)ret_conv;
12549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12550 LDKDecodeError e_conv;
12551 e_conv.inner = (void*)(e & (~1));
12552 e_conv.is_owned = (e & 1) || (e == 0);
12553 e_conv = DecodeError_clone(&e_conv);
12554 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12555 *ret_conv = CResult_FundingCreatedDecodeErrorZ_err(e_conv);
12556 return (uint64_t)ret_conv;
12559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12560 if ((_res & 1) != 0) return;
12561 LDKCResult_FundingCreatedDecodeErrorZ _res_conv = *(LDKCResult_FundingCreatedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12563 CResult_FundingCreatedDecodeErrorZ_free(_res_conv);
12566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingCreatedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12567 LDKCResult_FundingCreatedDecodeErrorZ* orig_conv = (LDKCResult_FundingCreatedDecodeErrorZ*)(orig & ~1);
12568 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
12569 *ret_conv = CResult_FundingCreatedDecodeErrorZ_clone(orig_conv);
12570 return (uint64_t)ret_conv;
12573 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12574 LDKFundingSigned o_conv;
12575 o_conv.inner = (void*)(o & (~1));
12576 o_conv.is_owned = (o & 1) || (o == 0);
12577 o_conv = FundingSigned_clone(&o_conv);
12578 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12579 *ret_conv = CResult_FundingSignedDecodeErrorZ_ok(o_conv);
12580 return (uint64_t)ret_conv;
12583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12584 LDKDecodeError e_conv;
12585 e_conv.inner = (void*)(e & (~1));
12586 e_conv.is_owned = (e & 1) || (e == 0);
12587 e_conv = DecodeError_clone(&e_conv);
12588 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12589 *ret_conv = CResult_FundingSignedDecodeErrorZ_err(e_conv);
12590 return (uint64_t)ret_conv;
12593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12594 if ((_res & 1) != 0) return;
12595 LDKCResult_FundingSignedDecodeErrorZ _res_conv = *(LDKCResult_FundingSignedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12597 CResult_FundingSignedDecodeErrorZ_free(_res_conv);
12600 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingSignedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12601 LDKCResult_FundingSignedDecodeErrorZ* orig_conv = (LDKCResult_FundingSignedDecodeErrorZ*)(orig & ~1);
12602 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
12603 *ret_conv = CResult_FundingSignedDecodeErrorZ_clone(orig_conv);
12604 return (uint64_t)ret_conv;
12607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12608 LDKFundingLocked o_conv;
12609 o_conv.inner = (void*)(o & (~1));
12610 o_conv.is_owned = (o & 1) || (o == 0);
12611 o_conv = FundingLocked_clone(&o_conv);
12612 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12613 *ret_conv = CResult_FundingLockedDecodeErrorZ_ok(o_conv);
12614 return (uint64_t)ret_conv;
12617 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12618 LDKDecodeError e_conv;
12619 e_conv.inner = (void*)(e & (~1));
12620 e_conv.is_owned = (e & 1) || (e == 0);
12621 e_conv = DecodeError_clone(&e_conv);
12622 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12623 *ret_conv = CResult_FundingLockedDecodeErrorZ_err(e_conv);
12624 return (uint64_t)ret_conv;
12627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12628 if ((_res & 1) != 0) return;
12629 LDKCResult_FundingLockedDecodeErrorZ _res_conv = *(LDKCResult_FundingLockedDecodeErrorZ*)(((uint64_t)_res) & ~1);
12631 CResult_FundingLockedDecodeErrorZ_free(_res_conv);
12634 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1FundingLockedDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12635 LDKCResult_FundingLockedDecodeErrorZ* orig_conv = (LDKCResult_FundingLockedDecodeErrorZ*)(orig & ~1);
12636 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
12637 *ret_conv = CResult_FundingLockedDecodeErrorZ_clone(orig_conv);
12638 return (uint64_t)ret_conv;
12641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12643 o_conv.inner = (void*)(o & (~1));
12644 o_conv.is_owned = (o & 1) || (o == 0);
12645 o_conv = Init_clone(&o_conv);
12646 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12647 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
12648 return (uint64_t)ret_conv;
12651 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12652 LDKDecodeError e_conv;
12653 e_conv.inner = (void*)(e & (~1));
12654 e_conv.is_owned = (e & 1) || (e == 0);
12655 e_conv = DecodeError_clone(&e_conv);
12656 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12657 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
12658 return (uint64_t)ret_conv;
12661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12662 if ((_res & 1) != 0) return;
12663 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)(((uint64_t)_res) & ~1);
12665 CResult_InitDecodeErrorZ_free(_res_conv);
12668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12669 LDKCResult_InitDecodeErrorZ* orig_conv = (LDKCResult_InitDecodeErrorZ*)(orig & ~1);
12670 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
12671 *ret_conv = CResult_InitDecodeErrorZ_clone(orig_conv);
12672 return (uint64_t)ret_conv;
12675 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12676 LDKOpenChannel o_conv;
12677 o_conv.inner = (void*)(o & (~1));
12678 o_conv.is_owned = (o & 1) || (o == 0);
12679 o_conv = OpenChannel_clone(&o_conv);
12680 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12681 *ret_conv = CResult_OpenChannelDecodeErrorZ_ok(o_conv);
12682 return (uint64_t)ret_conv;
12685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12686 LDKDecodeError e_conv;
12687 e_conv.inner = (void*)(e & (~1));
12688 e_conv.is_owned = (e & 1) || (e == 0);
12689 e_conv = DecodeError_clone(&e_conv);
12690 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12691 *ret_conv = CResult_OpenChannelDecodeErrorZ_err(e_conv);
12692 return (uint64_t)ret_conv;
12695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12696 if ((_res & 1) != 0) return;
12697 LDKCResult_OpenChannelDecodeErrorZ _res_conv = *(LDKCResult_OpenChannelDecodeErrorZ*)(((uint64_t)_res) & ~1);
12699 CResult_OpenChannelDecodeErrorZ_free(_res_conv);
12702 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1OpenChannelDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12703 LDKCResult_OpenChannelDecodeErrorZ* orig_conv = (LDKCResult_OpenChannelDecodeErrorZ*)(orig & ~1);
12704 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
12705 *ret_conv = CResult_OpenChannelDecodeErrorZ_clone(orig_conv);
12706 return (uint64_t)ret_conv;
12709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12710 LDKRevokeAndACK o_conv;
12711 o_conv.inner = (void*)(o & (~1));
12712 o_conv.is_owned = (o & 1) || (o == 0);
12713 o_conv = RevokeAndACK_clone(&o_conv);
12714 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12715 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_ok(o_conv);
12716 return (uint64_t)ret_conv;
12719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12720 LDKDecodeError e_conv;
12721 e_conv.inner = (void*)(e & (~1));
12722 e_conv.is_owned = (e & 1) || (e == 0);
12723 e_conv = DecodeError_clone(&e_conv);
12724 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12725 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_err(e_conv);
12726 return (uint64_t)ret_conv;
12729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12730 if ((_res & 1) != 0) return;
12731 LDKCResult_RevokeAndACKDecodeErrorZ _res_conv = *(LDKCResult_RevokeAndACKDecodeErrorZ*)(((uint64_t)_res) & ~1);
12733 CResult_RevokeAndACKDecodeErrorZ_free(_res_conv);
12736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RevokeAndACKDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12737 LDKCResult_RevokeAndACKDecodeErrorZ* orig_conv = (LDKCResult_RevokeAndACKDecodeErrorZ*)(orig & ~1);
12738 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
12739 *ret_conv = CResult_RevokeAndACKDecodeErrorZ_clone(orig_conv);
12740 return (uint64_t)ret_conv;
12743 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12744 LDKShutdown o_conv;
12745 o_conv.inner = (void*)(o & (~1));
12746 o_conv.is_owned = (o & 1) || (o == 0);
12747 o_conv = Shutdown_clone(&o_conv);
12748 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12749 *ret_conv = CResult_ShutdownDecodeErrorZ_ok(o_conv);
12750 return (uint64_t)ret_conv;
12753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12754 LDKDecodeError e_conv;
12755 e_conv.inner = (void*)(e & (~1));
12756 e_conv.is_owned = (e & 1) || (e == 0);
12757 e_conv = DecodeError_clone(&e_conv);
12758 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12759 *ret_conv = CResult_ShutdownDecodeErrorZ_err(e_conv);
12760 return (uint64_t)ret_conv;
12763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12764 if ((_res & 1) != 0) return;
12765 LDKCResult_ShutdownDecodeErrorZ _res_conv = *(LDKCResult_ShutdownDecodeErrorZ*)(((uint64_t)_res) & ~1);
12767 CResult_ShutdownDecodeErrorZ_free(_res_conv);
12770 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ShutdownDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12771 LDKCResult_ShutdownDecodeErrorZ* orig_conv = (LDKCResult_ShutdownDecodeErrorZ*)(orig & ~1);
12772 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
12773 *ret_conv = CResult_ShutdownDecodeErrorZ_clone(orig_conv);
12774 return (uint64_t)ret_conv;
12777 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12778 LDKUpdateFailHTLC o_conv;
12779 o_conv.inner = (void*)(o & (~1));
12780 o_conv.is_owned = (o & 1) || (o == 0);
12781 o_conv = UpdateFailHTLC_clone(&o_conv);
12782 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12783 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_ok(o_conv);
12784 return (uint64_t)ret_conv;
12787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12788 LDKDecodeError e_conv;
12789 e_conv.inner = (void*)(e & (~1));
12790 e_conv.is_owned = (e & 1) || (e == 0);
12791 e_conv = DecodeError_clone(&e_conv);
12792 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12793 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_err(e_conv);
12794 return (uint64_t)ret_conv;
12797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12798 if ((_res & 1) != 0) return;
12799 LDKCResult_UpdateFailHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12801 CResult_UpdateFailHTLCDecodeErrorZ_free(_res_conv);
12804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12805 LDKCResult_UpdateFailHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailHTLCDecodeErrorZ*)(orig & ~1);
12806 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
12807 *ret_conv = CResult_UpdateFailHTLCDecodeErrorZ_clone(orig_conv);
12808 return (uint64_t)ret_conv;
12811 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12812 LDKUpdateFailMalformedHTLC o_conv;
12813 o_conv.inner = (void*)(o & (~1));
12814 o_conv.is_owned = (o & 1) || (o == 0);
12815 o_conv = UpdateFailMalformedHTLC_clone(&o_conv);
12816 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12817 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o_conv);
12818 return (uint64_t)ret_conv;
12821 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12822 LDKDecodeError e_conv;
12823 e_conv.inner = (void*)(e & (~1));
12824 e_conv.is_owned = (e & 1) || (e == 0);
12825 e_conv = DecodeError_clone(&e_conv);
12826 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12827 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e_conv);
12828 return (uint64_t)ret_conv;
12831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12832 if ((_res & 1) != 0) return;
12833 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12835 CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res_conv);
12838 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFailMalformedHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12839 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ*)(orig & ~1);
12840 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
12841 *ret_conv = CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig_conv);
12842 return (uint64_t)ret_conv;
12845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12846 LDKUpdateFee o_conv;
12847 o_conv.inner = (void*)(o & (~1));
12848 o_conv.is_owned = (o & 1) || (o == 0);
12849 o_conv = UpdateFee_clone(&o_conv);
12850 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12851 *ret_conv = CResult_UpdateFeeDecodeErrorZ_ok(o_conv);
12852 return (uint64_t)ret_conv;
12855 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12856 LDKDecodeError e_conv;
12857 e_conv.inner = (void*)(e & (~1));
12858 e_conv.is_owned = (e & 1) || (e == 0);
12859 e_conv = DecodeError_clone(&e_conv);
12860 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12861 *ret_conv = CResult_UpdateFeeDecodeErrorZ_err(e_conv);
12862 return (uint64_t)ret_conv;
12865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12866 if ((_res & 1) != 0) return;
12867 LDKCResult_UpdateFeeDecodeErrorZ _res_conv = *(LDKCResult_UpdateFeeDecodeErrorZ*)(((uint64_t)_res) & ~1);
12869 CResult_UpdateFeeDecodeErrorZ_free(_res_conv);
12872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFeeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12873 LDKCResult_UpdateFeeDecodeErrorZ* orig_conv = (LDKCResult_UpdateFeeDecodeErrorZ*)(orig & ~1);
12874 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
12875 *ret_conv = CResult_UpdateFeeDecodeErrorZ_clone(orig_conv);
12876 return (uint64_t)ret_conv;
12879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12880 LDKUpdateFulfillHTLC o_conv;
12881 o_conv.inner = (void*)(o & (~1));
12882 o_conv.is_owned = (o & 1) || (o == 0);
12883 o_conv = UpdateFulfillHTLC_clone(&o_conv);
12884 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12885 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o_conv);
12886 return (uint64_t)ret_conv;
12889 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12890 LDKDecodeError e_conv;
12891 e_conv.inner = (void*)(e & (~1));
12892 e_conv.is_owned = (e & 1) || (e == 0);
12893 e_conv = DecodeError_clone(&e_conv);
12894 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12895 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_err(e_conv);
12896 return (uint64_t)ret_conv;
12899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12900 if ((_res & 1) != 0) return;
12901 LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12903 CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res_conv);
12906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateFulfillHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12907 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateFulfillHTLCDecodeErrorZ*)(orig & ~1);
12908 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
12909 *ret_conv = CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig_conv);
12910 return (uint64_t)ret_conv;
12913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12914 LDKUpdateAddHTLC o_conv;
12915 o_conv.inner = (void*)(o & (~1));
12916 o_conv.is_owned = (o & 1) || (o == 0);
12917 o_conv = UpdateAddHTLC_clone(&o_conv);
12918 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12919 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_ok(o_conv);
12920 return (uint64_t)ret_conv;
12923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12924 LDKDecodeError e_conv;
12925 e_conv.inner = (void*)(e & (~1));
12926 e_conv.is_owned = (e & 1) || (e == 0);
12927 e_conv = DecodeError_clone(&e_conv);
12928 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12929 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_err(e_conv);
12930 return (uint64_t)ret_conv;
12933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12934 if ((_res & 1) != 0) return;
12935 LDKCResult_UpdateAddHTLCDecodeErrorZ _res_conv = *(LDKCResult_UpdateAddHTLCDecodeErrorZ*)(((uint64_t)_res) & ~1);
12937 CResult_UpdateAddHTLCDecodeErrorZ_free(_res_conv);
12940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UpdateAddHTLCDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12941 LDKCResult_UpdateAddHTLCDecodeErrorZ* orig_conv = (LDKCResult_UpdateAddHTLCDecodeErrorZ*)(orig & ~1);
12942 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
12943 *ret_conv = CResult_UpdateAddHTLCDecodeErrorZ_clone(orig_conv);
12944 return (uint64_t)ret_conv;
12947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12949 o_conv.inner = (void*)(o & (~1));
12950 o_conv.is_owned = (o & 1) || (o == 0);
12951 o_conv = Ping_clone(&o_conv);
12952 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12953 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
12954 return (uint64_t)ret_conv;
12957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12958 LDKDecodeError e_conv;
12959 e_conv.inner = (void*)(e & (~1));
12960 e_conv.is_owned = (e & 1) || (e == 0);
12961 e_conv = DecodeError_clone(&e_conv);
12962 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12963 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
12964 return (uint64_t)ret_conv;
12967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
12968 if ((_res & 1) != 0) return;
12969 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)(((uint64_t)_res) & ~1);
12971 CResult_PingDecodeErrorZ_free(_res_conv);
12974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12975 LDKCResult_PingDecodeErrorZ* orig_conv = (LDKCResult_PingDecodeErrorZ*)(orig & ~1);
12976 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
12977 *ret_conv = CResult_PingDecodeErrorZ_clone(orig_conv);
12978 return (uint64_t)ret_conv;
12981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
12983 o_conv.inner = (void*)(o & (~1));
12984 o_conv.is_owned = (o & 1) || (o == 0);
12985 o_conv = Pong_clone(&o_conv);
12986 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12987 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
12988 return (uint64_t)ret_conv;
12991 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
12992 LDKDecodeError e_conv;
12993 e_conv.inner = (void*)(e & (~1));
12994 e_conv.is_owned = (e & 1) || (e == 0);
12995 e_conv = DecodeError_clone(&e_conv);
12996 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
12997 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
12998 return (uint64_t)ret_conv;
13001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13002 if ((_res & 1) != 0) return;
13003 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)(((uint64_t)_res) & ~1);
13005 CResult_PongDecodeErrorZ_free(_res_conv);
13008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13009 LDKCResult_PongDecodeErrorZ* orig_conv = (LDKCResult_PongDecodeErrorZ*)(orig & ~1);
13010 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13011 *ret_conv = CResult_PongDecodeErrorZ_clone(orig_conv);
13012 return (uint64_t)ret_conv;
13015 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13016 LDKUnsignedChannelAnnouncement o_conv;
13017 o_conv.inner = (void*)(o & (~1));
13018 o_conv.is_owned = (o & 1) || (o == 0);
13019 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
13020 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13021 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
13022 return (uint64_t)ret_conv;
13025 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13026 LDKDecodeError e_conv;
13027 e_conv.inner = (void*)(e & (~1));
13028 e_conv.is_owned = (e & 1) || (e == 0);
13029 e_conv = DecodeError_clone(&e_conv);
13030 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13031 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
13032 return (uint64_t)ret_conv;
13035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13036 if ((_res & 1) != 0) return;
13037 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13039 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
13042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13043 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13044 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13045 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13046 return (uint64_t)ret_conv;
13049 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13050 LDKChannelAnnouncement o_conv;
13051 o_conv.inner = (void*)(o & (~1));
13052 o_conv.is_owned = (o & 1) || (o == 0);
13053 o_conv = ChannelAnnouncement_clone(&o_conv);
13054 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13055 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_ok(o_conv);
13056 return (uint64_t)ret_conv;
13059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13060 LDKDecodeError e_conv;
13061 e_conv.inner = (void*)(e & (~1));
13062 e_conv.is_owned = (e & 1) || (e == 0);
13063 e_conv = DecodeError_clone(&e_conv);
13064 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13065 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_err(e_conv);
13066 return (uint64_t)ret_conv;
13069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13070 if ((_res & 1) != 0) return;
13071 LDKCResult_ChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_ChannelAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13073 CResult_ChannelAnnouncementDecodeErrorZ_free(_res_conv);
13076 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13077 LDKCResult_ChannelAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_ChannelAnnouncementDecodeErrorZ*)(orig & ~1);
13078 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
13079 *ret_conv = CResult_ChannelAnnouncementDecodeErrorZ_clone(orig_conv);
13080 return (uint64_t)ret_conv;
13083 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13084 LDKUnsignedChannelUpdate o_conv;
13085 o_conv.inner = (void*)(o & (~1));
13086 o_conv.is_owned = (o & 1) || (o == 0);
13087 o_conv = UnsignedChannelUpdate_clone(&o_conv);
13088 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13089 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
13090 return (uint64_t)ret_conv;
13093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13094 LDKDecodeError e_conv;
13095 e_conv.inner = (void*)(e & (~1));
13096 e_conv.is_owned = (e & 1) || (e == 0);
13097 e_conv = DecodeError_clone(&e_conv);
13098 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13099 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
13100 return (uint64_t)ret_conv;
13103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13104 if ((_res & 1) != 0) return;
13105 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13107 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
13110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13111 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)(orig & ~1);
13112 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13113 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig_conv);
13114 return (uint64_t)ret_conv;
13117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13118 LDKChannelUpdate o_conv;
13119 o_conv.inner = (void*)(o & (~1));
13120 o_conv.is_owned = (o & 1) || (o == 0);
13121 o_conv = ChannelUpdate_clone(&o_conv);
13122 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13123 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_ok(o_conv);
13124 return (uint64_t)ret_conv;
13127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13128 LDKDecodeError e_conv;
13129 e_conv.inner = (void*)(e & (~1));
13130 e_conv.is_owned = (e & 1) || (e == 0);
13131 e_conv = DecodeError_clone(&e_conv);
13132 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13133 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_err(e_conv);
13134 return (uint64_t)ret_conv;
13137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13138 if ((_res & 1) != 0) return;
13139 LDKCResult_ChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelUpdateDecodeErrorZ*)(((uint64_t)_res) & ~1);
13141 CResult_ChannelUpdateDecodeErrorZ_free(_res_conv);
13144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelUpdateDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13145 LDKCResult_ChannelUpdateDecodeErrorZ* orig_conv = (LDKCResult_ChannelUpdateDecodeErrorZ*)(orig & ~1);
13146 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
13147 *ret_conv = CResult_ChannelUpdateDecodeErrorZ_clone(orig_conv);
13148 return (uint64_t)ret_conv;
13151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13152 LDKErrorMessage o_conv;
13153 o_conv.inner = (void*)(o & (~1));
13154 o_conv.is_owned = (o & 1) || (o == 0);
13155 o_conv = ErrorMessage_clone(&o_conv);
13156 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13157 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
13158 return (uint64_t)ret_conv;
13161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13162 LDKDecodeError e_conv;
13163 e_conv.inner = (void*)(e & (~1));
13164 e_conv.is_owned = (e & 1) || (e == 0);
13165 e_conv = DecodeError_clone(&e_conv);
13166 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13167 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
13168 return (uint64_t)ret_conv;
13171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13172 if ((_res & 1) != 0) return;
13173 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)(((uint64_t)_res) & ~1);
13175 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
13178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13179 LDKCResult_ErrorMessageDecodeErrorZ* orig_conv = (LDKCResult_ErrorMessageDecodeErrorZ*)(orig & ~1);
13180 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13181 *ret_conv = CResult_ErrorMessageDecodeErrorZ_clone(orig_conv);
13182 return (uint64_t)ret_conv;
13185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13186 LDKUnsignedNodeAnnouncement o_conv;
13187 o_conv.inner = (void*)(o & (~1));
13188 o_conv.is_owned = (o & 1) || (o == 0);
13189 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
13190 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13191 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
13192 return (uint64_t)ret_conv;
13195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13196 LDKDecodeError e_conv;
13197 e_conv.inner = (void*)(e & (~1));
13198 e_conv.is_owned = (e & 1) || (e == 0);
13199 e_conv = DecodeError_clone(&e_conv);
13200 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13201 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
13202 return (uint64_t)ret_conv;
13205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13206 if ((_res & 1) != 0) return;
13207 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13209 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
13212 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13213 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)(orig & ~1);
13214 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13215 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig_conv);
13216 return (uint64_t)ret_conv;
13219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13220 LDKNodeAnnouncement o_conv;
13221 o_conv.inner = (void*)(o & (~1));
13222 o_conv.is_owned = (o & 1) || (o == 0);
13223 o_conv = NodeAnnouncement_clone(&o_conv);
13224 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13225 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_ok(o_conv);
13226 return (uint64_t)ret_conv;
13229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13230 LDKDecodeError e_conv;
13231 e_conv.inner = (void*)(e & (~1));
13232 e_conv.is_owned = (e & 1) || (e == 0);
13233 e_conv = DecodeError_clone(&e_conv);
13234 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13235 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_err(e_conv);
13236 return (uint64_t)ret_conv;
13239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13240 if ((_res & 1) != 0) return;
13241 LDKCResult_NodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementDecodeErrorZ*)(((uint64_t)_res) & ~1);
13243 CResult_NodeAnnouncementDecodeErrorZ_free(_res_conv);
13246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13247 LDKCResult_NodeAnnouncementDecodeErrorZ* orig_conv = (LDKCResult_NodeAnnouncementDecodeErrorZ*)(orig & ~1);
13248 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
13249 *ret_conv = CResult_NodeAnnouncementDecodeErrorZ_clone(orig_conv);
13250 return (uint64_t)ret_conv;
13253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13254 LDKQueryShortChannelIds o_conv;
13255 o_conv.inner = (void*)(o & (~1));
13256 o_conv.is_owned = (o & 1) || (o == 0);
13257 o_conv = QueryShortChannelIds_clone(&o_conv);
13258 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13259 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
13260 return (uint64_t)ret_conv;
13263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13264 LDKDecodeError e_conv;
13265 e_conv.inner = (void*)(e & (~1));
13266 e_conv.is_owned = (e & 1) || (e == 0);
13267 e_conv = DecodeError_clone(&e_conv);
13268 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13269 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
13270 return (uint64_t)ret_conv;
13273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13274 if ((_res & 1) != 0) return;
13275 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(((uint64_t)_res) & ~1);
13277 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
13280 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13281 LDKCResult_QueryShortChannelIdsDecodeErrorZ* orig_conv = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)(orig & ~1);
13282 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13283 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig_conv);
13284 return (uint64_t)ret_conv;
13287 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13288 LDKReplyShortChannelIdsEnd o_conv;
13289 o_conv.inner = (void*)(o & (~1));
13290 o_conv.is_owned = (o & 1) || (o == 0);
13291 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
13292 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13293 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
13294 return (uint64_t)ret_conv;
13297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13298 LDKDecodeError e_conv;
13299 e_conv.inner = (void*)(e & (~1));
13300 e_conv.is_owned = (e & 1) || (e == 0);
13301 e_conv = DecodeError_clone(&e_conv);
13302 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13303 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
13304 return (uint64_t)ret_conv;
13307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13308 if ((_res & 1) != 0) return;
13309 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(((uint64_t)_res) & ~1);
13311 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
13314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13315 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* orig_conv = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)(orig & ~1);
13316 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13317 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig_conv);
13318 return (uint64_t)ret_conv;
13321 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13322 LDKQueryChannelRange o_conv;
13323 o_conv.inner = (void*)(o & (~1));
13324 o_conv.is_owned = (o & 1) || (o == 0);
13325 o_conv = QueryChannelRange_clone(&o_conv);
13326 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13327 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
13328 return (uint64_t)ret_conv;
13331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13332 LDKDecodeError e_conv;
13333 e_conv.inner = (void*)(e & (~1));
13334 e_conv.is_owned = (e & 1) || (e == 0);
13335 e_conv = DecodeError_clone(&e_conv);
13336 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13337 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
13338 return (uint64_t)ret_conv;
13341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13342 if ((_res & 1) != 0) return;
13343 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13345 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
13348 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13349 LDKCResult_QueryChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_QueryChannelRangeDecodeErrorZ*)(orig & ~1);
13350 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13351 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_clone(orig_conv);
13352 return (uint64_t)ret_conv;
13355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13356 LDKReplyChannelRange o_conv;
13357 o_conv.inner = (void*)(o & (~1));
13358 o_conv.is_owned = (o & 1) || (o == 0);
13359 o_conv = ReplyChannelRange_clone(&o_conv);
13360 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13361 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
13362 return (uint64_t)ret_conv;
13365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13366 LDKDecodeError e_conv;
13367 e_conv.inner = (void*)(e & (~1));
13368 e_conv.is_owned = (e & 1) || (e == 0);
13369 e_conv = DecodeError_clone(&e_conv);
13370 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13371 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
13372 return (uint64_t)ret_conv;
13375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13376 if ((_res & 1) != 0) return;
13377 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)(((uint64_t)_res) & ~1);
13379 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
13382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13383 LDKCResult_ReplyChannelRangeDecodeErrorZ* orig_conv = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)(orig & ~1);
13384 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13385 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_clone(orig_conv);
13386 return (uint64_t)ret_conv;
13389 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13390 LDKGossipTimestampFilter o_conv;
13391 o_conv.inner = (void*)(o & (~1));
13392 o_conv.is_owned = (o & 1) || (o == 0);
13393 o_conv = GossipTimestampFilter_clone(&o_conv);
13394 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13395 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
13396 return (uint64_t)ret_conv;
13399 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13400 LDKDecodeError e_conv;
13401 e_conv.inner = (void*)(e & (~1));
13402 e_conv.is_owned = (e & 1) || (e == 0);
13403 e_conv = DecodeError_clone(&e_conv);
13404 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13405 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
13406 return (uint64_t)ret_conv;
13409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13410 if ((_res & 1) != 0) return;
13411 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)(((uint64_t)_res) & ~1);
13413 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
13416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13417 LDKCResult_GossipTimestampFilterDecodeErrorZ* orig_conv = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)(orig & ~1);
13418 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13419 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_clone(orig_conv);
13420 return (uint64_t)ret_conv;
13423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
13425 o_conv.inner = (void*)(o & (~1));
13426 o_conv.is_owned = (o & 1) || (o == 0);
13427 o_conv = Invoice_clone(&o_conv);
13428 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13429 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_ok(o_conv);
13430 return (uint64_t)ret_conv;
13433 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
13434 LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
13435 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13436 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
13437 return (uint64_t)ret_conv;
13440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
13441 if ((_res & 1) != 0) return;
13442 LDKCResult_InvoiceSignOrCreationErrorZ _res_conv = *(LDKCResult_InvoiceSignOrCreationErrorZ*)(((uint64_t)_res) & ~1);
13444 CResult_InvoiceSignOrCreationErrorZ_free(_res_conv);
13447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13448 LDKCResult_InvoiceSignOrCreationErrorZ* orig_conv = (LDKCResult_InvoiceSignOrCreationErrorZ*)(orig & ~1);
13449 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
13450 *ret_conv = CResult_InvoiceSignOrCreationErrorZ_clone(orig_conv);
13451 return (uint64_t)ret_conv;
13454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13455 if ((this_ptr & 1) != 0) return;
13456 LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
13457 FREE((void*)this_ptr);
13458 PaymentPurpose_free(this_ptr_conv);
13461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13462 LDKPaymentPurpose* orig_conv = (LDKPaymentPurpose*)orig;
13463 LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose");
13464 *ret_copy = PaymentPurpose_clone(orig_conv);
13465 uint64_t ret_ref = (uint64_t)ret_copy;
13469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13470 if ((this_ptr & 1) != 0) return;
13471 LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
13472 FREE((void*)this_ptr);
13473 Event_free(this_ptr_conv);
13476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13477 LDKEvent* orig_conv = (LDKEvent*)orig;
13478 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
13479 *ret_copy = Event_clone(orig_conv);
13480 uint64_t ret_ref = (uint64_t)ret_copy;
13484 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
13485 LDKEvent* obj_conv = (LDKEvent*)obj;
13486 LDKCVec_u8Z ret_var = Event_write(obj_conv);
13487 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13488 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13489 CVec_u8Z_free(ret_var);
13493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13494 if ((this_ptr & 1) != 0) return;
13495 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)(((uint64_t)this_ptr) & ~1);
13496 FREE((void*)this_ptr);
13497 MessageSendEvent_free(this_ptr_conv);
13500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13501 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
13502 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
13503 *ret_copy = MessageSendEvent_clone(orig_conv);
13504 uint64_t ret_ref = (uint64_t)ret_copy;
13508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13509 if ((this_ptr & 1) != 0) return;
13510 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)(((uint64_t)this_ptr) & ~1);
13511 FREE((void*)this_ptr);
13512 MessageSendEventsProvider_free(this_ptr_conv);
13515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13516 if ((this_ptr & 1) != 0) return;
13517 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)(((uint64_t)this_ptr) & ~1);
13518 FREE((void*)this_ptr);
13519 EventsProvider_free(this_ptr_conv);
13522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13523 if ((this_ptr & 1) != 0) return;
13524 LDKEventHandler this_ptr_conv = *(LDKEventHandler*)(((uint64_t)this_ptr) & ~1);
13525 FREE((void*)this_ptr);
13526 EventHandler_free(this_ptr_conv);
13529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13530 if ((this_ptr & 1) != 0) return;
13531 LDKAPIError this_ptr_conv = *(LDKAPIError*)(((uint64_t)this_ptr) & ~1);
13532 FREE((void*)this_ptr);
13533 APIError_free(this_ptr_conv);
13536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13537 LDKAPIError* orig_conv = (LDKAPIError*)orig;
13538 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
13539 *ret_copy = APIError_clone(orig_conv);
13540 uint64_t ret_ref = (uint64_t)ret_copy;
13544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_sign(JNIEnv *env, jclass clz, int8_tArray msg, int8_tArray sk) {
13545 LDKu8slice msg_ref;
13546 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13547 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13548 unsigned char sk_arr[32];
13549 CHECK((*env)->GetArrayLength(env, sk) == 32);
13550 (*env)->GetByteArrayRegion(env, sk, 0, 32, sk_arr);
13551 unsigned char (*sk_ref)[32] = &sk_arr;
13552 LDKCResult_StringErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StringErrorZ), "LDKCResult_StringErrorZ");
13553 *ret_conv = sign(msg_ref, sk_ref);
13554 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13555 return (uint64_t)ret_conv;
13558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_recover_1pk(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig) {
13559 LDKu8slice msg_ref;
13560 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13561 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13562 LDKStr sig_conv = java_to_owned_str(env, sig);
13563 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
13564 *ret_conv = recover_pk(msg_ref, sig_conv);
13565 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13566 return (uint64_t)ret_conv;
13569 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify(JNIEnv *env, jclass clz, int8_tArray msg, jstring sig, int8_tArray pk) {
13570 LDKu8slice msg_ref;
13571 msg_ref.datalen = (*env)->GetArrayLength(env, msg);
13572 msg_ref.data = (*env)->GetByteArrayElements (env, msg, NULL);
13573 LDKStr sig_conv = java_to_owned_str(env, sig);
13574 LDKPublicKey pk_ref;
13575 CHECK((*env)->GetArrayLength(env, pk) == 33);
13576 (*env)->GetByteArrayRegion(env, pk, 0, 33, pk_ref.compressed_form);
13577 jboolean ret_val = verify(msg_ref, sig_conv, pk_ref);
13578 (*env)->ReleaseByteArrayElements(env, msg, (int8_t*)msg_ref.data, 0);
13582 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13583 LDKLevel* orig_conv = (LDKLevel*)(orig & ~1);
13584 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
13588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Level_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
13589 LDKLevel* a_conv = (LDKLevel*)(a & ~1);
13590 LDKLevel* b_conv = (LDKLevel*)(b & ~1);
13591 jboolean ret_val = Level_eq(a_conv, b_conv);
13595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Level_1hash(JNIEnv *env, jclass clz, int64_t o) {
13596 LDKLevel* o_conv = (LDKLevel*)(o & ~1);
13597 int64_t ret_val = Level_hash(o_conv);
13601 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
13602 jclass ret_conv = LDKLevel_to_java(env, Level_max());
13606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13607 if ((this_ptr & 1) != 0) return;
13608 LDKLogger this_ptr_conv = *(LDKLogger*)(((uint64_t)this_ptr) & ~1);
13609 FREE((void*)this_ptr);
13610 Logger_free(this_ptr_conv);
13613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13614 LDKChannelHandshakeConfig this_obj_conv;
13615 this_obj_conv.inner = (void*)(this_obj & (~1));
13616 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13617 ChannelHandshakeConfig_free(this_obj_conv);
13620 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13621 LDKChannelHandshakeConfig this_ptr_conv;
13622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13623 this_ptr_conv.is_owned = false;
13624 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
13628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13629 LDKChannelHandshakeConfig this_ptr_conv;
13630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13631 this_ptr_conv.is_owned = false;
13632 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
13635 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13636 LDKChannelHandshakeConfig this_ptr_conv;
13637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13638 this_ptr_conv.is_owned = false;
13639 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
13643 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) {
13644 LDKChannelHandshakeConfig this_ptr_conv;
13645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13646 this_ptr_conv.is_owned = false;
13647 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
13650 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13651 LDKChannelHandshakeConfig this_ptr_conv;
13652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13653 this_ptr_conv.is_owned = false;
13654 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
13658 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) {
13659 LDKChannelHandshakeConfig this_ptr_conv;
13660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13661 this_ptr_conv.is_owned = false;
13662 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
13665 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) {
13666 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
13667 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13668 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13669 uint64_t ret_ref = (uint64_t)ret_var.inner;
13670 if (ret_var.is_owned) {
13676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13677 LDKChannelHandshakeConfig orig_conv;
13678 orig_conv.inner = (void*)(orig & (~1));
13679 orig_conv.is_owned = false;
13680 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
13681 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13682 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13683 uint64_t ret_ref = (uint64_t)ret_var.inner;
13684 if (ret_var.is_owned) {
13690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
13691 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
13692 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13693 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13694 uint64_t ret_ref = (uint64_t)ret_var.inner;
13695 if (ret_var.is_owned) {
13701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13702 LDKChannelHandshakeLimits this_obj_conv;
13703 this_obj_conv.inner = (void*)(this_obj & (~1));
13704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13705 ChannelHandshakeLimits_free(this_obj_conv);
13708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13709 LDKChannelHandshakeLimits this_ptr_conv;
13710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13711 this_ptr_conv.is_owned = false;
13712 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
13716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13717 LDKChannelHandshakeLimits this_ptr_conv;
13718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13719 this_ptr_conv.is_owned = false;
13720 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
13723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13724 LDKChannelHandshakeLimits this_ptr_conv;
13725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13726 this_ptr_conv.is_owned = false;
13727 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
13731 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) {
13732 LDKChannelHandshakeLimits this_ptr_conv;
13733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13734 this_ptr_conv.is_owned = false;
13735 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
13738 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) {
13739 LDKChannelHandshakeLimits this_ptr_conv;
13740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13741 this_ptr_conv.is_owned = false;
13742 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
13746 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) {
13747 LDKChannelHandshakeLimits this_ptr_conv;
13748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13749 this_ptr_conv.is_owned = false;
13750 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
13753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
13754 LDKChannelHandshakeLimits this_ptr_conv;
13755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13756 this_ptr_conv.is_owned = false;
13757 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
13761 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) {
13762 LDKChannelHandshakeLimits this_ptr_conv;
13763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13764 this_ptr_conv.is_owned = false;
13765 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
13768 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
13769 LDKChannelHandshakeLimits this_ptr_conv;
13770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13771 this_ptr_conv.is_owned = false;
13772 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
13776 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) {
13777 LDKChannelHandshakeLimits this_ptr_conv;
13778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13779 this_ptr_conv.is_owned = false;
13780 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
13783 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
13784 LDKChannelHandshakeLimits this_ptr_conv;
13785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13786 this_ptr_conv.is_owned = false;
13787 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
13791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13792 LDKChannelHandshakeLimits this_ptr_conv;
13793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13794 this_ptr_conv.is_owned = false;
13795 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
13798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
13799 LDKChannelHandshakeLimits this_ptr_conv;
13800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13801 this_ptr_conv.is_owned = false;
13802 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
13806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13807 LDKChannelHandshakeLimits this_ptr_conv;
13808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13809 this_ptr_conv.is_owned = false;
13810 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
13813 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
13814 LDKChannelHandshakeLimits this_ptr_conv;
13815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13816 this_ptr_conv.is_owned = false;
13817 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
13821 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) {
13822 LDKChannelHandshakeLimits this_ptr_conv;
13823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13824 this_ptr_conv.is_owned = false;
13825 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
13828 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, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
13829 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, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
13830 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13831 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13832 uint64_t ret_ref = (uint64_t)ret_var.inner;
13833 if (ret_var.is_owned) {
13839 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13840 LDKChannelHandshakeLimits orig_conv;
13841 orig_conv.inner = (void*)(orig & (~1));
13842 orig_conv.is_owned = false;
13843 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
13844 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13845 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13846 uint64_t ret_ref = (uint64_t)ret_var.inner;
13847 if (ret_var.is_owned) {
13853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
13854 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
13855 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13856 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13857 uint64_t ret_ref = (uint64_t)ret_var.inner;
13858 if (ret_var.is_owned) {
13864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
13865 LDKChannelConfig this_obj_conv;
13866 this_obj_conv.inner = (void*)(this_obj & (~1));
13867 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
13868 ChannelConfig_free(this_obj_conv);
13871 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
13872 LDKChannelConfig this_ptr_conv;
13873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13874 this_ptr_conv.is_owned = false;
13875 int32_t ret_val = ChannelConfig_get_forwarding_fee_proportional_millionths(&this_ptr_conv);
13879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13880 LDKChannelConfig this_ptr_conv;
13881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13882 this_ptr_conv.is_owned = false;
13883 ChannelConfig_set_forwarding_fee_proportional_millionths(&this_ptr_conv, val);
13886 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
13887 LDKChannelConfig this_ptr_conv;
13888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13889 this_ptr_conv.is_owned = false;
13890 int32_t ret_val = ChannelConfig_get_forwarding_fee_base_msat(&this_ptr_conv);
13894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1forwarding_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
13895 LDKChannelConfig this_ptr_conv;
13896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13897 this_ptr_conv.is_owned = false;
13898 ChannelConfig_set_forwarding_fee_base_msat(&this_ptr_conv, val);
13901 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
13902 LDKChannelConfig this_ptr_conv;
13903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13904 this_ptr_conv.is_owned = false;
13905 int16_t ret_val = ChannelConfig_get_cltv_expiry_delta(&this_ptr_conv);
13909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
13910 LDKChannelConfig this_ptr_conv;
13911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13912 this_ptr_conv.is_owned = false;
13913 ChannelConfig_set_cltv_expiry_delta(&this_ptr_conv, val);
13916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
13917 LDKChannelConfig this_ptr_conv;
13918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13919 this_ptr_conv.is_owned = false;
13920 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
13924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13925 LDKChannelConfig this_ptr_conv;
13926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13927 this_ptr_conv.is_owned = false;
13928 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
13931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
13932 LDKChannelConfig this_ptr_conv;
13933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13934 this_ptr_conv.is_owned = false;
13935 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
13939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
13940 LDKChannelConfig this_ptr_conv;
13941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13942 this_ptr_conv.is_owned = false;
13943 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
13946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t forwarding_fee_proportional_millionths_arg, int32_t forwarding_fee_base_msat_arg, int16_t cltv_expiry_delta_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
13947 LDKChannelConfig ret_var = ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
13948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13950 uint64_t ret_ref = (uint64_t)ret_var.inner;
13951 if (ret_var.is_owned) {
13957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13958 LDKChannelConfig orig_conv;
13959 orig_conv.inner = (void*)(orig & (~1));
13960 orig_conv.is_owned = false;
13961 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
13962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13964 uint64_t ret_ref = (uint64_t)ret_var.inner;
13965 if (ret_var.is_owned) {
13971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
13972 LDKChannelConfig ret_var = ChannelConfig_default();
13973 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13974 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13975 uint64_t ret_ref = (uint64_t)ret_var.inner;
13976 if (ret_var.is_owned) {
13982 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
13983 LDKChannelConfig obj_conv;
13984 obj_conv.inner = (void*)(obj & (~1));
13985 obj_conv.is_owned = false;
13986 LDKCVec_u8Z ret_var = ChannelConfig_write(&obj_conv);
13987 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
13988 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
13989 CVec_u8Z_free(ret_var);
13993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13994 LDKu8slice ser_ref;
13995 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13996 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13997 LDKCResult_ChannelConfigDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelConfigDecodeErrorZ), "LDKCResult_ChannelConfigDecodeErrorZ");
13998 *ret_conv = ChannelConfig_read(ser_ref);
13999 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14000 return (uint64_t)ret_conv;
14003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14004 LDKUserConfig this_obj_conv;
14005 this_obj_conv.inner = (void*)(this_obj & (~1));
14006 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14007 UserConfig_free(this_obj_conv);
14010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
14011 LDKUserConfig this_ptr_conv;
14012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14013 this_ptr_conv.is_owned = false;
14014 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
14015 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14016 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14017 uint64_t ret_ref = (uint64_t)ret_var.inner;
14018 if (ret_var.is_owned) {
14024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14025 LDKUserConfig this_ptr_conv;
14026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14027 this_ptr_conv.is_owned = false;
14028 LDKChannelHandshakeConfig val_conv;
14029 val_conv.inner = (void*)(val & (~1));
14030 val_conv.is_owned = (val & 1) || (val == 0);
14031 val_conv = ChannelHandshakeConfig_clone(&val_conv);
14032 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
14035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
14036 LDKUserConfig this_ptr_conv;
14037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14038 this_ptr_conv.is_owned = false;
14039 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
14040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14042 uint64_t ret_ref = (uint64_t)ret_var.inner;
14043 if (ret_var.is_owned) {
14049 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) {
14050 LDKUserConfig this_ptr_conv;
14051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14052 this_ptr_conv.is_owned = false;
14053 LDKChannelHandshakeLimits val_conv;
14054 val_conv.inner = (void*)(val & (~1));
14055 val_conv.is_owned = (val & 1) || (val == 0);
14056 val_conv = ChannelHandshakeLimits_clone(&val_conv);
14057 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
14060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
14061 LDKUserConfig this_ptr_conv;
14062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14063 this_ptr_conv.is_owned = false;
14064 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
14065 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14066 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14067 uint64_t ret_ref = (uint64_t)ret_var.inner;
14068 if (ret_var.is_owned) {
14074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14075 LDKUserConfig this_ptr_conv;
14076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14077 this_ptr_conv.is_owned = false;
14078 LDKChannelConfig val_conv;
14079 val_conv.inner = (void*)(val & (~1));
14080 val_conv.is_owned = (val & 1) || (val == 0);
14081 val_conv = ChannelConfig_clone(&val_conv);
14082 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
14085 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) {
14086 LDKUserConfig this_ptr_conv;
14087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14088 this_ptr_conv.is_owned = false;
14089 jboolean ret_val = UserConfig_get_accept_forwards_to_priv_channels(&this_ptr_conv);
14093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14094 LDKUserConfig this_ptr_conv;
14095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14096 this_ptr_conv.is_owned = false;
14097 UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val);
14100 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, jboolean accept_forwards_to_priv_channels_arg) {
14101 LDKChannelHandshakeConfig own_channel_config_arg_conv;
14102 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
14103 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
14104 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
14105 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
14106 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
14107 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
14108 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
14109 LDKChannelConfig channel_options_arg_conv;
14110 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
14111 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
14112 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
14113 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg);
14114 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14115 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14116 uint64_t ret_ref = (uint64_t)ret_var.inner;
14117 if (ret_var.is_owned) {
14123 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14124 LDKUserConfig orig_conv;
14125 orig_conv.inner = (void*)(orig & (~1));
14126 orig_conv.is_owned = false;
14127 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
14128 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14129 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14130 uint64_t ret_ref = (uint64_t)ret_var.inner;
14131 if (ret_var.is_owned) {
14137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
14138 LDKUserConfig ret_var = UserConfig_default();
14139 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14140 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14141 uint64_t ret_ref = (uint64_t)ret_var.inner;
14142 if (ret_var.is_owned) {
14148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BestBlock_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14149 LDKBestBlock this_obj_conv;
14150 this_obj_conv.inner = (void*)(this_obj & (~1));
14151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14152 BestBlock_free(this_obj_conv);
14155 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14156 LDKBestBlock orig_conv;
14157 orig_conv.inner = (void*)(orig & (~1));
14158 orig_conv.is_owned = false;
14159 LDKBestBlock ret_var = BestBlock_clone(&orig_conv);
14160 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14161 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14162 uint64_t ret_ref = (uint64_t)ret_var.inner;
14163 if (ret_var.is_owned) {
14169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1from_1genesis(JNIEnv *env, jclass clz, jclass network) {
14170 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
14171 LDKBestBlock ret_var = BestBlock_from_genesis(network_conv);
14172 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14173 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14174 uint64_t ret_ref = (uint64_t)ret_var.inner;
14175 if (ret_var.is_owned) {
14181 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1new(JNIEnv *env, jclass clz, int8_tArray block_hash, int32_t height) {
14182 LDKThirtyTwoBytes block_hash_ref;
14183 CHECK((*env)->GetArrayLength(env, block_hash) == 32);
14184 (*env)->GetByteArrayRegion(env, block_hash, 0, 32, block_hash_ref.data);
14185 LDKBestBlock ret_var = BestBlock_new(block_hash_ref, height);
14186 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14187 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14188 uint64_t ret_ref = (uint64_t)ret_var.inner;
14189 if (ret_var.is_owned) {
14195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BestBlock_1block_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
14196 LDKBestBlock this_arg_conv;
14197 this_arg_conv.inner = (void*)(this_arg & (~1));
14198 this_arg_conv.is_owned = false;
14199 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14200 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BestBlock_block_hash(&this_arg_conv).data);
14204 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_BestBlock_1height(JNIEnv *env, jclass clz, int64_t this_arg) {
14205 LDKBestBlock this_arg_conv;
14206 this_arg_conv.inner = (void*)(this_arg & (~1));
14207 this_arg_conv.is_owned = false;
14208 int32_t ret_val = BestBlock_height(&this_arg_conv);
14212 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14213 LDKAccessError* orig_conv = (LDKAccessError*)(orig & ~1);
14214 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
14218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14219 if ((this_ptr & 1) != 0) return;
14220 LDKAccess this_ptr_conv = *(LDKAccess*)(((uint64_t)this_ptr) & ~1);
14221 FREE((void*)this_ptr);
14222 Access_free(this_ptr_conv);
14225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Listen_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14226 if ((this_ptr & 1) != 0) return;
14227 LDKListen this_ptr_conv = *(LDKListen*)(((uint64_t)this_ptr) & ~1);
14228 FREE((void*)this_ptr);
14229 Listen_free(this_ptr_conv);
14232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Confirm_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14233 if ((this_ptr & 1) != 0) return;
14234 LDKConfirm this_ptr_conv = *(LDKConfirm*)(((uint64_t)this_ptr) & ~1);
14235 FREE((void*)this_ptr);
14236 Confirm_free(this_ptr_conv);
14239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14240 if ((this_ptr & 1) != 0) return;
14241 LDKWatch this_ptr_conv = *(LDKWatch*)(((uint64_t)this_ptr) & ~1);
14242 FREE((void*)this_ptr);
14243 Watch_free(this_ptr_conv);
14246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14247 if ((this_ptr & 1) != 0) return;
14248 LDKFilter this_ptr_conv = *(LDKFilter*)(((uint64_t)this_ptr) & ~1);
14249 FREE((void*)this_ptr);
14250 Filter_free(this_ptr_conv);
14253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14254 LDKWatchedOutput this_obj_conv;
14255 this_obj_conv.inner = (void*)(this_obj & (~1));
14256 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14257 WatchedOutput_free(this_obj_conv);
14260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14261 LDKWatchedOutput this_ptr_conv;
14262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14263 this_ptr_conv.is_owned = false;
14264 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14265 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, WatchedOutput_get_block_hash(&this_ptr_conv).data);
14269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1block_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14270 LDKWatchedOutput this_ptr_conv;
14271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14272 this_ptr_conv.is_owned = false;
14273 LDKThirtyTwoBytes val_ref;
14274 CHECK((*env)->GetArrayLength(env, val) == 32);
14275 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14276 WatchedOutput_set_block_hash(&this_ptr_conv, val_ref);
14279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14280 LDKWatchedOutput this_ptr_conv;
14281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14282 this_ptr_conv.is_owned = false;
14283 LDKOutPoint ret_var = WatchedOutput_get_outpoint(&this_ptr_conv);
14284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14286 uint64_t ret_ref = (uint64_t)ret_var.inner;
14287 if (ret_var.is_owned) {
14293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14294 LDKWatchedOutput this_ptr_conv;
14295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14296 this_ptr_conv.is_owned = false;
14297 LDKOutPoint val_conv;
14298 val_conv.inner = (void*)(val & (~1));
14299 val_conv.is_owned = (val & 1) || (val == 0);
14300 val_conv = OutPoint_clone(&val_conv);
14301 WatchedOutput_set_outpoint(&this_ptr_conv, val_conv);
14304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1get_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14305 LDKWatchedOutput this_ptr_conv;
14306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14307 this_ptr_conv.is_owned = false;
14308 LDKu8slice ret_var = WatchedOutput_get_script_pubkey(&this_ptr_conv);
14309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1set_1script_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14315 LDKWatchedOutput this_ptr_conv;
14316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14317 this_ptr_conv.is_owned = false;
14318 LDKCVec_u8Z val_ref;
14319 val_ref.datalen = (*env)->GetArrayLength(env, val);
14320 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
14321 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
14322 WatchedOutput_set_script_pubkey(&this_ptr_conv, val_ref);
14325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1new(JNIEnv *env, jclass clz, int8_tArray block_hash_arg, int64_t outpoint_arg, int8_tArray script_pubkey_arg) {
14326 LDKThirtyTwoBytes block_hash_arg_ref;
14327 CHECK((*env)->GetArrayLength(env, block_hash_arg) == 32);
14328 (*env)->GetByteArrayRegion(env, block_hash_arg, 0, 32, block_hash_arg_ref.data);
14329 LDKOutPoint outpoint_arg_conv;
14330 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
14331 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
14332 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
14333 LDKCVec_u8Z script_pubkey_arg_ref;
14334 script_pubkey_arg_ref.datalen = (*env)->GetArrayLength(env, script_pubkey_arg);
14335 script_pubkey_arg_ref.data = MALLOC(script_pubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
14336 (*env)->GetByteArrayRegion(env, script_pubkey_arg, 0, script_pubkey_arg_ref.datalen, script_pubkey_arg_ref.data);
14337 LDKWatchedOutput ret_var = WatchedOutput_new(block_hash_arg_ref, outpoint_arg_conv, script_pubkey_arg_ref);
14338 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14339 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14340 uint64_t ret_ref = (uint64_t)ret_var.inner;
14341 if (ret_var.is_owned) {
14347 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14348 LDKWatchedOutput orig_conv;
14349 orig_conv.inner = (void*)(orig & (~1));
14350 orig_conv.is_owned = false;
14351 LDKWatchedOutput ret_var = WatchedOutput_clone(&orig_conv);
14352 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14353 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14354 uint64_t ret_ref = (uint64_t)ret_var.inner;
14355 if (ret_var.is_owned) {
14361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_WatchedOutput_1hash(JNIEnv *env, jclass clz, int64_t o) {
14362 LDKWatchedOutput o_conv;
14363 o_conv.inner = (void*)(o & (~1));
14364 o_conv.is_owned = false;
14365 int64_t ret_val = WatchedOutput_hash(&o_conv);
14369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14370 if ((this_ptr & 1) != 0) return;
14371 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)(((uint64_t)this_ptr) & ~1);
14372 FREE((void*)this_ptr);
14373 BroadcasterInterface_free(this_ptr_conv);
14376 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14377 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)(orig & ~1);
14378 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
14382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14383 if ((this_ptr & 1) != 0) return;
14384 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)(((uint64_t)this_ptr) & ~1);
14385 FREE((void*)this_ptr);
14386 FeeEstimator_free(this_ptr_conv);
14389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14390 LDKChainMonitor this_obj_conv;
14391 this_obj_conv.inner = (void*)(this_obj & (~1));
14392 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14393 ChainMonitor_free(this_obj_conv);
14396 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) {
14397 LDKFilter *chain_source_conv_ptr = NULL;
14398 if (chain_source != 0) {
14399 LDKFilter chain_source_conv;
14400 chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
14401 if (chain_source_conv.free == LDKFilter_JCalls_free) {
14402 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14403 LDKFilter_JCalls_cloned(&chain_source_conv);
14405 chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
14406 *chain_source_conv_ptr = chain_source_conv;
14408 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14409 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14410 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14411 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
14413 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14414 if (logger_conv.free == LDKLogger_JCalls_free) {
14415 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14416 LDKLogger_JCalls_cloned(&logger_conv);
14418 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
14419 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
14420 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14421 LDKFeeEstimator_JCalls_cloned(&feeest_conv);
14423 LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
14424 if (persister_conv.free == LDKPersist_JCalls_free) {
14425 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14426 LDKPersist_JCalls_cloned(&persister_conv);
14428 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
14429 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14430 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14431 uint64_t ret_ref = (uint64_t)ret_var.inner;
14432 if (ret_var.is_owned) {
14438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
14439 LDKChainMonitor this_arg_conv;
14440 this_arg_conv.inner = (void*)(this_arg & (~1));
14441 this_arg_conv.is_owned = false;
14442 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
14443 *ret = ChainMonitor_as_Listen(&this_arg_conv);
14444 return (uint64_t)ret;
14447 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
14448 LDKChainMonitor this_arg_conv;
14449 this_arg_conv.inner = (void*)(this_arg & (~1));
14450 this_arg_conv.is_owned = false;
14451 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
14452 *ret = ChainMonitor_as_Confirm(&this_arg_conv);
14453 return (uint64_t)ret;
14456 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
14457 LDKChainMonitor this_arg_conv;
14458 this_arg_conv.inner = (void*)(this_arg & (~1));
14459 this_arg_conv.is_owned = false;
14460 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
14461 *ret = ChainMonitor_as_Watch(&this_arg_conv);
14462 return (uint64_t)ret;
14465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
14466 LDKChainMonitor this_arg_conv;
14467 this_arg_conv.inner = (void*)(this_arg & (~1));
14468 this_arg_conv.is_owned = false;
14469 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
14470 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
14471 return (uint64_t)ret;
14474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14475 LDKChannelMonitorUpdate this_obj_conv;
14476 this_obj_conv.inner = (void*)(this_obj & (~1));
14477 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14478 ChannelMonitorUpdate_free(this_obj_conv);
14481 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
14482 LDKChannelMonitorUpdate this_ptr_conv;
14483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14484 this_ptr_conv.is_owned = false;
14485 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
14489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14490 LDKChannelMonitorUpdate this_ptr_conv;
14491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14492 this_ptr_conv.is_owned = false;
14493 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
14496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14497 LDKChannelMonitorUpdate orig_conv;
14498 orig_conv.inner = (void*)(orig & (~1));
14499 orig_conv.is_owned = false;
14500 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
14501 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14502 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14503 uint64_t ret_ref = (uint64_t)ret_var.inner;
14504 if (ret_var.is_owned) {
14510 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
14511 LDKChannelMonitorUpdate obj_conv;
14512 obj_conv.inner = (void*)(obj & (~1));
14513 obj_conv.is_owned = false;
14514 LDKCVec_u8Z ret_var = ChannelMonitorUpdate_write(&obj_conv);
14515 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14516 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14517 CVec_u8Z_free(ret_var);
14521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14522 LDKu8slice ser_ref;
14523 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14524 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14525 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
14526 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
14527 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14528 return (uint64_t)ret_conv;
14531 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14532 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)(orig & ~1);
14533 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
14537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14538 LDKMonitorUpdateError this_obj_conv;
14539 this_obj_conv.inner = (void*)(this_obj & (~1));
14540 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14541 MonitorUpdateError_free(this_obj_conv);
14544 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14545 LDKMonitorUpdateError orig_conv;
14546 orig_conv.inner = (void*)(orig & (~1));
14547 orig_conv.is_owned = false;
14548 LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv);
14549 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14550 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14551 uint64_t ret_ref = (uint64_t)ret_var.inner;
14552 if (ret_var.is_owned) {
14558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14559 if ((this_ptr & 1) != 0) return;
14560 LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)(((uint64_t)this_ptr) & ~1);
14561 FREE((void*)this_ptr);
14562 MonitorEvent_free(this_ptr_conv);
14565 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14566 LDKMonitorEvent* orig_conv = (LDKMonitorEvent*)orig;
14567 LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14568 *ret_copy = MonitorEvent_clone(orig_conv);
14569 uint64_t ret_ref = (uint64_t)ret_copy;
14573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14574 LDKHTLCUpdate this_obj_conv;
14575 this_obj_conv.inner = (void*)(this_obj & (~1));
14576 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14577 HTLCUpdate_free(this_obj_conv);
14580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14581 LDKHTLCUpdate orig_conv;
14582 orig_conv.inner = (void*)(orig & (~1));
14583 orig_conv.is_owned = false;
14584 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
14585 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14586 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14587 uint64_t ret_ref = (uint64_t)ret_var.inner;
14588 if (ret_var.is_owned) {
14594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
14595 LDKHTLCUpdate obj_conv;
14596 obj_conv.inner = (void*)(obj & (~1));
14597 obj_conv.is_owned = false;
14598 LDKCVec_u8Z ret_var = HTLCUpdate_write(&obj_conv);
14599 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14600 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14601 CVec_u8Z_free(ret_var);
14605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14606 LDKu8slice ser_ref;
14607 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14608 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14609 LDKCResult_HTLCUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCUpdateDecodeErrorZ), "LDKCResult_HTLCUpdateDecodeErrorZ");
14610 *ret_conv = HTLCUpdate_read(ser_ref);
14611 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14612 return (uint64_t)ret_conv;
14615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14616 LDKChannelMonitor this_obj_conv;
14617 this_obj_conv.inner = (void*)(this_obj & (~1));
14618 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14619 ChannelMonitor_free(this_obj_conv);
14622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14623 LDKChannelMonitor orig_conv;
14624 orig_conv.inner = (void*)(orig & (~1));
14625 orig_conv.is_owned = false;
14626 LDKChannelMonitor ret_var = ChannelMonitor_clone(&orig_conv);
14627 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14628 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14629 uint64_t ret_ref = (uint64_t)ret_var.inner;
14630 if (ret_var.is_owned) {
14636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
14637 LDKChannelMonitor obj_conv;
14638 obj_conv.inner = (void*)(obj & (~1));
14639 obj_conv.is_owned = false;
14640 LDKCVec_u8Z ret_var = ChannelMonitor_write(&obj_conv);
14641 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
14642 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
14643 CVec_u8Z_free(ret_var);
14647 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) {
14648 LDKChannelMonitor this_arg_conv;
14649 this_arg_conv.inner = (void*)(this_arg & (~1));
14650 this_arg_conv.is_owned = false;
14651 LDKChannelMonitorUpdate updates_conv;
14652 updates_conv.inner = (void*)(updates & (~1));
14653 updates_conv.is_owned = false;
14654 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14655 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14656 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14657 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
14658 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
14659 return (uint64_t)ret_conv;
14662 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
14663 LDKChannelMonitor this_arg_conv;
14664 this_arg_conv.inner = (void*)(this_arg & (~1));
14665 this_arg_conv.is_owned = false;
14666 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
14670 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
14671 LDKChannelMonitor this_arg_conv;
14672 this_arg_conv.inner = (void*)(this_arg & (~1));
14673 this_arg_conv.is_owned = false;
14674 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
14675 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
14676 return (uint64_t)ret_ref;
14679 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg) {
14680 LDKChannelMonitor this_arg_conv;
14681 this_arg_conv.inner = (void*)(this_arg & (~1));
14682 this_arg_conv.is_owned = false;
14683 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ret_var = ChannelMonitor_get_outputs_to_watch(&this_arg_conv);
14684 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14685 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14686 for (size_t v = 0; v < ret_var.datalen; v++) {
14687 LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* ret_conv_47_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ");
14688 *ret_conv_47_ref = ret_var.data[v];
14689 ret_arr_ptr[v] = (uint64_t)ret_conv_47_ref;
14691 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14692 FREE(ret_var.data);
14696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1load_1outputs_1to_1watch(JNIEnv *env, jclass clz, int64_t this_arg, int64_t filter) {
14697 LDKChannelMonitor this_arg_conv;
14698 this_arg_conv.inner = (void*)(this_arg & (~1));
14699 this_arg_conv.is_owned = false;
14700 LDKFilter* filter_conv = (LDKFilter*)(((uint64_t)filter) & ~1);
14701 ChannelMonitor_load_outputs_to_watch(&this_arg_conv, filter_conv);
14704 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14705 LDKChannelMonitor this_arg_conv;
14706 this_arg_conv.inner = (void*)(this_arg & (~1));
14707 this_arg_conv.is_owned = false;
14708 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
14709 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14710 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14711 for (size_t o = 0; o < ret_var.datalen; o++) {
14712 LDKMonitorEvent *ret_conv_14_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
14713 *ret_conv_14_copy = MonitorEvent_clone(&ret_var.data[o]);
14714 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_copy;
14715 ret_arr_ptr[o] = ret_conv_14_ref;
14717 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14718 FREE(ret_var.data);
14722 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14723 LDKChannelMonitor this_arg_conv;
14724 this_arg_conv.inner = (void*)(this_arg & (~1));
14725 this_arg_conv.is_owned = false;
14726 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
14727 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14728 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14729 for (size_t h = 0; h < ret_var.datalen; h++) {
14730 LDKEvent *ret_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
14731 *ret_conv_7_copy = Event_clone(&ret_var.data[h]);
14732 uint64_t ret_conv_7_ref = (uint64_t)ret_conv_7_copy;
14733 ret_arr_ptr[h] = ret_conv_7_ref;
14735 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14736 FREE(ret_var.data);
14740 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) {
14741 LDKChannelMonitor this_arg_conv;
14742 this_arg_conv.inner = (void*)(this_arg & (~1));
14743 this_arg_conv.is_owned = false;
14744 LDKLogger* logger_conv = (LDKLogger*)(((uint64_t)logger) & ~1);
14745 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
14746 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14748 for (size_t i = 0; i < ret_var.datalen; i++) {
14749 LDKTransaction ret_conv_8_var = ret_var.data[i];
14750 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, ret_conv_8_var.datalen);
14751 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, ret_conv_8_var.datalen, ret_conv_8_var.data);
14752 Transaction_free(ret_conv_8_var);
14753 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14755 FREE(ret_var.data);
14759 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) {
14760 LDKChannelMonitor this_arg_conv;
14761 this_arg_conv.inner = (void*)(this_arg & (~1));
14762 this_arg_conv.is_owned = false;
14763 unsigned char header_arr[80];
14764 CHECK((*env)->GetArrayLength(env, header) == 80);
14765 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14766 unsigned char (*header_ref)[80] = &header_arr;
14767 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14768 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14769 if (txdata_constr.datalen > 0)
14770 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14772 txdata_constr.data = NULL;
14773 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14774 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14775 int64_t txdata_conv_24 = txdata_vals[y];
14776 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14777 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14778 txdata_constr.data[y] = txdata_conv_24_conv;
14780 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14781 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14782 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14783 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14784 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
14786 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14787 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14788 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14789 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
14791 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14792 if (logger_conv.free == LDKLogger_JCalls_free) {
14793 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14794 LDKLogger_JCalls_cloned(&logger_conv);
14796 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);
14797 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14798 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14799 for (size_t u = 0; u < ret_var.datalen; u++) {
14800 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14801 *ret_conv_46_ref = ret_var.data[u];
14802 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14804 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14805 FREE(ret_var.data);
14809 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) {
14810 LDKChannelMonitor this_arg_conv;
14811 this_arg_conv.inner = (void*)(this_arg & (~1));
14812 this_arg_conv.is_owned = false;
14813 unsigned char header_arr[80];
14814 CHECK((*env)->GetArrayLength(env, header) == 80);
14815 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14816 unsigned char (*header_ref)[80] = &header_arr;
14817 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14818 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14819 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14820 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
14822 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14823 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14824 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14825 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
14827 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14828 if (logger_conv.free == LDKLogger_JCalls_free) {
14829 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14830 LDKLogger_JCalls_cloned(&logger_conv);
14832 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14835 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transactions_1confirmed(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) {
14836 LDKChannelMonitor this_arg_conv;
14837 this_arg_conv.inner = (void*)(this_arg & (~1));
14838 this_arg_conv.is_owned = false;
14839 unsigned char header_arr[80];
14840 CHECK((*env)->GetArrayLength(env, header) == 80);
14841 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14842 unsigned char (*header_ref)[80] = &header_arr;
14843 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
14844 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
14845 if (txdata_constr.datalen > 0)
14846 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
14848 txdata_constr.data = NULL;
14849 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
14850 for (size_t y = 0; y < txdata_constr.datalen; y++) {
14851 int64_t txdata_conv_24 = txdata_vals[y];
14852 LDKC2Tuple_usizeTransactionZ txdata_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1);
14853 txdata_conv_24_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)txdata_conv_24) & ~1));
14854 txdata_constr.data[y] = txdata_conv_24_conv;
14856 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
14857 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14858 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14859 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14860 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
14862 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14863 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14864 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14865 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
14867 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14868 if (logger_conv.free == LDKLogger_JCalls_free) {
14869 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14870 LDKLogger_JCalls_cloned(&logger_conv);
14872 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_transactions_confirmed(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14873 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14874 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14875 for (size_t u = 0; u < ret_var.datalen; u++) {
14876 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14877 *ret_conv_46_ref = ret_var.data[u];
14878 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14880 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14881 FREE(ret_var.data);
14885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1transaction_1unconfirmed(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
14886 LDKChannelMonitor this_arg_conv;
14887 this_arg_conv.inner = (void*)(this_arg & (~1));
14888 this_arg_conv.is_owned = false;
14889 unsigned char txid_arr[32];
14890 CHECK((*env)->GetArrayLength(env, txid) == 32);
14891 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
14892 unsigned char (*txid_ref)[32] = &txid_arr;
14893 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14894 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14895 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14896 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
14898 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14899 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14900 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14901 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
14903 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14904 if (logger_conv.free == LDKLogger_JCalls_free) {
14905 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14906 LDKLogger_JCalls_cloned(&logger_conv);
14908 ChannelMonitor_transaction_unconfirmed(&this_arg_conv, txid_ref, broadcaster_conv, fee_estimator_conv, logger_conv);
14911 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1best_1block_1updated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t height, int64_t broadcaster, int64_t fee_estimator, int64_t logger) {
14912 LDKChannelMonitor this_arg_conv;
14913 this_arg_conv.inner = (void*)(this_arg & (~1));
14914 this_arg_conv.is_owned = false;
14915 unsigned char header_arr[80];
14916 CHECK((*env)->GetArrayLength(env, header) == 80);
14917 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
14918 unsigned char (*header_ref)[80] = &header_arr;
14919 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
14920 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
14921 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14922 LDKBroadcasterInterface_JCalls_cloned(&broadcaster_conv);
14924 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
14925 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
14926 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14927 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
14929 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
14930 if (logger_conv.free == LDKLogger_JCalls_free) {
14931 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14932 LDKLogger_JCalls_cloned(&logger_conv);
14934 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret_var = ChannelMonitor_best_block_updated(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
14935 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
14936 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
14937 for (size_t u = 0; u < ret_var.datalen; u++) {
14938 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
14939 *ret_conv_46_ref = ret_var.data[u];
14940 ret_arr_ptr[u] = (uint64_t)ret_conv_46_ref;
14942 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
14943 FREE(ret_var.data);
14947 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
14948 LDKChannelMonitor this_arg_conv;
14949 this_arg_conv.inner = (void*)(this_arg & (~1));
14950 this_arg_conv.is_owned = false;
14951 LDKCVec_TxidZ ret_var = ChannelMonitor_get_relevant_txids(&this_arg_conv);
14952 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14954 for (size_t i = 0; i < ret_var.datalen; i++) {
14955 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
14956 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
14957 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
14959 FREE(ret_var.data);
14963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
14964 LDKChannelMonitor this_arg_conv;
14965 this_arg_conv.inner = (void*)(this_arg & (~1));
14966 this_arg_conv.is_owned = false;
14967 LDKBestBlock ret_var = ChannelMonitor_current_best_block(&this_arg_conv);
14968 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14969 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14970 uint64_t ret_ref = (uint64_t)ret_var.inner;
14971 if (ret_var.is_owned) {
14977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14978 if ((this_ptr & 1) != 0) return;
14979 LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
14980 FREE((void*)this_ptr);
14981 Persist_free(this_ptr_conv);
14984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
14985 LDKu8slice ser_ref;
14986 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14987 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14988 LDKKeysInterface* arg_conv = (LDKKeysInterface*)(((uint64_t)arg) & ~1);
14989 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
14990 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
14991 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14992 return (uint64_t)ret_conv;
14995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
14996 LDKOutPoint this_obj_conv;
14997 this_obj_conv.inner = (void*)(this_obj & (~1));
14998 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
14999 OutPoint_free(this_obj_conv);
15002 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
15003 LDKOutPoint this_ptr_conv;
15004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15005 this_ptr_conv.is_owned = false;
15006 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15007 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
15011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15012 LDKOutPoint this_ptr_conv;
15013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15014 this_ptr_conv.is_owned = false;
15015 LDKThirtyTwoBytes val_ref;
15016 CHECK((*env)->GetArrayLength(env, val) == 32);
15017 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15018 OutPoint_set_txid(&this_ptr_conv, val_ref);
15021 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
15022 LDKOutPoint this_ptr_conv;
15023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15024 this_ptr_conv.is_owned = false;
15025 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
15029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15030 LDKOutPoint this_ptr_conv;
15031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15032 this_ptr_conv.is_owned = false;
15033 OutPoint_set_index(&this_ptr_conv, val);
15036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
15037 LDKThirtyTwoBytes txid_arg_ref;
15038 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
15039 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
15040 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
15041 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15042 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15043 uint64_t ret_ref = (uint64_t)ret_var.inner;
15044 if (ret_var.is_owned) {
15050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15051 LDKOutPoint orig_conv;
15052 orig_conv.inner = (void*)(orig & (~1));
15053 orig_conv.is_owned = false;
15054 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
15055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15057 uint64_t ret_ref = (uint64_t)ret_var.inner;
15058 if (ret_var.is_owned) {
15064 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_OutPoint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
15065 LDKOutPoint a_conv;
15066 a_conv.inner = (void*)(a & (~1));
15067 a_conv.is_owned = false;
15068 LDKOutPoint b_conv;
15069 b_conv.inner = (void*)(b & (~1));
15070 b_conv.is_owned = false;
15071 jboolean ret_val = OutPoint_eq(&a_conv, &b_conv);
15075 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1hash(JNIEnv *env, jclass clz, int64_t o) {
15076 LDKOutPoint o_conv;
15077 o_conv.inner = (void*)(o & (~1));
15078 o_conv.is_owned = false;
15079 int64_t ret_val = OutPoint_hash(&o_conv);
15083 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
15084 LDKOutPoint this_arg_conv;
15085 this_arg_conv.inner = (void*)(this_arg & (~1));
15086 this_arg_conv.is_owned = false;
15087 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15088 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
15092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
15093 LDKOutPoint obj_conv;
15094 obj_conv.inner = (void*)(obj & (~1));
15095 obj_conv.is_owned = false;
15096 LDKCVec_u8Z ret_var = OutPoint_write(&obj_conv);
15097 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15098 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15099 CVec_u8Z_free(ret_var);
15103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15104 LDKu8slice ser_ref;
15105 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15106 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15107 LDKCResult_OutPointDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OutPointDecodeErrorZ), "LDKCResult_OutPointDecodeErrorZ");
15108 *ret_conv = OutPoint_read(ser_ref);
15109 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15110 return (uint64_t)ret_conv;
15113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15114 LDKDelayedPaymentOutputDescriptor this_obj_conv;
15115 this_obj_conv.inner = (void*)(this_obj & (~1));
15116 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15117 DelayedPaymentOutputDescriptor_free(this_obj_conv);
15120 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
15121 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15123 this_ptr_conv.is_owned = false;
15124 LDKOutPoint ret_var = DelayedPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15125 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15126 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15127 uint64_t ret_ref = (uint64_t)ret_var.inner;
15128 if (ret_var.is_owned) {
15134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15135 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15137 this_ptr_conv.is_owned = false;
15138 LDKOutPoint val_conv;
15139 val_conv.inner = (void*)(val & (~1));
15140 val_conv.is_owned = (val & 1) || (val == 0);
15141 val_conv = OutPoint_clone(&val_conv);
15142 DelayedPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15145 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
15146 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15148 this_ptr_conv.is_owned = false;
15149 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15150 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_per_commitment_point(&this_ptr_conv).compressed_form);
15154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15155 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15157 this_ptr_conv.is_owned = false;
15158 LDKPublicKey val_ref;
15159 CHECK((*env)->GetArrayLength(env, val) == 33);
15160 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15161 DelayedPaymentOutputDescriptor_set_per_commitment_point(&this_ptr_conv, val_ref);
15164 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15165 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15167 this_ptr_conv.is_owned = false;
15168 int16_t ret_val = DelayedPaymentOutputDescriptor_get_to_self_delay(&this_ptr_conv);
15172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15173 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15175 this_ptr_conv.is_owned = false;
15176 DelayedPaymentOutputDescriptor_set_to_self_delay(&this_ptr_conv, val);
15179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15180 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15182 this_ptr_conv.is_owned = false;
15183 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
15184 DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15187 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15188 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15190 this_ptr_conv.is_owned = false;
15191 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15192 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DelayedPaymentOutputDescriptor_get_revocation_pubkey(&this_ptr_conv).compressed_form);
15196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1revocation_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15197 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15199 this_ptr_conv.is_owned = false;
15200 LDKPublicKey val_ref;
15201 CHECK((*env)->GetArrayLength(env, val) == 33);
15202 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15203 DelayedPaymentOutputDescriptor_set_revocation_pubkey(&this_ptr_conv, val_ref);
15206 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15207 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15209 this_ptr_conv.is_owned = false;
15210 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15211 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DelayedPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
15215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15216 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15218 this_ptr_conv.is_owned = false;
15219 LDKThirtyTwoBytes val_ref;
15220 CHECK((*env)->GetArrayLength(env, val) == 32);
15221 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15222 DelayedPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15225 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15226 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15228 this_ptr_conv.is_owned = false;
15229 int64_t ret_val = DelayedPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15234 LDKDelayedPaymentOutputDescriptor this_ptr_conv;
15235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15236 this_ptr_conv.is_owned = false;
15237 DelayedPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int8_tArray per_commitment_point_arg, int16_t to_self_delay_arg, int64_t output_arg, int8_tArray revocation_pubkey_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
15241 LDKOutPoint outpoint_arg_conv;
15242 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15243 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15244 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15245 LDKPublicKey per_commitment_point_arg_ref;
15246 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
15247 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
15248 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
15249 LDKPublicKey revocation_pubkey_arg_ref;
15250 CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
15251 (*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
15252 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15253 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
15254 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
15255 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_new(outpoint_arg_conv, per_commitment_point_arg_ref, to_self_delay_arg, output_arg_conv, revocation_pubkey_arg_ref, channel_keys_id_arg_ref, channel_value_satoshis_arg);
15256 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15257 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15258 uint64_t ret_ref = (uint64_t)ret_var.inner;
15259 if (ret_var.is_owned) {
15265 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15266 LDKDelayedPaymentOutputDescriptor orig_conv;
15267 orig_conv.inner = (void*)(orig & (~1));
15268 orig_conv.is_owned = false;
15269 LDKDelayedPaymentOutputDescriptor ret_var = DelayedPaymentOutputDescriptor_clone(&orig_conv);
15270 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15271 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15272 uint64_t ret_ref = (uint64_t)ret_var.inner;
15273 if (ret_var.is_owned) {
15279 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15280 LDKDelayedPaymentOutputDescriptor obj_conv;
15281 obj_conv.inner = (void*)(obj & (~1));
15282 obj_conv.is_owned = false;
15283 LDKCVec_u8Z ret_var = DelayedPaymentOutputDescriptor_write(&obj_conv);
15284 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15285 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15286 CVec_u8Z_free(ret_var);
15290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DelayedPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15291 LDKu8slice ser_ref;
15292 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15293 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15294 LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ");
15295 *ret_conv = DelayedPaymentOutputDescriptor_read(ser_ref);
15296 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15297 return (uint64_t)ret_conv;
15300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15301 LDKStaticPaymentOutputDescriptor this_obj_conv;
15302 this_obj_conv.inner = (void*)(this_obj & (~1));
15303 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15304 StaticPaymentOutputDescriptor_free(this_obj_conv);
15307 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
15308 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15310 this_ptr_conv.is_owned = false;
15311 LDKOutPoint ret_var = StaticPaymentOutputDescriptor_get_outpoint(&this_ptr_conv);
15312 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15313 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15314 uint64_t ret_ref = (uint64_t)ret_var.inner;
15315 if (ret_var.is_owned) {
15321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15322 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15324 this_ptr_conv.is_owned = false;
15325 LDKOutPoint val_conv;
15326 val_conv.inner = (void*)(val & (~1));
15327 val_conv.is_owned = (val & 1) || (val == 0);
15328 val_conv = OutPoint_clone(&val_conv);
15329 StaticPaymentOutputDescriptor_set_outpoint(&this_ptr_conv, val_conv);
15332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1output(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15333 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15335 this_ptr_conv.is_owned = false;
15336 LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
15337 StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
15340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15341 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15343 this_ptr_conv.is_owned = false;
15344 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15345 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *StaticPaymentOutputDescriptor_get_channel_keys_id(&this_ptr_conv));
15349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15350 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15352 this_ptr_conv.is_owned = false;
15353 LDKThirtyTwoBytes val_ref;
15354 CHECK((*env)->GetArrayLength(env, val) == 32);
15355 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15356 StaticPaymentOutputDescriptor_set_channel_keys_id(&this_ptr_conv, val_ref);
15359 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
15360 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15362 this_ptr_conv.is_owned = false;
15363 int64_t ret_val = StaticPaymentOutputDescriptor_get_channel_value_satoshis(&this_ptr_conv);
15367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15368 LDKStaticPaymentOutputDescriptor this_ptr_conv;
15369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15370 this_ptr_conv.is_owned = false;
15371 StaticPaymentOutputDescriptor_set_channel_value_satoshis(&this_ptr_conv, val);
15374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1new(JNIEnv *env, jclass clz, int64_t outpoint_arg, int64_t output_arg, int8_tArray channel_keys_id_arg, int64_t channel_value_satoshis_arg) {
15375 LDKOutPoint outpoint_arg_conv;
15376 outpoint_arg_conv.inner = (void*)(outpoint_arg & (~1));
15377 outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
15378 outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
15379 LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
15380 LDKThirtyTwoBytes channel_keys_id_arg_ref;
15381 CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
15382 (*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
15383 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_new(outpoint_arg_conv, output_arg_conv, channel_keys_id_arg_ref, channel_value_satoshis_arg);
15384 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15385 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15386 uint64_t ret_ref = (uint64_t)ret_var.inner;
15387 if (ret_var.is_owned) {
15393 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15394 LDKStaticPaymentOutputDescriptor orig_conv;
15395 orig_conv.inner = (void*)(orig & (~1));
15396 orig_conv.is_owned = false;
15397 LDKStaticPaymentOutputDescriptor ret_var = StaticPaymentOutputDescriptor_clone(&orig_conv);
15398 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15399 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15400 uint64_t ret_ref = (uint64_t)ret_var.inner;
15401 if (ret_var.is_owned) {
15407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15408 LDKStaticPaymentOutputDescriptor obj_conv;
15409 obj_conv.inner = (void*)(obj & (~1));
15410 obj_conv.is_owned = false;
15411 LDKCVec_u8Z ret_var = StaticPaymentOutputDescriptor_write(&obj_conv);
15412 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15413 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15414 CVec_u8Z_free(ret_var);
15418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_StaticPaymentOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15419 LDKu8slice ser_ref;
15420 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15421 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15422 LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ), "LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ");
15423 *ret_conv = StaticPaymentOutputDescriptor_read(ser_ref);
15424 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15425 return (uint64_t)ret_conv;
15428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15429 if ((this_ptr & 1) != 0) return;
15430 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)this_ptr) & ~1);
15431 FREE((void*)this_ptr);
15432 SpendableOutputDescriptor_free(this_ptr_conv);
15435 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15436 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
15437 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
15438 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
15439 uint64_t ret_ref = (uint64_t)ret_copy;
15443 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
15444 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
15445 LDKCVec_u8Z ret_var = SpendableOutputDescriptor_write(obj_conv);
15446 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15447 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15448 CVec_u8Z_free(ret_var);
15452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15453 LDKu8slice ser_ref;
15454 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15455 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15456 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
15457 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
15458 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15459 return (uint64_t)ret_conv;
15462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BaseSign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15463 if ((this_ptr & 1) != 0) return;
15464 LDKBaseSign this_ptr_conv = *(LDKBaseSign*)(((uint64_t)this_ptr) & ~1);
15465 FREE((void*)this_ptr);
15466 BaseSign_free(this_ptr_conv);
15469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15470 LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
15471 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15472 *ret = Sign_clone(orig_conv);
15473 return (uint64_t)ret;
15476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15477 if ((this_ptr & 1) != 0) return;
15478 LDKSign this_ptr_conv = *(LDKSign*)(((uint64_t)this_ptr) & ~1);
15479 FREE((void*)this_ptr);
15480 Sign_free(this_ptr_conv);
15483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15484 if ((this_ptr & 1) != 0) return;
15485 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)(((uint64_t)this_ptr) & ~1);
15486 FREE((void*)this_ptr);
15487 KeysInterface_free(this_ptr_conv);
15490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15491 LDKInMemorySigner this_obj_conv;
15492 this_obj_conv.inner = (void*)(this_obj & (~1));
15493 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15494 InMemorySigner_free(this_obj_conv);
15497 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15498 LDKInMemorySigner this_ptr_conv;
15499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15500 this_ptr_conv.is_owned = false;
15501 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15502 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_funding_key(&this_ptr_conv));
15506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15507 LDKInMemorySigner this_ptr_conv;
15508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15509 this_ptr_conv.is_owned = false;
15510 LDKSecretKey val_ref;
15511 CHECK((*env)->GetArrayLength(env, val) == 32);
15512 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15513 InMemorySigner_set_funding_key(&this_ptr_conv, val_ref);
15516 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15517 LDKInMemorySigner this_ptr_conv;
15518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15519 this_ptr_conv.is_owned = false;
15520 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15521 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_revocation_base_key(&this_ptr_conv));
15525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15526 LDKInMemorySigner this_ptr_conv;
15527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15528 this_ptr_conv.is_owned = false;
15529 LDKSecretKey val_ref;
15530 CHECK((*env)->GetArrayLength(env, val) == 32);
15531 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15532 InMemorySigner_set_revocation_base_key(&this_ptr_conv, val_ref);
15535 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15536 LDKInMemorySigner this_ptr_conv;
15537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15538 this_ptr_conv.is_owned = false;
15539 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15540 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_payment_key(&this_ptr_conv));
15544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15545 LDKInMemorySigner this_ptr_conv;
15546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15547 this_ptr_conv.is_owned = false;
15548 LDKSecretKey val_ref;
15549 CHECK((*env)->GetArrayLength(env, val) == 32);
15550 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15551 InMemorySigner_set_payment_key(&this_ptr_conv, val_ref);
15554 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15555 LDKInMemorySigner this_ptr_conv;
15556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15557 this_ptr_conv.is_owned = false;
15558 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15559 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_delayed_payment_base_key(&this_ptr_conv));
15563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15564 LDKInMemorySigner this_ptr_conv;
15565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15566 this_ptr_conv.is_owned = false;
15567 LDKSecretKey val_ref;
15568 CHECK((*env)->GetArrayLength(env, val) == 32);
15569 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15570 InMemorySigner_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
15573 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
15574 LDKInMemorySigner this_ptr_conv;
15575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15576 this_ptr_conv.is_owned = false;
15577 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15578 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_htlc_base_key(&this_ptr_conv));
15582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15583 LDKInMemorySigner this_ptr_conv;
15584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15585 this_ptr_conv.is_owned = false;
15586 LDKSecretKey val_ref;
15587 CHECK((*env)->GetArrayLength(env, val) == 32);
15588 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
15589 InMemorySigner_set_htlc_base_key(&this_ptr_conv, val_ref);
15592 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
15593 LDKInMemorySigner this_ptr_conv;
15594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15595 this_ptr_conv.is_owned = false;
15596 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15597 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemorySigner_get_commitment_seed(&this_ptr_conv));
15601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15602 LDKInMemorySigner this_ptr_conv;
15603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15604 this_ptr_conv.is_owned = false;
15605 LDKThirtyTwoBytes val_ref;
15606 CHECK((*env)->GetArrayLength(env, val) == 32);
15607 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15608 InMemorySigner_set_commitment_seed(&this_ptr_conv, val_ref);
15611 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15612 LDKInMemorySigner orig_conv;
15613 orig_conv.inner = (void*)(orig & (~1));
15614 orig_conv.is_owned = false;
15615 LDKInMemorySigner ret_var = InMemorySigner_clone(&orig_conv);
15616 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15617 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15618 uint64_t ret_ref = (uint64_t)ret_var.inner;
15619 if (ret_var.is_owned) {
15625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_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, int8_tArray channel_keys_id) {
15626 LDKSecretKey funding_key_ref;
15627 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
15628 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
15629 LDKSecretKey revocation_base_key_ref;
15630 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
15631 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
15632 LDKSecretKey payment_key_ref;
15633 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
15634 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
15635 LDKSecretKey delayed_payment_base_key_ref;
15636 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
15637 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
15638 LDKSecretKey htlc_base_key_ref;
15639 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
15640 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
15641 LDKThirtyTwoBytes commitment_seed_ref;
15642 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
15643 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
15644 LDKThirtyTwoBytes channel_keys_id_ref;
15645 CHECK((*env)->GetArrayLength(env, channel_keys_id) == 32);
15646 (*env)->GetByteArrayRegion(env, channel_keys_id, 0, 32, channel_keys_id_ref.data);
15647 LDKInMemorySigner ret_var = InMemorySigner_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, channel_keys_id_ref);
15648 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15649 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15650 uint64_t ret_ref = (uint64_t)ret_var.inner;
15651 if (ret_var.is_owned) {
15657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15658 LDKInMemorySigner this_arg_conv;
15659 this_arg_conv.inner = (void*)(this_arg & (~1));
15660 this_arg_conv.is_owned = false;
15661 LDKChannelPublicKeys ret_var = InMemorySigner_counterparty_pubkeys(&this_arg_conv);
15662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15664 uint64_t ret_ref = (uint64_t)ret_var.inner;
15665 if (ret_var.is_owned) {
15671 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15672 LDKInMemorySigner this_arg_conv;
15673 this_arg_conv.inner = (void*)(this_arg & (~1));
15674 this_arg_conv.is_owned = false;
15675 int16_t ret_val = InMemorySigner_counterparty_selected_contest_delay(&this_arg_conv);
15679 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15680 LDKInMemorySigner this_arg_conv;
15681 this_arg_conv.inner = (void*)(this_arg & (~1));
15682 this_arg_conv.is_owned = false;
15683 int16_t ret_val = InMemorySigner_holder_selected_contest_delay(&this_arg_conv);
15687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
15688 LDKInMemorySigner this_arg_conv;
15689 this_arg_conv.inner = (void*)(this_arg & (~1));
15690 this_arg_conv.is_owned = false;
15691 jboolean ret_val = InMemorySigner_is_outbound(&this_arg_conv);
15695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
15696 LDKInMemorySigner this_arg_conv;
15697 this_arg_conv.inner = (void*)(this_arg & (~1));
15698 this_arg_conv.is_owned = false;
15699 LDKOutPoint ret_var = InMemorySigner_funding_outpoint(&this_arg_conv);
15700 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15701 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15702 uint64_t ret_ref = (uint64_t)ret_var.inner;
15703 if (ret_var.is_owned) {
15709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
15710 LDKInMemorySigner this_arg_conv;
15711 this_arg_conv.inner = (void*)(this_arg & (~1));
15712 this_arg_conv.is_owned = false;
15713 LDKChannelTransactionParameters ret_var = InMemorySigner_get_channel_parameters(&this_arg_conv);
15714 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15715 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15716 uint64_t ret_ref = (uint64_t)ret_var.inner;
15717 if (ret_var.is_owned) {
15723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
15724 LDKInMemorySigner this_arg_conv;
15725 this_arg_conv.inner = (void*)(this_arg & (~1));
15726 this_arg_conv.is_owned = false;
15727 LDKTransaction spend_tx_ref;
15728 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15729 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15730 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15731 spend_tx_ref.data_is_owned = true;
15732 LDKStaticPaymentOutputDescriptor descriptor_conv;
15733 descriptor_conv.inner = (void*)(descriptor & (~1));
15734 descriptor_conv.is_owned = false;
15735 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15736 *ret_conv = InMemorySigner_sign_counterparty_payment_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15737 return (uint64_t)ret_conv;
15740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1dynamic_1p2wsh_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) {
15741 LDKInMemorySigner this_arg_conv;
15742 this_arg_conv.inner = (void*)(this_arg & (~1));
15743 this_arg_conv.is_owned = false;
15744 LDKTransaction spend_tx_ref;
15745 spend_tx_ref.datalen = (*env)->GetArrayLength(env, spend_tx);
15746 spend_tx_ref.data = MALLOC(spend_tx_ref.datalen, "LDKTransaction Bytes");
15747 (*env)->GetByteArrayRegion(env, spend_tx, 0, spend_tx_ref.datalen, spend_tx_ref.data);
15748 spend_tx_ref.data_is_owned = true;
15749 LDKDelayedPaymentOutputDescriptor descriptor_conv;
15750 descriptor_conv.inner = (void*)(descriptor & (~1));
15751 descriptor_conv.is_owned = false;
15752 LDKCResult_CVec_CVec_u8ZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ), "LDKCResult_CVec_CVec_u8ZZNoneZ");
15753 *ret_conv = InMemorySigner_sign_dynamic_p2wsh_input(&this_arg_conv, spend_tx_ref, input_idx, &descriptor_conv);
15754 return (uint64_t)ret_conv;
15757 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1BaseSign(JNIEnv *env, jclass clz, int64_t this_arg) {
15758 LDKInMemorySigner this_arg_conv;
15759 this_arg_conv.inner = (void*)(this_arg & (~1));
15760 this_arg_conv.is_owned = false;
15761 LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
15762 *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
15763 return (uint64_t)ret;
15766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
15767 LDKInMemorySigner this_arg_conv;
15768 this_arg_conv.inner = (void*)(this_arg & (~1));
15769 this_arg_conv.is_owned = false;
15770 LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
15771 *ret = InMemorySigner_as_Sign(&this_arg_conv);
15772 return (uint64_t)ret;
15775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
15776 LDKInMemorySigner obj_conv;
15777 obj_conv.inner = (void*)(obj & (~1));
15778 obj_conv.is_owned = false;
15779 LDKCVec_u8Z ret_var = InMemorySigner_write(&obj_conv);
15780 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
15781 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
15782 CVec_u8Z_free(ret_var);
15786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15787 LDKu8slice ser_ref;
15788 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15789 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15790 LDKCResult_InMemorySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemorySignerDecodeErrorZ), "LDKCResult_InMemorySignerDecodeErrorZ");
15791 *ret_conv = InMemorySigner_read(ser_ref);
15792 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15793 return (uint64_t)ret_conv;
15796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15797 LDKKeysManager this_obj_conv;
15798 this_obj_conv.inner = (void*)(this_obj & (~1));
15799 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15800 KeysManager_free(this_obj_conv);
15803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, int64_t starting_time_secs, int32_t starting_time_nanos) {
15804 unsigned char seed_arr[32];
15805 CHECK((*env)->GetArrayLength(env, seed) == 32);
15806 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
15807 unsigned char (*seed_ref)[32] = &seed_arr;
15808 LDKKeysManager ret_var = KeysManager_new(seed_ref, starting_time_secs, starting_time_nanos);
15809 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15810 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15811 uint64_t ret_ref = (uint64_t)ret_var.inner;
15812 if (ret_var.is_owned) {
15818 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, int8_tArray params) {
15819 LDKKeysManager this_arg_conv;
15820 this_arg_conv.inner = (void*)(this_arg & (~1));
15821 this_arg_conv.is_owned = false;
15822 unsigned char params_arr[32];
15823 CHECK((*env)->GetArrayLength(env, params) == 32);
15824 (*env)->GetByteArrayRegion(env, params, 0, 32, params_arr);
15825 unsigned char (*params_ref)[32] = ¶ms_arr;
15826 LDKInMemorySigner ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_ref);
15827 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15828 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15829 uint64_t ret_ref = (uint64_t)ret_var.inner;
15830 if (ret_var.is_owned) {
15836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1spend_1spendable_1outputs(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray descriptors, int64_tArray outputs, int8_tArray change_destination_script, int32_t feerate_sat_per_1000_weight) {
15837 LDKKeysManager this_arg_conv;
15838 this_arg_conv.inner = (void*)(this_arg & (~1));
15839 this_arg_conv.is_owned = false;
15840 LDKCVec_SpendableOutputDescriptorZ descriptors_constr;
15841 descriptors_constr.datalen = (*env)->GetArrayLength(env, descriptors);
15842 if (descriptors_constr.datalen > 0)
15843 descriptors_constr.data = MALLOC(descriptors_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
15845 descriptors_constr.data = NULL;
15846 int64_t* descriptors_vals = (*env)->GetLongArrayElements (env, descriptors, NULL);
15847 for (size_t b = 0; b < descriptors_constr.datalen; b++) {
15848 int64_t descriptors_conv_27 = descriptors_vals[b];
15849 LDKSpendableOutputDescriptor descriptors_conv_27_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1);
15850 descriptors_conv_27_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)descriptors_conv_27) & ~1));
15851 descriptors_constr.data[b] = descriptors_conv_27_conv;
15853 (*env)->ReleaseLongArrayElements(env, descriptors, descriptors_vals, 0);
15854 LDKCVec_TxOutZ outputs_constr;
15855 outputs_constr.datalen = (*env)->GetArrayLength(env, outputs);
15856 if (outputs_constr.datalen > 0)
15857 outputs_constr.data = MALLOC(outputs_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
15859 outputs_constr.data = NULL;
15860 int64_t* outputs_vals = (*env)->GetLongArrayElements (env, outputs, NULL);
15861 for (size_t h = 0; h < outputs_constr.datalen; h++) {
15862 int64_t outputs_conv_7 = outputs_vals[h];
15863 LDKTxOut outputs_conv_7_conv = *(LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1);
15864 outputs_conv_7_conv = TxOut_clone((LDKTxOut*)(((uint64_t)outputs_conv_7) & ~1));
15865 outputs_constr.data[h] = outputs_conv_7_conv;
15867 (*env)->ReleaseLongArrayElements(env, outputs, outputs_vals, 0);
15868 LDKCVec_u8Z change_destination_script_ref;
15869 change_destination_script_ref.datalen = (*env)->GetArrayLength(env, change_destination_script);
15870 change_destination_script_ref.data = MALLOC(change_destination_script_ref.datalen, "LDKCVec_u8Z Bytes");
15871 (*env)->GetByteArrayRegion(env, change_destination_script, 0, change_destination_script_ref.datalen, change_destination_script_ref.data);
15872 LDKCResult_TransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TransactionNoneZ), "LDKCResult_TransactionNoneZ");
15873 *ret_conv = KeysManager_spend_spendable_outputs(&this_arg_conv, descriptors_constr, outputs_constr, change_destination_script_ref, feerate_sat_per_1000_weight);
15874 return (uint64_t)ret_conv;
15877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
15878 LDKKeysManager this_arg_conv;
15879 this_arg_conv.inner = (void*)(this_arg & (~1));
15880 this_arg_conv.is_owned = false;
15881 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
15882 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
15883 return (uint64_t)ret;
15886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15887 LDKChannelManager this_obj_conv;
15888 this_obj_conv.inner = (void*)(this_obj & (~1));
15889 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15890 ChannelManager_free(this_obj_conv);
15893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15894 LDKChainParameters this_obj_conv;
15895 this_obj_conv.inner = (void*)(this_obj & (~1));
15896 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15897 ChainParameters_free(this_obj_conv);
15900 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1network(JNIEnv *env, jclass clz, int64_t this_ptr) {
15901 LDKChainParameters this_ptr_conv;
15902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15903 this_ptr_conv.is_owned = false;
15904 jclass ret_conv = LDKNetwork_to_java(env, ChainParameters_get_network(&this_ptr_conv));
15908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1network(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) {
15909 LDKChainParameters this_ptr_conv;
15910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15911 this_ptr_conv.is_owned = false;
15912 LDKNetwork val_conv = LDKNetwork_from_java(env, val);
15913 ChainParameters_set_network(&this_ptr_conv, val_conv);
15916 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1get_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr) {
15917 LDKChainParameters this_ptr_conv;
15918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15919 this_ptr_conv.is_owned = false;
15920 LDKBestBlock ret_var = ChainParameters_get_best_block(&this_ptr_conv);
15921 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15922 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15923 uint64_t ret_ref = (uint64_t)ret_var.inner;
15924 if (ret_var.is_owned) {
15930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainParameters_1set_1best_1block(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15931 LDKChainParameters this_ptr_conv;
15932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15933 this_ptr_conv.is_owned = false;
15934 LDKBestBlock val_conv;
15935 val_conv.inner = (void*)(val & (~1));
15936 val_conv.is_owned = (val & 1) || (val == 0);
15937 val_conv = BestBlock_clone(&val_conv);
15938 ChainParameters_set_best_block(&this_ptr_conv, val_conv);
15941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1new(JNIEnv *env, jclass clz, jclass network_arg, int64_t best_block_arg) {
15942 LDKNetwork network_arg_conv = LDKNetwork_from_java(env, network_arg);
15943 LDKBestBlock best_block_arg_conv;
15944 best_block_arg_conv.inner = (void*)(best_block_arg & (~1));
15945 best_block_arg_conv.is_owned = (best_block_arg & 1) || (best_block_arg == 0);
15946 best_block_arg_conv = BestBlock_clone(&best_block_arg_conv);
15947 LDKChainParameters ret_var = ChainParameters_new(network_arg_conv, best_block_arg_conv);
15948 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15949 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15950 uint64_t ret_ref = (uint64_t)ret_var.inner;
15951 if (ret_var.is_owned) {
15957 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15958 LDKChainParameters orig_conv;
15959 orig_conv.inner = (void*)(orig & (~1));
15960 orig_conv.is_owned = false;
15961 LDKChainParameters ret_var = ChainParameters_clone(&orig_conv);
15962 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15963 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15964 uint64_t ret_ref = (uint64_t)ret_var.inner;
15965 if (ret_var.is_owned) {
15971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
15972 LDKChannelCounterparty this_obj_conv;
15973 this_obj_conv.inner = (void*)(this_obj & (~1));
15974 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
15975 ChannelCounterparty_free(this_obj_conv);
15978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15979 LDKChannelCounterparty this_ptr_conv;
15980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15981 this_ptr_conv.is_owned = false;
15982 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
15983 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form);
15987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15988 LDKChannelCounterparty this_ptr_conv;
15989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15990 this_ptr_conv.is_owned = false;
15991 LDKPublicKey val_ref;
15992 CHECK((*env)->GetArrayLength(env, val) == 33);
15993 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15994 ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
15997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15998 LDKChannelCounterparty this_ptr_conv;
15999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16000 this_ptr_conv.is_owned = false;
16001 LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
16002 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16003 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16004 uint64_t ret_ref = (uint64_t)ret_var.inner;
16005 if (ret_var.is_owned) {
16011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16012 LDKChannelCounterparty this_ptr_conv;
16013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16014 this_ptr_conv.is_owned = false;
16015 LDKInitFeatures val_conv;
16016 val_conv.inner = (void*)(val & (~1));
16017 val_conv.is_owned = (val & 1) || (val == 0);
16018 val_conv = InitFeatures_clone(&val_conv);
16019 ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
16022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
16023 LDKChannelCounterparty this_ptr_conv;
16024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16025 this_ptr_conv.is_owned = false;
16026 int64_t ret_val = ChannelCounterparty_get_unspendable_punishment_reserve(&this_ptr_conv);
16030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16031 LDKChannelCounterparty this_ptr_conv;
16032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16033 this_ptr_conv.is_owned = false;
16034 ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
16037 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16038 LDKChannelCounterparty orig_conv;
16039 orig_conv.inner = (void*)(orig & (~1));
16040 orig_conv.is_owned = false;
16041 LDKChannelCounterparty ret_var = ChannelCounterparty_clone(&orig_conv);
16042 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16043 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16044 uint64_t ret_ref = (uint64_t)ret_var.inner;
16045 if (ret_var.is_owned) {
16051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16052 LDKChannelDetails this_obj_conv;
16053 this_obj_conv.inner = (void*)(this_obj & (~1));
16054 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16055 ChannelDetails_free(this_obj_conv);
16058 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16059 LDKChannelDetails this_ptr_conv;
16060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16061 this_ptr_conv.is_owned = false;
16062 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16063 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
16067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16068 LDKChannelDetails this_ptr_conv;
16069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16070 this_ptr_conv.is_owned = false;
16071 LDKThirtyTwoBytes val_ref;
16072 CHECK((*env)->GetArrayLength(env, val) == 32);
16073 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16074 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
16077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr) {
16078 LDKChannelDetails this_ptr_conv;
16079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16080 this_ptr_conv.is_owned = false;
16081 LDKChannelCounterparty ret_var = ChannelDetails_get_counterparty(&this_ptr_conv);
16082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16084 uint64_t ret_ref = (uint64_t)ret_var.inner;
16085 if (ret_var.is_owned) {
16091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16092 LDKChannelDetails this_ptr_conv;
16093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16094 this_ptr_conv.is_owned = false;
16095 LDKChannelCounterparty val_conv;
16096 val_conv.inner = (void*)(val & (~1));
16097 val_conv.is_owned = (val & 1) || (val == 0);
16098 val_conv = ChannelCounterparty_clone(&val_conv);
16099 ChannelDetails_set_counterparty(&this_ptr_conv, val_conv);
16102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr) {
16103 LDKChannelDetails this_ptr_conv;
16104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16105 this_ptr_conv.is_owned = false;
16106 LDKOutPoint ret_var = ChannelDetails_get_funding_txo(&this_ptr_conv);
16107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16109 uint64_t ret_ref = (uint64_t)ret_var.inner;
16110 if (ret_var.is_owned) {
16116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16117 LDKChannelDetails this_ptr_conv;
16118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16119 this_ptr_conv.is_owned = false;
16120 LDKOutPoint val_conv;
16121 val_conv.inner = (void*)(val & (~1));
16122 val_conv.is_owned = (val & 1) || (val == 0);
16123 val_conv = OutPoint_clone(&val_conv);
16124 ChannelDetails_set_funding_txo(&this_ptr_conv, val_conv);
16127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16128 LDKChannelDetails this_ptr_conv;
16129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16130 this_ptr_conv.is_owned = false;
16131 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16132 *ret_copy = ChannelDetails_get_short_channel_id(&this_ptr_conv);
16133 uint64_t ret_ref = (uint64_t)ret_copy;
16137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16138 LDKChannelDetails this_ptr_conv;
16139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16140 this_ptr_conv.is_owned = false;
16141 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
16142 ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
16145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
16146 LDKChannelDetails this_ptr_conv;
16147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16148 this_ptr_conv.is_owned = false;
16149 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
16153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16154 LDKChannelDetails this_ptr_conv;
16155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16156 this_ptr_conv.is_owned = false;
16157 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
16160 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr) {
16161 LDKChannelDetails this_ptr_conv;
16162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16163 this_ptr_conv.is_owned = false;
16164 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
16165 *ret_copy = ChannelDetails_get_unspendable_punishment_reserve(&this_ptr_conv);
16166 uint64_t ret_ref = (uint64_t)ret_copy;
16170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1unspendable_1punishment_1reserve(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16171 LDKChannelDetails this_ptr_conv;
16172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16173 this_ptr_conv.is_owned = false;
16174 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
16175 ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
16178 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16179 LDKChannelDetails this_ptr_conv;
16180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16181 this_ptr_conv.is_owned = false;
16182 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
16186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16187 LDKChannelDetails this_ptr_conv;
16188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16189 this_ptr_conv.is_owned = false;
16190 ChannelDetails_set_user_id(&this_ptr_conv, val);
16193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16194 LDKChannelDetails this_ptr_conv;
16195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16196 this_ptr_conv.is_owned = false;
16197 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
16201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16202 LDKChannelDetails this_ptr_conv;
16203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16204 this_ptr_conv.is_owned = false;
16205 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
16208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16209 LDKChannelDetails this_ptr_conv;
16210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16211 this_ptr_conv.is_owned = false;
16212 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
16216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16217 LDKChannelDetails this_ptr_conv;
16218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16219 this_ptr_conv.is_owned = false;
16220 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
16223 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr) {
16224 LDKChannelDetails this_ptr_conv;
16225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16226 this_ptr_conv.is_owned = false;
16227 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
16228 *ret_copy = ChannelDetails_get_confirmations_required(&this_ptr_conv);
16229 uint64_t ret_ref = (uint64_t)ret_copy;
16233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1confirmations_1required(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16234 LDKChannelDetails this_ptr_conv;
16235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16236 this_ptr_conv.is_owned = false;
16237 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
16238 ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
16241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
16242 LDKChannelDetails this_ptr_conv;
16243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16244 this_ptr_conv.is_owned = false;
16245 LDKCOption_u16Z *ret_copy = MALLOC(sizeof(LDKCOption_u16Z), "LDKCOption_u16Z");
16246 *ret_copy = ChannelDetails_get_force_close_spend_delay(&this_ptr_conv);
16247 uint64_t ret_ref = (uint64_t)ret_copy;
16251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1force_1close_1spend_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16252 LDKChannelDetails this_ptr_conv;
16253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16254 this_ptr_conv.is_owned = false;
16255 LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
16256 ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
16259 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr) {
16260 LDKChannelDetails this_ptr_conv;
16261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16262 this_ptr_conv.is_owned = false;
16263 jboolean ret_val = ChannelDetails_get_is_outbound(&this_ptr_conv);
16267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16268 LDKChannelDetails this_ptr_conv;
16269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16270 this_ptr_conv.is_owned = false;
16271 ChannelDetails_set_is_outbound(&this_ptr_conv, val);
16274 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr) {
16275 LDKChannelDetails this_ptr_conv;
16276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16277 this_ptr_conv.is_owned = false;
16278 jboolean ret_val = ChannelDetails_get_is_funding_locked(&this_ptr_conv);
16282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1funding_1locked(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16283 LDKChannelDetails this_ptr_conv;
16284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16285 this_ptr_conv.is_owned = false;
16286 ChannelDetails_set_is_funding_locked(&this_ptr_conv, val);
16289 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr) {
16290 LDKChannelDetails this_ptr_conv;
16291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16292 this_ptr_conv.is_owned = false;
16293 jboolean ret_val = ChannelDetails_get_is_usable(&this_ptr_conv);
16297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1usable(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16298 LDKChannelDetails this_ptr_conv;
16299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16300 this_ptr_conv.is_owned = false;
16301 ChannelDetails_set_is_usable(&this_ptr_conv, val);
16304 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr) {
16305 LDKChannelDetails this_ptr_conv;
16306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16307 this_ptr_conv.is_owned = false;
16308 jboolean ret_val = ChannelDetails_get_is_public(&this_ptr_conv);
16312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1public(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16313 LDKChannelDetails this_ptr_conv;
16314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16315 this_ptr_conv.is_owned = false;
16316 ChannelDetails_set_is_public(&this_ptr_conv, val);
16319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) {
16320 LDKThirtyTwoBytes channel_id_arg_ref;
16321 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
16322 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
16323 LDKChannelCounterparty counterparty_arg_conv;
16324 counterparty_arg_conv.inner = (void*)(counterparty_arg & (~1));
16325 counterparty_arg_conv.is_owned = (counterparty_arg & 1) || (counterparty_arg == 0);
16326 counterparty_arg_conv = ChannelCounterparty_clone(&counterparty_arg_conv);
16327 LDKOutPoint funding_txo_arg_conv;
16328 funding_txo_arg_conv.inner = (void*)(funding_txo_arg & (~1));
16329 funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
16330 funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
16331 LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
16332 LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
16333 LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
16334 LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
16335 LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
16336 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16337 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16338 uint64_t ret_ref = (uint64_t)ret_var.inner;
16339 if (ret_var.is_owned) {
16345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16346 LDKChannelDetails orig_conv;
16347 orig_conv.inner = (void*)(orig & (~1));
16348 orig_conv.is_owned = false;
16349 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
16350 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16351 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16352 uint64_t ret_ref = (uint64_t)ret_var.inner;
16353 if (ret_var.is_owned) {
16359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16360 if ((this_ptr & 1) != 0) return;
16361 LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)(((uint64_t)this_ptr) & ~1);
16362 FREE((void*)this_ptr);
16363 PaymentSendFailure_free(this_ptr_conv);
16366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16367 LDKPaymentSendFailure* orig_conv = (LDKPaymentSendFailure*)orig;
16368 LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
16369 *ret_copy = PaymentSendFailure_clone(orig_conv);
16370 uint64_t ret_ref = (uint64_t)ret_copy;
16374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, int64_t params) {
16375 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)(((uint64_t)fee_est) & ~1);
16376 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
16377 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16378 LDKFeeEstimator_JCalls_cloned(&fee_est_conv);
16380 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16381 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16382 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16383 LDKWatch_JCalls_cloned(&chain_monitor_conv);
16385 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16386 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16387 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16388 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
16390 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16391 if (logger_conv.free == LDKLogger_JCalls_free) {
16392 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16393 LDKLogger_JCalls_cloned(&logger_conv);
16395 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16396 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16397 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16398 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
16400 LDKUserConfig config_conv;
16401 config_conv.inner = (void*)(config & (~1));
16402 config_conv.is_owned = (config & 1) || (config == 0);
16403 config_conv = UserConfig_clone(&config_conv);
16404 LDKChainParameters params_conv;
16405 params_conv.inner = (void*)(params & (~1));
16406 params_conv.is_owned = (params & 1) || (params == 0);
16407 params_conv = ChainParameters_clone(¶ms_conv);
16408 LDKChannelManager ret_var = ChannelManager_new(fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, params_conv);
16409 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16410 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16411 uint64_t ret_ref = (uint64_t)ret_var.inner;
16412 if (ret_var.is_owned) {
16418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1current_1default_1configuration(JNIEnv *env, jclass clz, int64_t this_arg) {
16419 LDKChannelManager this_arg_conv;
16420 this_arg_conv.inner = (void*)(this_arg & (~1));
16421 this_arg_conv.is_owned = false;
16422 LDKUserConfig ret_var = ChannelManager_get_current_default_configuration(&this_arg_conv);
16423 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16424 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16425 uint64_t ret_ref = (uint64_t)ret_var.inner;
16426 if (ret_var.is_owned) {
16432 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) {
16433 LDKChannelManager this_arg_conv;
16434 this_arg_conv.inner = (void*)(this_arg & (~1));
16435 this_arg_conv.is_owned = false;
16436 LDKPublicKey their_network_key_ref;
16437 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
16438 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
16439 LDKUserConfig override_config_conv;
16440 override_config_conv.inner = (void*)(override_config & (~1));
16441 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
16442 override_config_conv = UserConfig_clone(&override_config_conv);
16443 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16444 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
16445 return (uint64_t)ret_conv;
16448 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
16449 LDKChannelManager this_arg_conv;
16450 this_arg_conv.inner = (void*)(this_arg & (~1));
16451 this_arg_conv.is_owned = false;
16452 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
16453 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16454 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16455 for (size_t q = 0; q < ret_var.datalen; q++) {
16456 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16457 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16458 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16459 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16460 if (ret_conv_16_var.is_owned) {
16461 ret_conv_16_ref |= 1;
16463 ret_arr_ptr[q] = ret_conv_16_ref;
16465 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16466 FREE(ret_var.data);
16470 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
16471 LDKChannelManager this_arg_conv;
16472 this_arg_conv.inner = (void*)(this_arg & (~1));
16473 this_arg_conv.is_owned = false;
16474 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
16475 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
16476 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
16477 for (size_t q = 0; q < ret_var.datalen; q++) {
16478 LDKChannelDetails ret_conv_16_var = ret_var.data[q];
16479 CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16480 CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16481 uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
16482 if (ret_conv_16_var.is_owned) {
16483 ret_conv_16_ref |= 1;
16485 ret_arr_ptr[q] = ret_conv_16_ref;
16487 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
16488 FREE(ret_var.data);
16492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
16493 LDKChannelManager this_arg_conv;
16494 this_arg_conv.inner = (void*)(this_arg & (~1));
16495 this_arg_conv.is_owned = false;
16496 unsigned char channel_id_arr[32];
16497 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16498 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
16499 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16500 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16501 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
16502 return (uint64_t)ret_conv;
16505 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) {
16506 LDKChannelManager this_arg_conv;
16507 this_arg_conv.inner = (void*)(this_arg & (~1));
16508 this_arg_conv.is_owned = false;
16509 unsigned char channel_id_arr[32];
16510 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
16511 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
16512 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
16513 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16514 *ret_conv = ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
16515 return (uint64_t)ret_conv;
16518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
16519 LDKChannelManager this_arg_conv;
16520 this_arg_conv.inner = (void*)(this_arg & (~1));
16521 this_arg_conv.is_owned = false;
16522 ChannelManager_force_close_all_channels(&this_arg_conv);
16525 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) {
16526 LDKChannelManager this_arg_conv;
16527 this_arg_conv.inner = (void*)(this_arg & (~1));
16528 this_arg_conv.is_owned = false;
16529 LDKRoute route_conv;
16530 route_conv.inner = (void*)(route & (~1));
16531 route_conv.is_owned = false;
16532 LDKThirtyTwoBytes payment_hash_ref;
16533 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16534 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
16535 LDKThirtyTwoBytes payment_secret_ref;
16536 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
16537 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
16538 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
16539 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
16540 return (uint64_t)ret_conv;
16543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) {
16544 LDKChannelManager this_arg_conv;
16545 this_arg_conv.inner = (void*)(this_arg & (~1));
16546 this_arg_conv.is_owned = false;
16547 LDKRoute route_conv;
16548 route_conv.inner = (void*)(route & (~1));
16549 route_conv.is_owned = false;
16550 LDKThirtyTwoBytes payment_preimage_ref;
16551 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
16552 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
16553 LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
16554 *ret_conv = ChannelManager_send_spontaneous_payment(&this_arg_conv, &route_conv, payment_preimage_ref);
16555 return (uint64_t)ret_conv;
16558 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int8_tArray funding_transaction) {
16559 LDKChannelManager this_arg_conv;
16560 this_arg_conv.inner = (void*)(this_arg & (~1));
16561 this_arg_conv.is_owned = false;
16562 unsigned char temporary_channel_id_arr[32];
16563 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
16564 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
16565 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
16566 LDKTransaction funding_transaction_ref;
16567 funding_transaction_ref.datalen = (*env)->GetArrayLength(env, funding_transaction);
16568 funding_transaction_ref.data = MALLOC(funding_transaction_ref.datalen, "LDKTransaction Bytes");
16569 (*env)->GetByteArrayRegion(env, funding_transaction, 0, funding_transaction_ref.datalen, funding_transaction_ref.data);
16570 funding_transaction_ref.data_is_owned = true;
16571 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
16572 *ret_conv = ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_transaction_ref);
16573 return (uint64_t)ret_conv;
16576 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) {
16577 LDKChannelManager this_arg_conv;
16578 this_arg_conv.inner = (void*)(this_arg & (~1));
16579 this_arg_conv.is_owned = false;
16580 LDKThreeBytes rgb_ref;
16581 CHECK((*env)->GetArrayLength(env, rgb) == 3);
16582 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
16583 LDKThirtyTwoBytes alias_ref;
16584 CHECK((*env)->GetArrayLength(env, alias) == 32);
16585 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
16586 LDKCVec_NetAddressZ addresses_constr;
16587 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
16588 if (addresses_constr.datalen > 0)
16589 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16591 addresses_constr.data = NULL;
16592 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
16593 for (size_t m = 0; m < addresses_constr.datalen; m++) {
16594 int64_t addresses_conv_12 = addresses_vals[m];
16595 LDKNetAddress addresses_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_conv_12) & ~1);
16596 addresses_constr.data[m] = addresses_conv_12_conv;
16598 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
16599 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
16602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
16603 LDKChannelManager this_arg_conv;
16604 this_arg_conv.inner = (void*)(this_arg & (~1));
16605 this_arg_conv.is_owned = false;
16606 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
16609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
16610 LDKChannelManager this_arg_conv;
16611 this_arg_conv.inner = (void*)(this_arg & (~1));
16612 this_arg_conv.is_owned = false;
16613 ChannelManager_timer_tick_occurred(&this_arg_conv);
16616 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) {
16617 LDKChannelManager this_arg_conv;
16618 this_arg_conv.inner = (void*)(this_arg & (~1));
16619 this_arg_conv.is_owned = false;
16620 unsigned char payment_hash_arr[32];
16621 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16622 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
16623 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
16624 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref);
16628 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage) {
16629 LDKChannelManager this_arg_conv;
16630 this_arg_conv.inner = (void*)(this_arg & (~1));
16631 this_arg_conv.is_owned = false;
16632 LDKThirtyTwoBytes payment_preimage_ref;
16633 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
16634 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
16635 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref);
16639 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
16640 LDKChannelManager this_arg_conv;
16641 this_arg_conv.inner = (void*)(this_arg & (~1));
16642 this_arg_conv.is_owned = false;
16643 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
16644 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
16648 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) {
16649 LDKChannelManager this_arg_conv;
16650 this_arg_conv.inner = (void*)(this_arg & (~1));
16651 this_arg_conv.is_owned = false;
16652 LDKOutPoint funding_txo_conv;
16653 funding_txo_conv.inner = (void*)(funding_txo & (~1));
16654 funding_txo_conv.is_owned = false;
16655 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
16658 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
16659 LDKChannelManager this_arg_conv;
16660 this_arg_conv.inner = (void*)(this_arg & (~1));
16661 this_arg_conv.is_owned = false;
16662 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16663 LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
16664 *ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
16665 return (uint64_t)ret_ref;
16668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) {
16669 LDKChannelManager this_arg_conv;
16670 this_arg_conv.inner = (void*)(this_arg & (~1));
16671 this_arg_conv.is_owned = false;
16672 LDKThirtyTwoBytes payment_hash_ref;
16673 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
16674 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
16675 LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
16676 LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
16677 *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
16678 return (uint64_t)ret_conv;
16681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16682 LDKChannelManager this_arg_conv;
16683 this_arg_conv.inner = (void*)(this_arg & (~1));
16684 this_arg_conv.is_owned = false;
16685 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16686 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
16687 return (uint64_t)ret;
16690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16691 LDKChannelManager this_arg_conv;
16692 this_arg_conv.inner = (void*)(this_arg & (~1));
16693 this_arg_conv.is_owned = false;
16694 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
16695 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
16696 return (uint64_t)ret;
16699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
16700 LDKChannelManager this_arg_conv;
16701 this_arg_conv.inner = (void*)(this_arg & (~1));
16702 this_arg_conv.is_owned = false;
16703 LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
16704 *ret = ChannelManager_as_Listen(&this_arg_conv);
16705 return (uint64_t)ret;
16708 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
16709 LDKChannelManager this_arg_conv;
16710 this_arg_conv.inner = (void*)(this_arg & (~1));
16711 this_arg_conv.is_owned = false;
16712 LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
16713 *ret = ChannelManager_as_Confirm(&this_arg_conv);
16714 return (uint64_t)ret;
16717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
16718 LDKChannelManager this_arg_conv;
16719 this_arg_conv.inner = (void*)(this_arg & (~1));
16720 this_arg_conv.is_owned = false;
16721 jboolean ret_val = ChannelManager_await_persistable_update_timeout(&this_arg_conv, max_wait);
16725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update(JNIEnv *env, jclass clz, int64_t this_arg) {
16726 LDKChannelManager this_arg_conv;
16727 this_arg_conv.inner = (void*)(this_arg & (~1));
16728 this_arg_conv.is_owned = false;
16729 ChannelManager_await_persistable_update(&this_arg_conv);
16732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1current_1best_1block(JNIEnv *env, jclass clz, int64_t this_arg) {
16733 LDKChannelManager this_arg_conv;
16734 this_arg_conv.inner = (void*)(this_arg & (~1));
16735 this_arg_conv.is_owned = false;
16736 LDKBestBlock ret_var = ChannelManager_current_best_block(&this_arg_conv);
16737 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16738 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16739 uint64_t ret_ref = (uint64_t)ret_var.inner;
16740 if (ret_var.is_owned) {
16746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16747 LDKChannelManager this_arg_conv;
16748 this_arg_conv.inner = (void*)(this_arg & (~1));
16749 this_arg_conv.is_owned = false;
16750 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
16751 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
16752 return (uint64_t)ret;
16755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
16756 LDKChannelManager obj_conv;
16757 obj_conv.inner = (void*)(obj & (~1));
16758 obj_conv.is_owned = false;
16759 LDKCVec_u8Z ret_var = ChannelManager_write(&obj_conv);
16760 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
16761 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
16762 CVec_u8Z_free(ret_var);
16766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16767 LDKChannelManagerReadArgs this_obj_conv;
16768 this_obj_conv.inner = (void*)(this_obj & (~1));
16769 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16770 ChannelManagerReadArgs_free(this_obj_conv);
16773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
16774 LDKChannelManagerReadArgs this_ptr_conv;
16775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16776 this_ptr_conv.is_owned = false;
16777 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
16781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16782 LDKChannelManagerReadArgs this_ptr_conv;
16783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16784 this_ptr_conv.is_owned = false;
16785 LDKKeysInterface val_conv = *(LDKKeysInterface*)(((uint64_t)val) & ~1);
16786 if (val_conv.free == LDKKeysInterface_JCalls_free) {
16787 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16788 LDKKeysInterface_JCalls_cloned(&val_conv);
16790 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
16793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
16794 LDKChannelManagerReadArgs this_ptr_conv;
16795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16796 this_ptr_conv.is_owned = false;
16797 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
16801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16802 LDKChannelManagerReadArgs this_ptr_conv;
16803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16804 this_ptr_conv.is_owned = false;
16805 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)(((uint64_t)val) & ~1);
16806 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
16807 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16808 LDKFeeEstimator_JCalls_cloned(&val_conv);
16810 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
16813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
16814 LDKChannelManagerReadArgs this_ptr_conv;
16815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16816 this_ptr_conv.is_owned = false;
16817 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
16821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16822 LDKChannelManagerReadArgs this_ptr_conv;
16823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16824 this_ptr_conv.is_owned = false;
16825 LDKWatch val_conv = *(LDKWatch*)(((uint64_t)val) & ~1);
16826 if (val_conv.free == LDKWatch_JCalls_free) {
16827 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16828 LDKWatch_JCalls_cloned(&val_conv);
16830 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
16833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
16834 LDKChannelManagerReadArgs this_ptr_conv;
16835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16836 this_ptr_conv.is_owned = false;
16837 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
16841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16842 LDKChannelManagerReadArgs this_ptr_conv;
16843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16844 this_ptr_conv.is_owned = false;
16845 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)(((uint64_t)val) & ~1);
16846 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
16847 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16848 LDKBroadcasterInterface_JCalls_cloned(&val_conv);
16850 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
16853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
16854 LDKChannelManagerReadArgs this_ptr_conv;
16855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16856 this_ptr_conv.is_owned = false;
16857 uint64_t ret_ret = (uint64_t)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
16861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16862 LDKChannelManagerReadArgs this_ptr_conv;
16863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16864 this_ptr_conv.is_owned = false;
16865 LDKLogger val_conv = *(LDKLogger*)(((uint64_t)val) & ~1);
16866 if (val_conv.free == LDKLogger_JCalls_free) {
16867 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16868 LDKLogger_JCalls_cloned(&val_conv);
16870 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
16873 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
16874 LDKChannelManagerReadArgs this_ptr_conv;
16875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16876 this_ptr_conv.is_owned = false;
16877 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
16878 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16879 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16880 uint64_t ret_ref = (uint64_t)ret_var.inner;
16881 if (ret_var.is_owned) {
16887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16888 LDKChannelManagerReadArgs this_ptr_conv;
16889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16890 this_ptr_conv.is_owned = false;
16891 LDKUserConfig val_conv;
16892 val_conv.inner = (void*)(val & (~1));
16893 val_conv.is_owned = (val & 1) || (val == 0);
16894 val_conv = UserConfig_clone(&val_conv);
16895 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
16898 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) {
16899 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
16900 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
16901 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16902 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
16904 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)(((uint64_t)fee_estimator) & ~1);
16905 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
16906 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16907 LDKFeeEstimator_JCalls_cloned(&fee_estimator_conv);
16909 LDKWatch chain_monitor_conv = *(LDKWatch*)(((uint64_t)chain_monitor) & ~1);
16910 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
16911 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16912 LDKWatch_JCalls_cloned(&chain_monitor_conv);
16914 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)tx_broadcaster) & ~1);
16915 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
16916 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16917 LDKBroadcasterInterface_JCalls_cloned(&tx_broadcaster_conv);
16919 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
16920 if (logger_conv.free == LDKLogger_JCalls_free) {
16921 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16922 LDKLogger_JCalls_cloned(&logger_conv);
16924 LDKUserConfig default_config_conv;
16925 default_config_conv.inner = (void*)(default_config & (~1));
16926 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
16927 default_config_conv = UserConfig_clone(&default_config_conv);
16928 LDKCVec_ChannelMonitorZ channel_monitors_constr;
16929 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
16930 if (channel_monitors_constr.datalen > 0)
16931 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
16933 channel_monitors_constr.data = NULL;
16934 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
16935 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
16936 int64_t channel_monitors_conv_16 = channel_monitors_vals[q];
16937 LDKChannelMonitor channel_monitors_conv_16_conv;
16938 channel_monitors_conv_16_conv.inner = (void*)(channel_monitors_conv_16 & (~1));
16939 channel_monitors_conv_16_conv.is_owned = (channel_monitors_conv_16 & 1) || (channel_monitors_conv_16 == 0);
16940 channel_monitors_constr.data[q] = channel_monitors_conv_16_conv;
16942 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
16943 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);
16944 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16945 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16946 uint64_t ret_ref = (uint64_t)ret_var.inner;
16947 if (ret_var.is_owned) {
16953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
16954 LDKu8slice ser_ref;
16955 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16956 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16957 LDKChannelManagerReadArgs arg_conv;
16958 arg_conv.inner = (void*)(arg & (~1));
16959 arg_conv.is_owned = (arg & 1) || (arg == 0);
16960 // Warning: we need a move here but no clone is available for LDKChannelManagerReadArgs
16961 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
16962 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
16963 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16964 return (uint64_t)ret_conv;
16967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16968 LDKDecodeError this_obj_conv;
16969 this_obj_conv.inner = (void*)(this_obj & (~1));
16970 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16971 DecodeError_free(this_obj_conv);
16974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DecodeError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16975 LDKDecodeError orig_conv;
16976 orig_conv.inner = (void*)(orig & (~1));
16977 orig_conv.is_owned = false;
16978 LDKDecodeError ret_var = DecodeError_clone(&orig_conv);
16979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16981 uint64_t ret_ref = (uint64_t)ret_var.inner;
16982 if (ret_var.is_owned) {
16988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
16989 LDKInit this_obj_conv;
16990 this_obj_conv.inner = (void*)(this_obj & (~1));
16991 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
16992 Init_free(this_obj_conv);
16995 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16996 LDKInit this_ptr_conv;
16997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16998 this_ptr_conv.is_owned = false;
16999 LDKInitFeatures ret_var = Init_get_features(&this_ptr_conv);
17000 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17001 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17002 uint64_t ret_ref = (uint64_t)ret_var.inner;
17003 if (ret_var.is_owned) {
17009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17010 LDKInit this_ptr_conv;
17011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17012 this_ptr_conv.is_owned = false;
17013 LDKInitFeatures val_conv;
17014 val_conv.inner = (void*)(val & (~1));
17015 val_conv.is_owned = (val & 1) || (val == 0);
17016 val_conv = InitFeatures_clone(&val_conv);
17017 Init_set_features(&this_ptr_conv, val_conv);
17020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1new(JNIEnv *env, jclass clz, int64_t features_arg) {
17021 LDKInitFeatures features_arg_conv;
17022 features_arg_conv.inner = (void*)(features_arg & (~1));
17023 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
17024 features_arg_conv = InitFeatures_clone(&features_arg_conv);
17025 LDKInit ret_var = Init_new(features_arg_conv);
17026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17028 uint64_t ret_ref = (uint64_t)ret_var.inner;
17029 if (ret_var.is_owned) {
17035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17037 orig_conv.inner = (void*)(orig & (~1));
17038 orig_conv.is_owned = false;
17039 LDKInit ret_var = Init_clone(&orig_conv);
17040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17042 uint64_t ret_ref = (uint64_t)ret_var.inner;
17043 if (ret_var.is_owned) {
17049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17050 LDKErrorMessage this_obj_conv;
17051 this_obj_conv.inner = (void*)(this_obj & (~1));
17052 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17053 ErrorMessage_free(this_obj_conv);
17056 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17057 LDKErrorMessage this_ptr_conv;
17058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17059 this_ptr_conv.is_owned = false;
17060 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17061 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
17065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17066 LDKErrorMessage this_ptr_conv;
17067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17068 this_ptr_conv.is_owned = false;
17069 LDKThirtyTwoBytes val_ref;
17070 CHECK((*env)->GetArrayLength(env, val) == 32);
17071 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17072 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
17075 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
17076 LDKErrorMessage this_ptr_conv;
17077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17078 this_ptr_conv.is_owned = false;
17079 LDKStr ret_str = ErrorMessage_get_data(&this_ptr_conv);
17080 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
17085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
17086 LDKErrorMessage this_ptr_conv;
17087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17088 this_ptr_conv.is_owned = false;
17089 LDKStr val_conv = java_to_owned_str(env, val);
17090 ErrorMessage_set_data(&this_ptr_conv, val_conv);
17093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, jstring data_arg) {
17094 LDKThirtyTwoBytes channel_id_arg_ref;
17095 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17096 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17097 LDKStr data_arg_conv = java_to_owned_str(env, data_arg);
17098 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
17099 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17100 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17101 uint64_t ret_ref = (uint64_t)ret_var.inner;
17102 if (ret_var.is_owned) {
17108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17109 LDKErrorMessage orig_conv;
17110 orig_conv.inner = (void*)(orig & (~1));
17111 orig_conv.is_owned = false;
17112 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
17113 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17114 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17115 uint64_t ret_ref = (uint64_t)ret_var.inner;
17116 if (ret_var.is_owned) {
17122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17123 LDKPing this_obj_conv;
17124 this_obj_conv.inner = (void*)(this_obj & (~1));
17125 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17126 Ping_free(this_obj_conv);
17129 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17130 LDKPing this_ptr_conv;
17131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17132 this_ptr_conv.is_owned = false;
17133 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
17137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17138 LDKPing this_ptr_conv;
17139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17140 this_ptr_conv.is_owned = false;
17141 Ping_set_ponglen(&this_ptr_conv, val);
17144 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17145 LDKPing this_ptr_conv;
17146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17147 this_ptr_conv.is_owned = false;
17148 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
17152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17153 LDKPing this_ptr_conv;
17154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17155 this_ptr_conv.is_owned = false;
17156 Ping_set_byteslen(&this_ptr_conv, val);
17159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
17160 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
17161 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17162 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17163 uint64_t ret_ref = (uint64_t)ret_var.inner;
17164 if (ret_var.is_owned) {
17170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17172 orig_conv.inner = (void*)(orig & (~1));
17173 orig_conv.is_owned = false;
17174 LDKPing ret_var = Ping_clone(&orig_conv);
17175 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17176 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17177 uint64_t ret_ref = (uint64_t)ret_var.inner;
17178 if (ret_var.is_owned) {
17184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17185 LDKPong this_obj_conv;
17186 this_obj_conv.inner = (void*)(this_obj & (~1));
17187 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17188 Pong_free(this_obj_conv);
17191 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
17192 LDKPong this_ptr_conv;
17193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17194 this_ptr_conv.is_owned = false;
17195 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
17199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17200 LDKPong this_ptr_conv;
17201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17202 this_ptr_conv.is_owned = false;
17203 Pong_set_byteslen(&this_ptr_conv, val);
17206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
17207 LDKPong ret_var = Pong_new(byteslen_arg);
17208 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17209 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17210 uint64_t ret_ref = (uint64_t)ret_var.inner;
17211 if (ret_var.is_owned) {
17217 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17219 orig_conv.inner = (void*)(orig & (~1));
17220 orig_conv.is_owned = false;
17221 LDKPong ret_var = Pong_clone(&orig_conv);
17222 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17223 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17224 uint64_t ret_ref = (uint64_t)ret_var.inner;
17225 if (ret_var.is_owned) {
17231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17232 LDKOpenChannel this_obj_conv;
17233 this_obj_conv.inner = (void*)(this_obj & (~1));
17234 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17235 OpenChannel_free(this_obj_conv);
17238 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
17239 LDKOpenChannel this_ptr_conv;
17240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17241 this_ptr_conv.is_owned = false;
17242 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17243 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
17247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17248 LDKOpenChannel this_ptr_conv;
17249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17250 this_ptr_conv.is_owned = false;
17251 LDKThirtyTwoBytes val_ref;
17252 CHECK((*env)->GetArrayLength(env, val) == 32);
17253 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17254 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
17257 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17258 LDKOpenChannel this_ptr_conv;
17259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17260 this_ptr_conv.is_owned = false;
17261 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17262 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
17266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17267 LDKOpenChannel this_ptr_conv;
17268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17269 this_ptr_conv.is_owned = false;
17270 LDKThirtyTwoBytes val_ref;
17271 CHECK((*env)->GetArrayLength(env, val) == 32);
17272 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17273 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17277 LDKOpenChannel this_ptr_conv;
17278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17279 this_ptr_conv.is_owned = false;
17280 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
17284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17285 LDKOpenChannel this_ptr_conv;
17286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17287 this_ptr_conv.is_owned = false;
17288 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
17291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17292 LDKOpenChannel this_ptr_conv;
17293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17294 this_ptr_conv.is_owned = false;
17295 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
17299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17300 LDKOpenChannel this_ptr_conv;
17301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17302 this_ptr_conv.is_owned = false;
17303 OpenChannel_set_push_msat(&this_ptr_conv, val);
17306 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17307 LDKOpenChannel this_ptr_conv;
17308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17309 this_ptr_conv.is_owned = false;
17310 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
17314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17315 LDKOpenChannel this_ptr_conv;
17316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17317 this_ptr_conv.is_owned = false;
17318 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17321 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) {
17322 LDKOpenChannel this_ptr_conv;
17323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17324 this_ptr_conv.is_owned = false;
17325 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17329 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) {
17330 LDKOpenChannel this_ptr_conv;
17331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17332 this_ptr_conv.is_owned = false;
17333 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17337 LDKOpenChannel this_ptr_conv;
17338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17339 this_ptr_conv.is_owned = false;
17340 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17345 LDKOpenChannel this_ptr_conv;
17346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17347 this_ptr_conv.is_owned = false;
17348 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17352 LDKOpenChannel this_ptr_conv;
17353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17354 this_ptr_conv.is_owned = false;
17355 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
17359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17360 LDKOpenChannel this_ptr_conv;
17361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17362 this_ptr_conv.is_owned = false;
17363 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17366 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
17367 LDKOpenChannel this_ptr_conv;
17368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17369 this_ptr_conv.is_owned = false;
17370 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
17374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17375 LDKOpenChannel this_ptr_conv;
17376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17377 this_ptr_conv.is_owned = false;
17378 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
17381 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17382 LDKOpenChannel this_ptr_conv;
17383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17384 this_ptr_conv.is_owned = false;
17385 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
17389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17390 LDKOpenChannel this_ptr_conv;
17391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17392 this_ptr_conv.is_owned = false;
17393 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
17396 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
17397 LDKOpenChannel this_ptr_conv;
17398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17399 this_ptr_conv.is_owned = false;
17400 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
17404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17405 LDKOpenChannel this_ptr_conv;
17406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17407 this_ptr_conv.is_owned = false;
17408 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17411 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17412 LDKOpenChannel this_ptr_conv;
17413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17414 this_ptr_conv.is_owned = false;
17415 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17416 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
17420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17421 LDKOpenChannel this_ptr_conv;
17422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17423 this_ptr_conv.is_owned = false;
17424 LDKPublicKey val_ref;
17425 CHECK((*env)->GetArrayLength(env, val) == 33);
17426 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17427 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17431 LDKOpenChannel this_ptr_conv;
17432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17433 this_ptr_conv.is_owned = false;
17434 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17440 LDKOpenChannel this_ptr_conv;
17441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17442 this_ptr_conv.is_owned = false;
17443 LDKPublicKey val_ref;
17444 CHECK((*env)->GetArrayLength(env, val) == 33);
17445 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17446 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17449 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17450 LDKOpenChannel this_ptr_conv;
17451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17452 this_ptr_conv.is_owned = false;
17453 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17454 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
17458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17459 LDKOpenChannel this_ptr_conv;
17460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17461 this_ptr_conv.is_owned = false;
17462 LDKPublicKey val_ref;
17463 CHECK((*env)->GetArrayLength(env, val) == 33);
17464 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17465 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
17468 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17469 LDKOpenChannel this_ptr_conv;
17470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17471 this_ptr_conv.is_owned = false;
17472 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17473 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17478 LDKOpenChannel this_ptr_conv;
17479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17480 this_ptr_conv.is_owned = false;
17481 LDKPublicKey val_ref;
17482 CHECK((*env)->GetArrayLength(env, val) == 33);
17483 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17484 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17487 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17488 LDKOpenChannel this_ptr_conv;
17489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17490 this_ptr_conv.is_owned = false;
17491 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17492 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
17496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17497 LDKOpenChannel this_ptr_conv;
17498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17499 this_ptr_conv.is_owned = false;
17500 LDKPublicKey val_ref;
17501 CHECK((*env)->GetArrayLength(env, val) == 33);
17502 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17503 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
17506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17507 LDKOpenChannel this_ptr_conv;
17508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17509 this_ptr_conv.is_owned = false;
17510 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17511 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
17515 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) {
17516 LDKOpenChannel this_ptr_conv;
17517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17518 this_ptr_conv.is_owned = false;
17519 LDKPublicKey val_ref;
17520 CHECK((*env)->GetArrayLength(env, val) == 33);
17521 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17522 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17525 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
17526 LDKOpenChannel this_ptr_conv;
17527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17528 this_ptr_conv.is_owned = false;
17529 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
17533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
17534 LDKOpenChannel this_ptr_conv;
17535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17536 this_ptr_conv.is_owned = false;
17537 OpenChannel_set_channel_flags(&this_ptr_conv, val);
17540 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17541 LDKOpenChannel orig_conv;
17542 orig_conv.inner = (void*)(orig & (~1));
17543 orig_conv.is_owned = false;
17544 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
17545 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17546 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17547 uint64_t ret_ref = (uint64_t)ret_var.inner;
17548 if (ret_var.is_owned) {
17554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17555 LDKAcceptChannel this_obj_conv;
17556 this_obj_conv.inner = (void*)(this_obj & (~1));
17557 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17558 AcceptChannel_free(this_obj_conv);
17561 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17562 LDKAcceptChannel this_ptr_conv;
17563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17564 this_ptr_conv.is_owned = false;
17565 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17566 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
17570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17571 LDKAcceptChannel this_ptr_conv;
17572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17573 this_ptr_conv.is_owned = false;
17574 LDKThirtyTwoBytes val_ref;
17575 CHECK((*env)->GetArrayLength(env, val) == 32);
17576 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17577 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
17580 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17581 LDKAcceptChannel this_ptr_conv;
17582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17583 this_ptr_conv.is_owned = false;
17584 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
17588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17589 LDKAcceptChannel this_ptr_conv;
17590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17591 this_ptr_conv.is_owned = false;
17592 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
17595 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) {
17596 LDKAcceptChannel this_ptr_conv;
17597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17598 this_ptr_conv.is_owned = false;
17599 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
17603 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) {
17604 LDKAcceptChannel this_ptr_conv;
17605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17606 this_ptr_conv.is_owned = false;
17607 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
17610 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
17611 LDKAcceptChannel this_ptr_conv;
17612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17613 this_ptr_conv.is_owned = false;
17614 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
17618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17619 LDKAcceptChannel this_ptr_conv;
17620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17621 this_ptr_conv.is_owned = false;
17622 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
17625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
17626 LDKAcceptChannel this_ptr_conv;
17627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17628 this_ptr_conv.is_owned = false;
17629 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
17633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
17634 LDKAcceptChannel this_ptr_conv;
17635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17636 this_ptr_conv.is_owned = false;
17637 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
17640 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
17641 LDKAcceptChannel this_ptr_conv;
17642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17643 this_ptr_conv.is_owned = false;
17644 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
17648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
17649 LDKAcceptChannel this_ptr_conv;
17650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17651 this_ptr_conv.is_owned = false;
17652 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
17655 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
17656 LDKAcceptChannel this_ptr_conv;
17657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17658 this_ptr_conv.is_owned = false;
17659 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
17663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17664 LDKAcceptChannel this_ptr_conv;
17665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17666 this_ptr_conv.is_owned = false;
17667 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
17670 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
17671 LDKAcceptChannel this_ptr_conv;
17672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17673 this_ptr_conv.is_owned = false;
17674 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
17678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17679 LDKAcceptChannel this_ptr_conv;
17680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17681 this_ptr_conv.is_owned = false;
17682 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
17685 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
17686 LDKAcceptChannel this_ptr_conv;
17687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17688 this_ptr_conv.is_owned = false;
17689 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17690 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
17694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17695 LDKAcceptChannel this_ptr_conv;
17696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17697 this_ptr_conv.is_owned = false;
17698 LDKPublicKey val_ref;
17699 CHECK((*env)->GetArrayLength(env, val) == 33);
17700 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17701 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
17704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17705 LDKAcceptChannel this_ptr_conv;
17706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17707 this_ptr_conv.is_owned = false;
17708 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17709 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
17713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17714 LDKAcceptChannel this_ptr_conv;
17715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17716 this_ptr_conv.is_owned = false;
17717 LDKPublicKey val_ref;
17718 CHECK((*env)->GetArrayLength(env, val) == 33);
17719 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17720 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
17723 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17724 LDKAcceptChannel this_ptr_conv;
17725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17726 this_ptr_conv.is_owned = false;
17727 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17728 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
17732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17733 LDKAcceptChannel this_ptr_conv;
17734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17735 this_ptr_conv.is_owned = false;
17736 LDKPublicKey val_ref;
17737 CHECK((*env)->GetArrayLength(env, val) == 33);
17738 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17739 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
17742 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17743 LDKAcceptChannel this_ptr_conv;
17744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17745 this_ptr_conv.is_owned = false;
17746 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17747 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
17751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17752 LDKAcceptChannel this_ptr_conv;
17753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17754 this_ptr_conv.is_owned = false;
17755 LDKPublicKey val_ref;
17756 CHECK((*env)->GetArrayLength(env, val) == 33);
17757 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17758 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
17761 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
17762 LDKAcceptChannel this_ptr_conv;
17763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17764 this_ptr_conv.is_owned = false;
17765 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17766 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
17770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17771 LDKAcceptChannel this_ptr_conv;
17772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17773 this_ptr_conv.is_owned = false;
17774 LDKPublicKey val_ref;
17775 CHECK((*env)->GetArrayLength(env, val) == 33);
17776 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17777 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
17780 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
17781 LDKAcceptChannel this_ptr_conv;
17782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17783 this_ptr_conv.is_owned = false;
17784 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
17785 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
17789 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) {
17790 LDKAcceptChannel this_ptr_conv;
17791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17792 this_ptr_conv.is_owned = false;
17793 LDKPublicKey val_ref;
17794 CHECK((*env)->GetArrayLength(env, val) == 33);
17795 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
17796 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
17799 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17800 LDKAcceptChannel orig_conv;
17801 orig_conv.inner = (void*)(orig & (~1));
17802 orig_conv.is_owned = false;
17803 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
17804 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17805 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17806 uint64_t ret_ref = (uint64_t)ret_var.inner;
17807 if (ret_var.is_owned) {
17813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17814 LDKFundingCreated this_obj_conv;
17815 this_obj_conv.inner = (void*)(this_obj & (~1));
17816 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17817 FundingCreated_free(this_obj_conv);
17820 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17821 LDKFundingCreated this_ptr_conv;
17822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17823 this_ptr_conv.is_owned = false;
17824 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17825 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
17829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17830 LDKFundingCreated this_ptr_conv;
17831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17832 this_ptr_conv.is_owned = false;
17833 LDKThirtyTwoBytes val_ref;
17834 CHECK((*env)->GetArrayLength(env, val) == 32);
17835 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17836 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
17839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
17840 LDKFundingCreated this_ptr_conv;
17841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17842 this_ptr_conv.is_owned = false;
17843 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17844 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
17848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17849 LDKFundingCreated this_ptr_conv;
17850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17851 this_ptr_conv.is_owned = false;
17852 LDKThirtyTwoBytes val_ref;
17853 CHECK((*env)->GetArrayLength(env, val) == 32);
17854 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17855 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
17858 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
17859 LDKFundingCreated this_ptr_conv;
17860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17861 this_ptr_conv.is_owned = false;
17862 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
17866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
17867 LDKFundingCreated this_ptr_conv;
17868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17869 this_ptr_conv.is_owned = false;
17870 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
17873 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17874 LDKFundingCreated this_ptr_conv;
17875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17876 this_ptr_conv.is_owned = false;
17877 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17878 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
17882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17883 LDKFundingCreated this_ptr_conv;
17884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17885 this_ptr_conv.is_owned = false;
17886 LDKSignature val_ref;
17887 CHECK((*env)->GetArrayLength(env, val) == 64);
17888 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17889 FundingCreated_set_signature(&this_ptr_conv, val_ref);
17892 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) {
17893 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
17894 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
17895 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
17896 LDKThirtyTwoBytes funding_txid_arg_ref;
17897 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
17898 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
17899 LDKSignature signature_arg_ref;
17900 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17901 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17902 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
17903 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17904 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17905 uint64_t ret_ref = (uint64_t)ret_var.inner;
17906 if (ret_var.is_owned) {
17912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17913 LDKFundingCreated orig_conv;
17914 orig_conv.inner = (void*)(orig & (~1));
17915 orig_conv.is_owned = false;
17916 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
17917 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17918 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17919 uint64_t ret_ref = (uint64_t)ret_var.inner;
17920 if (ret_var.is_owned) {
17926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
17927 LDKFundingSigned this_obj_conv;
17928 this_obj_conv.inner = (void*)(this_obj & (~1));
17929 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
17930 FundingSigned_free(this_obj_conv);
17933 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
17934 LDKFundingSigned this_ptr_conv;
17935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17936 this_ptr_conv.is_owned = false;
17937 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
17938 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
17942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17943 LDKFundingSigned this_ptr_conv;
17944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17945 this_ptr_conv.is_owned = false;
17946 LDKThirtyTwoBytes val_ref;
17947 CHECK((*env)->GetArrayLength(env, val) == 32);
17948 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
17949 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
17952 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
17953 LDKFundingSigned this_ptr_conv;
17954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17955 this_ptr_conv.is_owned = false;
17956 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
17957 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
17961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
17962 LDKFundingSigned this_ptr_conv;
17963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
17964 this_ptr_conv.is_owned = false;
17965 LDKSignature val_ref;
17966 CHECK((*env)->GetArrayLength(env, val) == 64);
17967 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
17968 FundingSigned_set_signature(&this_ptr_conv, val_ref);
17971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
17972 LDKThirtyTwoBytes channel_id_arg_ref;
17973 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
17974 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
17975 LDKSignature signature_arg_ref;
17976 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
17977 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
17978 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
17979 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17980 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17981 uint64_t ret_ref = (uint64_t)ret_var.inner;
17982 if (ret_var.is_owned) {
17988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
17989 LDKFundingSigned orig_conv;
17990 orig_conv.inner = (void*)(orig & (~1));
17991 orig_conv.is_owned = false;
17992 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
17993 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17994 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17995 uint64_t ret_ref = (uint64_t)ret_var.inner;
17996 if (ret_var.is_owned) {
18002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18003 LDKFundingLocked this_obj_conv;
18004 this_obj_conv.inner = (void*)(this_obj & (~1));
18005 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18006 FundingLocked_free(this_obj_conv);
18009 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18010 LDKFundingLocked this_ptr_conv;
18011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18012 this_ptr_conv.is_owned = false;
18013 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18014 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
18018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18019 LDKFundingLocked this_ptr_conv;
18020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18021 this_ptr_conv.is_owned = false;
18022 LDKThirtyTwoBytes val_ref;
18023 CHECK((*env)->GetArrayLength(env, val) == 32);
18024 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18025 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
18028 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18029 LDKFundingLocked this_ptr_conv;
18030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18031 this_ptr_conv.is_owned = false;
18032 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18033 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
18037 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) {
18038 LDKFundingLocked this_ptr_conv;
18039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18040 this_ptr_conv.is_owned = false;
18041 LDKPublicKey val_ref;
18042 CHECK((*env)->GetArrayLength(env, val) == 33);
18043 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18044 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18047 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) {
18048 LDKThirtyTwoBytes channel_id_arg_ref;
18049 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18050 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18051 LDKPublicKey next_per_commitment_point_arg_ref;
18052 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
18053 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
18054 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
18055 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18056 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18057 uint64_t ret_ref = (uint64_t)ret_var.inner;
18058 if (ret_var.is_owned) {
18064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18065 LDKFundingLocked orig_conv;
18066 orig_conv.inner = (void*)(orig & (~1));
18067 orig_conv.is_owned = false;
18068 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
18069 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18070 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18071 uint64_t ret_ref = (uint64_t)ret_var.inner;
18072 if (ret_var.is_owned) {
18078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18079 LDKShutdown this_obj_conv;
18080 this_obj_conv.inner = (void*)(this_obj & (~1));
18081 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18082 Shutdown_free(this_obj_conv);
18085 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18086 LDKShutdown this_ptr_conv;
18087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18088 this_ptr_conv.is_owned = false;
18089 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18090 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
18094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18095 LDKShutdown this_ptr_conv;
18096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18097 this_ptr_conv.is_owned = false;
18098 LDKThirtyTwoBytes val_ref;
18099 CHECK((*env)->GetArrayLength(env, val) == 32);
18100 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18101 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
18104 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
18105 LDKShutdown this_ptr_conv;
18106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18107 this_ptr_conv.is_owned = false;
18108 LDKu8slice ret_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
18109 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
18110 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
18114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18115 LDKShutdown this_ptr_conv;
18116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18117 this_ptr_conv.is_owned = false;
18118 LDKCVec_u8Z val_ref;
18119 val_ref.datalen = (*env)->GetArrayLength(env, val);
18120 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
18121 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
18122 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
18125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
18126 LDKThirtyTwoBytes channel_id_arg_ref;
18127 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18128 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18129 LDKCVec_u8Z scriptpubkey_arg_ref;
18130 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
18131 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
18132 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
18133 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
18134 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18135 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18136 uint64_t ret_ref = (uint64_t)ret_var.inner;
18137 if (ret_var.is_owned) {
18143 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18144 LDKShutdown orig_conv;
18145 orig_conv.inner = (void*)(orig & (~1));
18146 orig_conv.is_owned = false;
18147 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
18148 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18149 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18150 uint64_t ret_ref = (uint64_t)ret_var.inner;
18151 if (ret_var.is_owned) {
18157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18158 LDKClosingSigned this_obj_conv;
18159 this_obj_conv.inner = (void*)(this_obj & (~1));
18160 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18161 ClosingSigned_free(this_obj_conv);
18164 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18165 LDKClosingSigned this_ptr_conv;
18166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18167 this_ptr_conv.is_owned = false;
18168 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18169 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
18173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18174 LDKClosingSigned this_ptr_conv;
18175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18176 this_ptr_conv.is_owned = false;
18177 LDKThirtyTwoBytes val_ref;
18178 CHECK((*env)->GetArrayLength(env, val) == 32);
18179 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18180 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
18183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
18184 LDKClosingSigned this_ptr_conv;
18185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18186 this_ptr_conv.is_owned = false;
18187 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
18191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18192 LDKClosingSigned this_ptr_conv;
18193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18194 this_ptr_conv.is_owned = false;
18195 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
18198 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18199 LDKClosingSigned this_ptr_conv;
18200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18201 this_ptr_conv.is_owned = false;
18202 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18203 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
18207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18208 LDKClosingSigned this_ptr_conv;
18209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18210 this_ptr_conv.is_owned = false;
18211 LDKSignature val_ref;
18212 CHECK((*env)->GetArrayLength(env, val) == 64);
18213 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18214 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
18217 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) {
18218 LDKThirtyTwoBytes channel_id_arg_ref;
18219 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18220 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18221 LDKSignature signature_arg_ref;
18222 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18223 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18224 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
18225 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18226 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18227 uint64_t ret_ref = (uint64_t)ret_var.inner;
18228 if (ret_var.is_owned) {
18234 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18235 LDKClosingSigned orig_conv;
18236 orig_conv.inner = (void*)(orig & (~1));
18237 orig_conv.is_owned = false;
18238 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
18239 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18240 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18241 uint64_t ret_ref = (uint64_t)ret_var.inner;
18242 if (ret_var.is_owned) {
18248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18249 LDKUpdateAddHTLC this_obj_conv;
18250 this_obj_conv.inner = (void*)(this_obj & (~1));
18251 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18252 UpdateAddHTLC_free(this_obj_conv);
18255 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18256 LDKUpdateAddHTLC this_ptr_conv;
18257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18258 this_ptr_conv.is_owned = false;
18259 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18260 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
18264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18265 LDKUpdateAddHTLC this_ptr_conv;
18266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18267 this_ptr_conv.is_owned = false;
18268 LDKThirtyTwoBytes val_ref;
18269 CHECK((*env)->GetArrayLength(env, val) == 32);
18270 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18271 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
18274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18275 LDKUpdateAddHTLC this_ptr_conv;
18276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18277 this_ptr_conv.is_owned = false;
18278 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
18282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18283 LDKUpdateAddHTLC this_ptr_conv;
18284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18285 this_ptr_conv.is_owned = false;
18286 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
18289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
18290 LDKUpdateAddHTLC this_ptr_conv;
18291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18292 this_ptr_conv.is_owned = false;
18293 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
18297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18298 LDKUpdateAddHTLC this_ptr_conv;
18299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18300 this_ptr_conv.is_owned = false;
18301 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
18304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
18305 LDKUpdateAddHTLC this_ptr_conv;
18306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18307 this_ptr_conv.is_owned = false;
18308 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18309 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
18313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18314 LDKUpdateAddHTLC this_ptr_conv;
18315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18316 this_ptr_conv.is_owned = false;
18317 LDKThirtyTwoBytes val_ref;
18318 CHECK((*env)->GetArrayLength(env, val) == 32);
18319 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18320 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
18323 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
18324 LDKUpdateAddHTLC this_ptr_conv;
18325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18326 this_ptr_conv.is_owned = false;
18327 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
18331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18332 LDKUpdateAddHTLC this_ptr_conv;
18333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18334 this_ptr_conv.is_owned = false;
18335 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
18338 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18339 LDKUpdateAddHTLC orig_conv;
18340 orig_conv.inner = (void*)(orig & (~1));
18341 orig_conv.is_owned = false;
18342 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
18343 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18344 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18345 uint64_t ret_ref = (uint64_t)ret_var.inner;
18346 if (ret_var.is_owned) {
18352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18353 LDKUpdateFulfillHTLC this_obj_conv;
18354 this_obj_conv.inner = (void*)(this_obj & (~1));
18355 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18356 UpdateFulfillHTLC_free(this_obj_conv);
18359 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18360 LDKUpdateFulfillHTLC this_ptr_conv;
18361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18362 this_ptr_conv.is_owned = false;
18363 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18364 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
18368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18369 LDKUpdateFulfillHTLC this_ptr_conv;
18370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18371 this_ptr_conv.is_owned = false;
18372 LDKThirtyTwoBytes val_ref;
18373 CHECK((*env)->GetArrayLength(env, val) == 32);
18374 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18375 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
18378 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18379 LDKUpdateFulfillHTLC this_ptr_conv;
18380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18381 this_ptr_conv.is_owned = false;
18382 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
18386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18387 LDKUpdateFulfillHTLC this_ptr_conv;
18388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18389 this_ptr_conv.is_owned = false;
18390 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
18393 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
18394 LDKUpdateFulfillHTLC this_ptr_conv;
18395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18396 this_ptr_conv.is_owned = false;
18397 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18398 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
18402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18403 LDKUpdateFulfillHTLC this_ptr_conv;
18404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18405 this_ptr_conv.is_owned = false;
18406 LDKThirtyTwoBytes val_ref;
18407 CHECK((*env)->GetArrayLength(env, val) == 32);
18408 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18409 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
18412 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) {
18413 LDKThirtyTwoBytes channel_id_arg_ref;
18414 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18415 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18416 LDKThirtyTwoBytes payment_preimage_arg_ref;
18417 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
18418 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
18419 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
18420 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18421 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18422 uint64_t ret_ref = (uint64_t)ret_var.inner;
18423 if (ret_var.is_owned) {
18429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18430 LDKUpdateFulfillHTLC orig_conv;
18431 orig_conv.inner = (void*)(orig & (~1));
18432 orig_conv.is_owned = false;
18433 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
18434 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18435 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18436 uint64_t ret_ref = (uint64_t)ret_var.inner;
18437 if (ret_var.is_owned) {
18443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18444 LDKUpdateFailHTLC this_obj_conv;
18445 this_obj_conv.inner = (void*)(this_obj & (~1));
18446 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18447 UpdateFailHTLC_free(this_obj_conv);
18450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18451 LDKUpdateFailHTLC this_ptr_conv;
18452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18453 this_ptr_conv.is_owned = false;
18454 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18455 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
18459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18460 LDKUpdateFailHTLC this_ptr_conv;
18461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18462 this_ptr_conv.is_owned = false;
18463 LDKThirtyTwoBytes val_ref;
18464 CHECK((*env)->GetArrayLength(env, val) == 32);
18465 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18466 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
18469 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18470 LDKUpdateFailHTLC this_ptr_conv;
18471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18472 this_ptr_conv.is_owned = false;
18473 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
18477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18478 LDKUpdateFailHTLC this_ptr_conv;
18479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18480 this_ptr_conv.is_owned = false;
18481 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
18484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18485 LDKUpdateFailHTLC orig_conv;
18486 orig_conv.inner = (void*)(orig & (~1));
18487 orig_conv.is_owned = false;
18488 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
18489 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18490 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18491 uint64_t ret_ref = (uint64_t)ret_var.inner;
18492 if (ret_var.is_owned) {
18498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18499 LDKUpdateFailMalformedHTLC this_obj_conv;
18500 this_obj_conv.inner = (void*)(this_obj & (~1));
18501 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18502 UpdateFailMalformedHTLC_free(this_obj_conv);
18505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18506 LDKUpdateFailMalformedHTLC this_ptr_conv;
18507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18508 this_ptr_conv.is_owned = false;
18509 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
18514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18515 LDKUpdateFailMalformedHTLC this_ptr_conv;
18516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18517 this_ptr_conv.is_owned = false;
18518 LDKThirtyTwoBytes val_ref;
18519 CHECK((*env)->GetArrayLength(env, val) == 32);
18520 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18521 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
18524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18525 LDKUpdateFailMalformedHTLC this_ptr_conv;
18526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18527 this_ptr_conv.is_owned = false;
18528 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
18532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
18533 LDKUpdateFailMalformedHTLC this_ptr_conv;
18534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18535 this_ptr_conv.is_owned = false;
18536 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
18539 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
18540 LDKUpdateFailMalformedHTLC this_ptr_conv;
18541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18542 this_ptr_conv.is_owned = false;
18543 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
18547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
18548 LDKUpdateFailMalformedHTLC this_ptr_conv;
18549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18550 this_ptr_conv.is_owned = false;
18551 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
18554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18555 LDKUpdateFailMalformedHTLC orig_conv;
18556 orig_conv.inner = (void*)(orig & (~1));
18557 orig_conv.is_owned = false;
18558 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
18559 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18560 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18561 uint64_t ret_ref = (uint64_t)ret_var.inner;
18562 if (ret_var.is_owned) {
18568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18569 LDKCommitmentSigned this_obj_conv;
18570 this_obj_conv.inner = (void*)(this_obj & (~1));
18571 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18572 CommitmentSigned_free(this_obj_conv);
18575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18576 LDKCommitmentSigned this_ptr_conv;
18577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18578 this_ptr_conv.is_owned = false;
18579 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18580 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
18584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18585 LDKCommitmentSigned this_ptr_conv;
18586 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18587 this_ptr_conv.is_owned = false;
18588 LDKThirtyTwoBytes val_ref;
18589 CHECK((*env)->GetArrayLength(env, val) == 32);
18590 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18591 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
18594 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
18595 LDKCommitmentSigned this_ptr_conv;
18596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18597 this_ptr_conv.is_owned = false;
18598 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
18599 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
18603 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18604 LDKCommitmentSigned this_ptr_conv;
18605 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18606 this_ptr_conv.is_owned = false;
18607 LDKSignature val_ref;
18608 CHECK((*env)->GetArrayLength(env, val) == 64);
18609 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
18610 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
18613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
18614 LDKCommitmentSigned this_ptr_conv;
18615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18616 this_ptr_conv.is_owned = false;
18617 LDKCVec_SignatureZ val_constr;
18618 val_constr.datalen = (*env)->GetArrayLength(env, val);
18619 if (val_constr.datalen > 0)
18620 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18622 val_constr.data = NULL;
18623 for (size_t i = 0; i < val_constr.datalen; i++) {
18624 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
18625 LDKSignature val_conv_8_ref;
18626 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
18627 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
18628 val_constr.data[i] = val_conv_8_ref;
18630 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
18633 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) {
18634 LDKThirtyTwoBytes channel_id_arg_ref;
18635 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18636 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18637 LDKSignature signature_arg_ref;
18638 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
18639 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
18640 LDKCVec_SignatureZ htlc_signatures_arg_constr;
18641 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
18642 if (htlc_signatures_arg_constr.datalen > 0)
18643 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
18645 htlc_signatures_arg_constr.data = NULL;
18646 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
18647 int8_tArray htlc_signatures_arg_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
18648 LDKSignature htlc_signatures_arg_conv_8_ref;
18649 CHECK((*env)->GetArrayLength(env, htlc_signatures_arg_conv_8) == 64);
18650 (*env)->GetByteArrayRegion(env, htlc_signatures_arg_conv_8, 0, 64, htlc_signatures_arg_conv_8_ref.compact_form);
18651 htlc_signatures_arg_constr.data[i] = htlc_signatures_arg_conv_8_ref;
18653 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
18654 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18655 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18656 uint64_t ret_ref = (uint64_t)ret_var.inner;
18657 if (ret_var.is_owned) {
18663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18664 LDKCommitmentSigned orig_conv;
18665 orig_conv.inner = (void*)(orig & (~1));
18666 orig_conv.is_owned = false;
18667 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
18668 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18669 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18670 uint64_t ret_ref = (uint64_t)ret_var.inner;
18671 if (ret_var.is_owned) {
18677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18678 LDKRevokeAndACK this_obj_conv;
18679 this_obj_conv.inner = (void*)(this_obj & (~1));
18680 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18681 RevokeAndACK_free(this_obj_conv);
18684 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18685 LDKRevokeAndACK this_ptr_conv;
18686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18687 this_ptr_conv.is_owned = false;
18688 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18689 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
18693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18694 LDKRevokeAndACK this_ptr_conv;
18695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18696 this_ptr_conv.is_owned = false;
18697 LDKThirtyTwoBytes val_ref;
18698 CHECK((*env)->GetArrayLength(env, val) == 32);
18699 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18700 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
18703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18704 LDKRevokeAndACK this_ptr_conv;
18705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18706 this_ptr_conv.is_owned = false;
18707 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18708 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
18712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18713 LDKRevokeAndACK this_ptr_conv;
18714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18715 this_ptr_conv.is_owned = false;
18716 LDKThirtyTwoBytes val_ref;
18717 CHECK((*env)->GetArrayLength(env, val) == 32);
18718 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18719 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
18722 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18723 LDKRevokeAndACK this_ptr_conv;
18724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18725 this_ptr_conv.is_owned = false;
18726 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18727 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
18731 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) {
18732 LDKRevokeAndACK this_ptr_conv;
18733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18734 this_ptr_conv.is_owned = false;
18735 LDKPublicKey val_ref;
18736 CHECK((*env)->GetArrayLength(env, val) == 33);
18737 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18738 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
18741 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) {
18742 LDKThirtyTwoBytes channel_id_arg_ref;
18743 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18744 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18745 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
18746 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
18747 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
18748 LDKPublicKey next_per_commitment_point_arg_ref;
18749 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
18750 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
18751 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
18752 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18753 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18754 uint64_t ret_ref = (uint64_t)ret_var.inner;
18755 if (ret_var.is_owned) {
18761 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18762 LDKRevokeAndACK orig_conv;
18763 orig_conv.inner = (void*)(orig & (~1));
18764 orig_conv.is_owned = false;
18765 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
18766 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18767 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18768 uint64_t ret_ref = (uint64_t)ret_var.inner;
18769 if (ret_var.is_owned) {
18775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18776 LDKUpdateFee this_obj_conv;
18777 this_obj_conv.inner = (void*)(this_obj & (~1));
18778 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18779 UpdateFee_free(this_obj_conv);
18782 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18783 LDKUpdateFee this_ptr_conv;
18784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18785 this_ptr_conv.is_owned = false;
18786 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18787 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
18791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18792 LDKUpdateFee this_ptr_conv;
18793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18794 this_ptr_conv.is_owned = false;
18795 LDKThirtyTwoBytes val_ref;
18796 CHECK((*env)->GetArrayLength(env, val) == 32);
18797 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18798 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
18801 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
18802 LDKUpdateFee this_ptr_conv;
18803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18804 this_ptr_conv.is_owned = false;
18805 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
18809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
18810 LDKUpdateFee this_ptr_conv;
18811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18812 this_ptr_conv.is_owned = false;
18813 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
18816 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) {
18817 LDKThirtyTwoBytes channel_id_arg_ref;
18818 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
18819 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
18820 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
18821 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18822 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18823 uint64_t ret_ref = (uint64_t)ret_var.inner;
18824 if (ret_var.is_owned) {
18830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18831 LDKUpdateFee orig_conv;
18832 orig_conv.inner = (void*)(orig & (~1));
18833 orig_conv.is_owned = false;
18834 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
18835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18837 uint64_t ret_ref = (uint64_t)ret_var.inner;
18838 if (ret_var.is_owned) {
18844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18845 LDKDataLossProtect this_obj_conv;
18846 this_obj_conv.inner = (void*)(this_obj & (~1));
18847 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18848 DataLossProtect_free(this_obj_conv);
18851 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
18852 LDKDataLossProtect this_ptr_conv;
18853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18854 this_ptr_conv.is_owned = false;
18855 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18856 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
18860 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) {
18861 LDKDataLossProtect this_ptr_conv;
18862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18863 this_ptr_conv.is_owned = false;
18864 LDKThirtyTwoBytes val_ref;
18865 CHECK((*env)->GetArrayLength(env, val) == 32);
18866 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18867 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
18870 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
18871 LDKDataLossProtect this_ptr_conv;
18872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18873 this_ptr_conv.is_owned = false;
18874 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
18875 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
18879 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) {
18880 LDKDataLossProtect this_ptr_conv;
18881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18882 this_ptr_conv.is_owned = false;
18883 LDKPublicKey val_ref;
18884 CHECK((*env)->GetArrayLength(env, val) == 33);
18885 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
18886 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
18889 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) {
18890 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
18891 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
18892 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
18893 LDKPublicKey my_current_per_commitment_point_arg_ref;
18894 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
18895 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
18896 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
18897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18899 uint64_t ret_ref = (uint64_t)ret_var.inner;
18900 if (ret_var.is_owned) {
18906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18907 LDKDataLossProtect orig_conv;
18908 orig_conv.inner = (void*)(orig & (~1));
18909 orig_conv.is_owned = false;
18910 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
18911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18913 uint64_t ret_ref = (uint64_t)ret_var.inner;
18914 if (ret_var.is_owned) {
18920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18921 LDKChannelReestablish this_obj_conv;
18922 this_obj_conv.inner = (void*)(this_obj & (~1));
18923 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18924 ChannelReestablish_free(this_obj_conv);
18927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18928 LDKChannelReestablish this_ptr_conv;
18929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18930 this_ptr_conv.is_owned = false;
18931 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
18932 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
18936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
18937 LDKChannelReestablish this_ptr_conv;
18938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18939 this_ptr_conv.is_owned = false;
18940 LDKThirtyTwoBytes val_ref;
18941 CHECK((*env)->GetArrayLength(env, val) == 32);
18942 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
18943 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
18946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18947 LDKChannelReestablish this_ptr_conv;
18948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18949 this_ptr_conv.is_owned = false;
18950 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
18954 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) {
18955 LDKChannelReestablish this_ptr_conv;
18956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18957 this_ptr_conv.is_owned = false;
18958 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
18961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
18962 LDKChannelReestablish this_ptr_conv;
18963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18964 this_ptr_conv.is_owned = false;
18965 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
18969 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) {
18970 LDKChannelReestablish this_ptr_conv;
18971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
18972 this_ptr_conv.is_owned = false;
18973 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
18976 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
18977 LDKChannelReestablish orig_conv;
18978 orig_conv.inner = (void*)(orig & (~1));
18979 orig_conv.is_owned = false;
18980 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
18981 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
18982 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
18983 uint64_t ret_ref = (uint64_t)ret_var.inner;
18984 if (ret_var.is_owned) {
18990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
18991 LDKAnnouncementSignatures this_obj_conv;
18992 this_obj_conv.inner = (void*)(this_obj & (~1));
18993 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
18994 AnnouncementSignatures_free(this_obj_conv);
18997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
18998 LDKAnnouncementSignatures this_ptr_conv;
18999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19000 this_ptr_conv.is_owned = false;
19001 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19002 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
19006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19007 LDKAnnouncementSignatures this_ptr_conv;
19008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19009 this_ptr_conv.is_owned = false;
19010 LDKThirtyTwoBytes val_ref;
19011 CHECK((*env)->GetArrayLength(env, val) == 32);
19012 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19013 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
19016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19017 LDKAnnouncementSignatures this_ptr_conv;
19018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19019 this_ptr_conv.is_owned = false;
19020 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
19024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19025 LDKAnnouncementSignatures this_ptr_conv;
19026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19027 this_ptr_conv.is_owned = false;
19028 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
19031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19032 LDKAnnouncementSignatures this_ptr_conv;
19033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19034 this_ptr_conv.is_owned = false;
19035 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19036 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
19040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19041 LDKAnnouncementSignatures this_ptr_conv;
19042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19043 this_ptr_conv.is_owned = false;
19044 LDKSignature val_ref;
19045 CHECK((*env)->GetArrayLength(env, val) == 64);
19046 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19047 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
19050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19051 LDKAnnouncementSignatures this_ptr_conv;
19052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19053 this_ptr_conv.is_owned = false;
19054 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19055 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
19059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19060 LDKAnnouncementSignatures this_ptr_conv;
19061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19062 this_ptr_conv.is_owned = false;
19063 LDKSignature val_ref;
19064 CHECK((*env)->GetArrayLength(env, val) == 64);
19065 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19066 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
19069 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) {
19070 LDKThirtyTwoBytes channel_id_arg_ref;
19071 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
19072 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
19073 LDKSignature node_signature_arg_ref;
19074 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
19075 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
19076 LDKSignature bitcoin_signature_arg_ref;
19077 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
19078 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
19079 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
19080 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19081 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19082 uint64_t ret_ref = (uint64_t)ret_var.inner;
19083 if (ret_var.is_owned) {
19089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19090 LDKAnnouncementSignatures orig_conv;
19091 orig_conv.inner = (void*)(orig & (~1));
19092 orig_conv.is_owned = false;
19093 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
19094 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19095 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19096 uint64_t ret_ref = (uint64_t)ret_var.inner;
19097 if (ret_var.is_owned) {
19103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
19104 if ((this_ptr & 1) != 0) return;
19105 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)(((uint64_t)this_ptr) & ~1);
19106 FREE((void*)this_ptr);
19107 NetAddress_free(this_ptr_conv);
19110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19111 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
19112 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
19113 *ret_copy = NetAddress_clone(orig_conv);
19114 uint64_t ret_ref = (uint64_t)ret_copy;
19118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
19119 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
19120 LDKCVec_u8Z ret_var = NetAddress_write(obj_conv);
19121 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
19122 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
19123 CVec_u8Z_free(ret_var);
19127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19128 LDKu8slice ser_ref;
19129 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19130 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19131 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
19132 *ret_conv = Result_read(ser_ref);
19133 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19134 return (uint64_t)ret_conv;
19137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
19138 LDKu8slice ser_ref;
19139 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
19140 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
19141 LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
19142 *ret_conv = NetAddress_read(ser_ref);
19143 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
19144 return (uint64_t)ret_conv;
19147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19148 LDKUnsignedNodeAnnouncement this_obj_conv;
19149 this_obj_conv.inner = (void*)(this_obj & (~1));
19150 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19151 UnsignedNodeAnnouncement_free(this_obj_conv);
19154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19155 LDKUnsignedNodeAnnouncement this_ptr_conv;
19156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19157 this_ptr_conv.is_owned = false;
19158 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
19159 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19160 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19161 uint64_t ret_ref = (uint64_t)ret_var.inner;
19162 if (ret_var.is_owned) {
19168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19169 LDKUnsignedNodeAnnouncement this_ptr_conv;
19170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19171 this_ptr_conv.is_owned = false;
19172 LDKNodeFeatures val_conv;
19173 val_conv.inner = (void*)(val & (~1));
19174 val_conv.is_owned = (val & 1) || (val == 0);
19175 val_conv = NodeFeatures_clone(&val_conv);
19176 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
19179 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19180 LDKUnsignedNodeAnnouncement this_ptr_conv;
19181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19182 this_ptr_conv.is_owned = false;
19183 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
19187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19188 LDKUnsignedNodeAnnouncement this_ptr_conv;
19189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19190 this_ptr_conv.is_owned = false;
19191 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
19194 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19195 LDKUnsignedNodeAnnouncement this_ptr_conv;
19196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19197 this_ptr_conv.is_owned = false;
19198 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19199 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
19203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19204 LDKUnsignedNodeAnnouncement this_ptr_conv;
19205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19206 this_ptr_conv.is_owned = false;
19207 LDKPublicKey val_ref;
19208 CHECK((*env)->GetArrayLength(env, val) == 33);
19209 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19210 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
19213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
19214 LDKUnsignedNodeAnnouncement this_ptr_conv;
19215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19216 this_ptr_conv.is_owned = false;
19217 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
19218 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
19222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19223 LDKUnsignedNodeAnnouncement this_ptr_conv;
19224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19225 this_ptr_conv.is_owned = false;
19226 LDKThreeBytes val_ref;
19227 CHECK((*env)->GetArrayLength(env, val) == 3);
19228 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
19229 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
19232 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
19233 LDKUnsignedNodeAnnouncement this_ptr_conv;
19234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19235 this_ptr_conv.is_owned = false;
19236 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19237 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
19241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19242 LDKUnsignedNodeAnnouncement this_ptr_conv;
19243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19244 this_ptr_conv.is_owned = false;
19245 LDKThirtyTwoBytes val_ref;
19246 CHECK((*env)->GetArrayLength(env, val) == 32);
19247 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19248 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
19251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
19252 LDKUnsignedNodeAnnouncement this_ptr_conv;
19253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19254 this_ptr_conv.is_owned = false;
19255 LDKCVec_NetAddressZ val_constr;
19256 val_constr.datalen = (*env)->GetArrayLength(env, val);
19257 if (val_constr.datalen > 0)
19258 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
19260 val_constr.data = NULL;
19261 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
19262 for (size_t m = 0; m < val_constr.datalen; m++) {
19263 int64_t val_conv_12 = val_vals[m];
19264 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
19265 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
19266 val_constr.data[m] = val_conv_12_conv;
19268 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
19269 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
19272 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19273 LDKUnsignedNodeAnnouncement orig_conv;
19274 orig_conv.inner = (void*)(orig & (~1));
19275 orig_conv.is_owned = false;
19276 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
19277 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19278 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19279 uint64_t ret_ref = (uint64_t)ret_var.inner;
19280 if (ret_var.is_owned) {
19286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19287 LDKNodeAnnouncement this_obj_conv;
19288 this_obj_conv.inner = (void*)(this_obj & (~1));
19289 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19290 NodeAnnouncement_free(this_obj_conv);
19293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19294 LDKNodeAnnouncement this_ptr_conv;
19295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19296 this_ptr_conv.is_owned = false;
19297 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19298 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
19302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19303 LDKNodeAnnouncement this_ptr_conv;
19304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19305 this_ptr_conv.is_owned = false;
19306 LDKSignature val_ref;
19307 CHECK((*env)->GetArrayLength(env, val) == 64);
19308 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19309 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
19312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19313 LDKNodeAnnouncement this_ptr_conv;
19314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19315 this_ptr_conv.is_owned = false;
19316 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
19317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19319 uint64_t ret_ref = (uint64_t)ret_var.inner;
19320 if (ret_var.is_owned) {
19326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19327 LDKNodeAnnouncement this_ptr_conv;
19328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19329 this_ptr_conv.is_owned = false;
19330 LDKUnsignedNodeAnnouncement val_conv;
19331 val_conv.inner = (void*)(val & (~1));
19332 val_conv.is_owned = (val & 1) || (val == 0);
19333 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
19334 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
19337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19338 LDKSignature signature_arg_ref;
19339 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19340 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19341 LDKUnsignedNodeAnnouncement contents_arg_conv;
19342 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19343 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19344 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
19345 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
19346 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19347 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19348 uint64_t ret_ref = (uint64_t)ret_var.inner;
19349 if (ret_var.is_owned) {
19355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19356 LDKNodeAnnouncement orig_conv;
19357 orig_conv.inner = (void*)(orig & (~1));
19358 orig_conv.is_owned = false;
19359 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
19360 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19361 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19362 uint64_t ret_ref = (uint64_t)ret_var.inner;
19363 if (ret_var.is_owned) {
19369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19370 LDKUnsignedChannelAnnouncement this_obj_conv;
19371 this_obj_conv.inner = (void*)(this_obj & (~1));
19372 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19373 UnsignedChannelAnnouncement_free(this_obj_conv);
19376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
19377 LDKUnsignedChannelAnnouncement this_ptr_conv;
19378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19379 this_ptr_conv.is_owned = false;
19380 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
19381 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19382 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19383 uint64_t ret_ref = (uint64_t)ret_var.inner;
19384 if (ret_var.is_owned) {
19390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19391 LDKUnsignedChannelAnnouncement this_ptr_conv;
19392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19393 this_ptr_conv.is_owned = false;
19394 LDKChannelFeatures val_conv;
19395 val_conv.inner = (void*)(val & (~1));
19396 val_conv.is_owned = (val & 1) || (val == 0);
19397 val_conv = ChannelFeatures_clone(&val_conv);
19398 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
19401 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19402 LDKUnsignedChannelAnnouncement this_ptr_conv;
19403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19404 this_ptr_conv.is_owned = false;
19405 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19406 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
19410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19411 LDKUnsignedChannelAnnouncement this_ptr_conv;
19412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19413 this_ptr_conv.is_owned = false;
19414 LDKThirtyTwoBytes val_ref;
19415 CHECK((*env)->GetArrayLength(env, val) == 32);
19416 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19417 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
19420 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19421 LDKUnsignedChannelAnnouncement this_ptr_conv;
19422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19423 this_ptr_conv.is_owned = false;
19424 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
19428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19429 LDKUnsignedChannelAnnouncement this_ptr_conv;
19430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19431 this_ptr_conv.is_owned = false;
19432 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
19435 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19436 LDKUnsignedChannelAnnouncement this_ptr_conv;
19437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19438 this_ptr_conv.is_owned = false;
19439 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19440 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
19444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19445 LDKUnsignedChannelAnnouncement this_ptr_conv;
19446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19447 this_ptr_conv.is_owned = false;
19448 LDKPublicKey val_ref;
19449 CHECK((*env)->GetArrayLength(env, val) == 33);
19450 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19451 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
19454 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19455 LDKUnsignedChannelAnnouncement this_ptr_conv;
19456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19457 this_ptr_conv.is_owned = false;
19458 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19459 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
19463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19464 LDKUnsignedChannelAnnouncement this_ptr_conv;
19465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19466 this_ptr_conv.is_owned = false;
19467 LDKPublicKey val_ref;
19468 CHECK((*env)->GetArrayLength(env, val) == 33);
19469 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19470 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
19473 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19474 LDKUnsignedChannelAnnouncement this_ptr_conv;
19475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19476 this_ptr_conv.is_owned = false;
19477 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19478 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
19482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19483 LDKUnsignedChannelAnnouncement this_ptr_conv;
19484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19485 this_ptr_conv.is_owned = false;
19486 LDKPublicKey val_ref;
19487 CHECK((*env)->GetArrayLength(env, val) == 33);
19488 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19489 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
19492 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19493 LDKUnsignedChannelAnnouncement this_ptr_conv;
19494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19495 this_ptr_conv.is_owned = false;
19496 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
19497 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
19501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19502 LDKUnsignedChannelAnnouncement this_ptr_conv;
19503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19504 this_ptr_conv.is_owned = false;
19505 LDKPublicKey val_ref;
19506 CHECK((*env)->GetArrayLength(env, val) == 33);
19507 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
19508 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
19511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19512 LDKUnsignedChannelAnnouncement orig_conv;
19513 orig_conv.inner = (void*)(orig & (~1));
19514 orig_conv.is_owned = false;
19515 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
19516 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19517 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19518 uint64_t ret_ref = (uint64_t)ret_var.inner;
19519 if (ret_var.is_owned) {
19525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19526 LDKChannelAnnouncement this_obj_conv;
19527 this_obj_conv.inner = (void*)(this_obj & (~1));
19528 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19529 ChannelAnnouncement_free(this_obj_conv);
19532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19533 LDKChannelAnnouncement this_ptr_conv;
19534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19535 this_ptr_conv.is_owned = false;
19536 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19537 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
19541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19542 LDKChannelAnnouncement this_ptr_conv;
19543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19544 this_ptr_conv.is_owned = false;
19545 LDKSignature val_ref;
19546 CHECK((*env)->GetArrayLength(env, val) == 64);
19547 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19548 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
19551 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19552 LDKChannelAnnouncement this_ptr_conv;
19553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19554 this_ptr_conv.is_owned = false;
19555 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19556 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
19560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19561 LDKChannelAnnouncement this_ptr_conv;
19562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19563 this_ptr_conv.is_owned = false;
19564 LDKSignature val_ref;
19565 CHECK((*env)->GetArrayLength(env, val) == 64);
19566 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19567 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
19570 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
19571 LDKChannelAnnouncement this_ptr_conv;
19572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19573 this_ptr_conv.is_owned = false;
19574 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19575 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
19579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19580 LDKChannelAnnouncement this_ptr_conv;
19581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19582 this_ptr_conv.is_owned = false;
19583 LDKSignature val_ref;
19584 CHECK((*env)->GetArrayLength(env, val) == 64);
19585 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19586 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
19589 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
19590 LDKChannelAnnouncement this_ptr_conv;
19591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19592 this_ptr_conv.is_owned = false;
19593 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19594 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
19598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19599 LDKChannelAnnouncement this_ptr_conv;
19600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19601 this_ptr_conv.is_owned = false;
19602 LDKSignature val_ref;
19603 CHECK((*env)->GetArrayLength(env, val) == 64);
19604 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19605 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
19608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19609 LDKChannelAnnouncement this_ptr_conv;
19610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19611 this_ptr_conv.is_owned = false;
19612 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
19613 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19614 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19615 uint64_t ret_ref = (uint64_t)ret_var.inner;
19616 if (ret_var.is_owned) {
19622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19623 LDKChannelAnnouncement this_ptr_conv;
19624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19625 this_ptr_conv.is_owned = false;
19626 LDKUnsignedChannelAnnouncement val_conv;
19627 val_conv.inner = (void*)(val & (~1));
19628 val_conv.is_owned = (val & 1) || (val == 0);
19629 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
19630 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
19633 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) {
19634 LDKSignature node_signature_1_arg_ref;
19635 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
19636 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
19637 LDKSignature node_signature_2_arg_ref;
19638 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
19639 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
19640 LDKSignature bitcoin_signature_1_arg_ref;
19641 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
19642 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
19643 LDKSignature bitcoin_signature_2_arg_ref;
19644 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
19645 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
19646 LDKUnsignedChannelAnnouncement contents_arg_conv;
19647 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19648 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19649 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
19650 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);
19651 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19652 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19653 uint64_t ret_ref = (uint64_t)ret_var.inner;
19654 if (ret_var.is_owned) {
19660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19661 LDKChannelAnnouncement orig_conv;
19662 orig_conv.inner = (void*)(orig & (~1));
19663 orig_conv.is_owned = false;
19664 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
19665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19667 uint64_t ret_ref = (uint64_t)ret_var.inner;
19668 if (ret_var.is_owned) {
19674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19675 LDKUnsignedChannelUpdate this_obj_conv;
19676 this_obj_conv.inner = (void*)(this_obj & (~1));
19677 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19678 UnsignedChannelUpdate_free(this_obj_conv);
19681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19682 LDKUnsignedChannelUpdate this_ptr_conv;
19683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19684 this_ptr_conv.is_owned = false;
19685 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19686 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
19690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19691 LDKUnsignedChannelUpdate this_ptr_conv;
19692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19693 this_ptr_conv.is_owned = false;
19694 LDKThirtyTwoBytes val_ref;
19695 CHECK((*env)->GetArrayLength(env, val) == 32);
19696 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19697 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
19700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
19701 LDKUnsignedChannelUpdate this_ptr_conv;
19702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19703 this_ptr_conv.is_owned = false;
19704 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
19708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19709 LDKUnsignedChannelUpdate this_ptr_conv;
19710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19711 this_ptr_conv.is_owned = false;
19712 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
19715 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
19716 LDKUnsignedChannelUpdate this_ptr_conv;
19717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19718 this_ptr_conv.is_owned = false;
19719 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
19723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19724 LDKUnsignedChannelUpdate this_ptr_conv;
19725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19726 this_ptr_conv.is_owned = false;
19727 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
19730 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
19731 LDKUnsignedChannelUpdate this_ptr_conv;
19732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19733 this_ptr_conv.is_owned = false;
19734 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
19738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
19739 LDKUnsignedChannelUpdate this_ptr_conv;
19740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19741 this_ptr_conv.is_owned = false;
19742 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
19745 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
19746 LDKUnsignedChannelUpdate this_ptr_conv;
19747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19748 this_ptr_conv.is_owned = false;
19749 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
19753 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
19754 LDKUnsignedChannelUpdate this_ptr_conv;
19755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19756 this_ptr_conv.is_owned = false;
19757 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
19760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19761 LDKUnsignedChannelUpdate this_ptr_conv;
19762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19763 this_ptr_conv.is_owned = false;
19764 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
19768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19769 LDKUnsignedChannelUpdate this_ptr_conv;
19770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19771 this_ptr_conv.is_owned = false;
19772 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
19775 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
19776 LDKUnsignedChannelUpdate this_ptr_conv;
19777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19778 this_ptr_conv.is_owned = false;
19779 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
19783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19784 LDKUnsignedChannelUpdate this_ptr_conv;
19785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19786 this_ptr_conv.is_owned = false;
19787 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
19790 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
19791 LDKUnsignedChannelUpdate this_ptr_conv;
19792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19793 this_ptr_conv.is_owned = false;
19794 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
19798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19799 LDKUnsignedChannelUpdate this_ptr_conv;
19800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19801 this_ptr_conv.is_owned = false;
19802 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
19805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19806 LDKUnsignedChannelUpdate orig_conv;
19807 orig_conv.inner = (void*)(orig & (~1));
19808 orig_conv.is_owned = false;
19809 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
19810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19812 uint64_t ret_ref = (uint64_t)ret_var.inner;
19813 if (ret_var.is_owned) {
19819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19820 LDKChannelUpdate this_obj_conv;
19821 this_obj_conv.inner = (void*)(this_obj & (~1));
19822 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19823 ChannelUpdate_free(this_obj_conv);
19826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
19827 LDKChannelUpdate this_ptr_conv;
19828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19829 this_ptr_conv.is_owned = false;
19830 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
19831 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
19835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19836 LDKChannelUpdate this_ptr_conv;
19837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19838 this_ptr_conv.is_owned = false;
19839 LDKSignature val_ref;
19840 CHECK((*env)->GetArrayLength(env, val) == 64);
19841 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
19842 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
19845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
19846 LDKChannelUpdate this_ptr_conv;
19847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19848 this_ptr_conv.is_owned = false;
19849 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
19850 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19851 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19852 uint64_t ret_ref = (uint64_t)ret_var.inner;
19853 if (ret_var.is_owned) {
19859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
19860 LDKChannelUpdate this_ptr_conv;
19861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19862 this_ptr_conv.is_owned = false;
19863 LDKUnsignedChannelUpdate val_conv;
19864 val_conv.inner = (void*)(val & (~1));
19865 val_conv.is_owned = (val & 1) || (val == 0);
19866 val_conv = UnsignedChannelUpdate_clone(&val_conv);
19867 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
19870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
19871 LDKSignature signature_arg_ref;
19872 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
19873 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
19874 LDKUnsignedChannelUpdate contents_arg_conv;
19875 contents_arg_conv.inner = (void*)(contents_arg & (~1));
19876 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
19877 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
19878 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
19879 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19880 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19881 uint64_t ret_ref = (uint64_t)ret_var.inner;
19882 if (ret_var.is_owned) {
19888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19889 LDKChannelUpdate orig_conv;
19890 orig_conv.inner = (void*)(orig & (~1));
19891 orig_conv.is_owned = false;
19892 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
19893 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19894 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19895 uint64_t ret_ref = (uint64_t)ret_var.inner;
19896 if (ret_var.is_owned) {
19902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19903 LDKQueryChannelRange this_obj_conv;
19904 this_obj_conv.inner = (void*)(this_obj & (~1));
19905 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19906 QueryChannelRange_free(this_obj_conv);
19909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19910 LDKQueryChannelRange this_ptr_conv;
19911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19912 this_ptr_conv.is_owned = false;
19913 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
19918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
19919 LDKQueryChannelRange this_ptr_conv;
19920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19921 this_ptr_conv.is_owned = false;
19922 LDKThirtyTwoBytes val_ref;
19923 CHECK((*env)->GetArrayLength(env, val) == 32);
19924 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
19925 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
19928 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
19929 LDKQueryChannelRange this_ptr_conv;
19930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19931 this_ptr_conv.is_owned = false;
19932 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
19936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19937 LDKQueryChannelRange this_ptr_conv;
19938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19939 this_ptr_conv.is_owned = false;
19940 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
19943 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
19944 LDKQueryChannelRange this_ptr_conv;
19945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19946 this_ptr_conv.is_owned = false;
19947 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
19951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
19952 LDKQueryChannelRange this_ptr_conv;
19953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19954 this_ptr_conv.is_owned = false;
19955 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
19958 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) {
19959 LDKThirtyTwoBytes chain_hash_arg_ref;
19960 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
19961 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
19962 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
19963 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19964 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19965 uint64_t ret_ref = (uint64_t)ret_var.inner;
19966 if (ret_var.is_owned) {
19972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
19973 LDKQueryChannelRange orig_conv;
19974 orig_conv.inner = (void*)(orig & (~1));
19975 orig_conv.is_owned = false;
19976 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
19977 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
19978 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
19979 uint64_t ret_ref = (uint64_t)ret_var.inner;
19980 if (ret_var.is_owned) {
19986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
19987 LDKReplyChannelRange this_obj_conv;
19988 this_obj_conv.inner = (void*)(this_obj & (~1));
19989 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
19990 ReplyChannelRange_free(this_obj_conv);
19993 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
19994 LDKReplyChannelRange this_ptr_conv;
19995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
19996 this_ptr_conv.is_owned = false;
19997 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
19998 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
20002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20003 LDKReplyChannelRange this_ptr_conv;
20004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20005 this_ptr_conv.is_owned = false;
20006 LDKThirtyTwoBytes val_ref;
20007 CHECK((*env)->GetArrayLength(env, val) == 32);
20008 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20009 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
20012 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
20013 LDKReplyChannelRange this_ptr_conv;
20014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20015 this_ptr_conv.is_owned = false;
20016 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
20020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20021 LDKReplyChannelRange this_ptr_conv;
20022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20023 this_ptr_conv.is_owned = false;
20024 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
20027 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
20028 LDKReplyChannelRange this_ptr_conv;
20029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20030 this_ptr_conv.is_owned = false;
20031 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
20035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20036 LDKReplyChannelRange this_ptr_conv;
20037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20038 this_ptr_conv.is_owned = false;
20039 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
20042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr) {
20043 LDKReplyChannelRange this_ptr_conv;
20044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20045 this_ptr_conv.is_owned = false;
20046 jboolean ret_val = ReplyChannelRange_get_sync_complete(&this_ptr_conv);
20050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1sync_1complete(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20051 LDKReplyChannelRange this_ptr_conv;
20052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20053 this_ptr_conv.is_owned = false;
20054 ReplyChannelRange_set_sync_complete(&this_ptr_conv, val);
20057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20058 LDKReplyChannelRange this_ptr_conv;
20059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20060 this_ptr_conv.is_owned = false;
20061 LDKCVec_u64Z val_constr;
20062 val_constr.datalen = (*env)->GetArrayLength(env, val);
20063 if (val_constr.datalen > 0)
20064 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20066 val_constr.data = NULL;
20067 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20068 for (size_t g = 0; g < val_constr.datalen; g++) {
20069 int64_t val_conv_6 = val_vals[g];
20070 val_constr.data[g] = val_conv_6;
20072 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20073 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
20076 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 sync_complete_arg, int64_tArray short_channel_ids_arg) {
20077 LDKThirtyTwoBytes chain_hash_arg_ref;
20078 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20079 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20080 LDKCVec_u64Z short_channel_ids_arg_constr;
20081 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
20082 if (short_channel_ids_arg_constr.datalen > 0)
20083 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20085 short_channel_ids_arg_constr.data = NULL;
20086 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
20087 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
20088 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
20089 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
20091 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
20092 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg_constr);
20093 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20094 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20095 uint64_t ret_ref = (uint64_t)ret_var.inner;
20096 if (ret_var.is_owned) {
20102 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20103 LDKReplyChannelRange orig_conv;
20104 orig_conv.inner = (void*)(orig & (~1));
20105 orig_conv.is_owned = false;
20106 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
20107 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20108 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20109 uint64_t ret_ref = (uint64_t)ret_var.inner;
20110 if (ret_var.is_owned) {
20116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20117 LDKQueryShortChannelIds this_obj_conv;
20118 this_obj_conv.inner = (void*)(this_obj & (~1));
20119 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20120 QueryShortChannelIds_free(this_obj_conv);
20123 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20124 LDKQueryShortChannelIds this_ptr_conv;
20125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20126 this_ptr_conv.is_owned = false;
20127 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20128 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
20132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20133 LDKQueryShortChannelIds this_ptr_conv;
20134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20135 this_ptr_conv.is_owned = false;
20136 LDKThirtyTwoBytes val_ref;
20137 CHECK((*env)->GetArrayLength(env, val) == 32);
20138 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20139 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
20142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20143 LDKQueryShortChannelIds this_ptr_conv;
20144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20145 this_ptr_conv.is_owned = false;
20146 LDKCVec_u64Z val_constr;
20147 val_constr.datalen = (*env)->GetArrayLength(env, val);
20148 if (val_constr.datalen > 0)
20149 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20151 val_constr.data = NULL;
20152 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20153 for (size_t g = 0; g < val_constr.datalen; g++) {
20154 int64_t val_conv_6 = val_vals[g];
20155 val_constr.data[g] = val_conv_6;
20157 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20158 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
20161 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) {
20162 LDKThirtyTwoBytes chain_hash_arg_ref;
20163 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20164 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20165 LDKCVec_u64Z short_channel_ids_arg_constr;
20166 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
20167 if (short_channel_ids_arg_constr.datalen > 0)
20168 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
20170 short_channel_ids_arg_constr.data = NULL;
20171 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
20172 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
20173 int64_t short_channel_ids_arg_conv_6 = short_channel_ids_arg_vals[g];
20174 short_channel_ids_arg_constr.data[g] = short_channel_ids_arg_conv_6;
20176 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
20177 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
20178 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20179 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20180 uint64_t ret_ref = (uint64_t)ret_var.inner;
20181 if (ret_var.is_owned) {
20187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20188 LDKQueryShortChannelIds orig_conv;
20189 orig_conv.inner = (void*)(orig & (~1));
20190 orig_conv.is_owned = false;
20191 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
20192 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20193 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20194 uint64_t ret_ref = (uint64_t)ret_var.inner;
20195 if (ret_var.is_owned) {
20201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20202 LDKReplyShortChannelIdsEnd this_obj_conv;
20203 this_obj_conv.inner = (void*)(this_obj & (~1));
20204 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20205 ReplyShortChannelIdsEnd_free(this_obj_conv);
20208 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20209 LDKReplyShortChannelIdsEnd this_ptr_conv;
20210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20211 this_ptr_conv.is_owned = false;
20212 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20213 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
20217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20218 LDKReplyShortChannelIdsEnd this_ptr_conv;
20219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20220 this_ptr_conv.is_owned = false;
20221 LDKThirtyTwoBytes val_ref;
20222 CHECK((*env)->GetArrayLength(env, val) == 32);
20223 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20224 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
20227 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
20228 LDKReplyShortChannelIdsEnd this_ptr_conv;
20229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20230 this_ptr_conv.is_owned = false;
20231 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
20235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
20236 LDKReplyShortChannelIdsEnd this_ptr_conv;
20237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20238 this_ptr_conv.is_owned = false;
20239 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
20242 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
20243 LDKThirtyTwoBytes chain_hash_arg_ref;
20244 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20245 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20246 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
20247 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20248 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20249 uint64_t ret_ref = (uint64_t)ret_var.inner;
20250 if (ret_var.is_owned) {
20256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20257 LDKReplyShortChannelIdsEnd orig_conv;
20258 orig_conv.inner = (void*)(orig & (~1));
20259 orig_conv.is_owned = false;
20260 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
20261 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20262 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20263 uint64_t ret_ref = (uint64_t)ret_var.inner;
20264 if (ret_var.is_owned) {
20270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20271 LDKGossipTimestampFilter this_obj_conv;
20272 this_obj_conv.inner = (void*)(this_obj & (~1));
20273 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20274 GossipTimestampFilter_free(this_obj_conv);
20277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
20278 LDKGossipTimestampFilter this_ptr_conv;
20279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20280 this_ptr_conv.is_owned = false;
20281 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
20282 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
20286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
20287 LDKGossipTimestampFilter this_ptr_conv;
20288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20289 this_ptr_conv.is_owned = false;
20290 LDKThirtyTwoBytes val_ref;
20291 CHECK((*env)->GetArrayLength(env, val) == 32);
20292 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
20293 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
20296 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
20297 LDKGossipTimestampFilter this_ptr_conv;
20298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20299 this_ptr_conv.is_owned = false;
20300 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
20304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20305 LDKGossipTimestampFilter this_ptr_conv;
20306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20307 this_ptr_conv.is_owned = false;
20308 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
20311 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
20312 LDKGossipTimestampFilter this_ptr_conv;
20313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20314 this_ptr_conv.is_owned = false;
20315 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
20319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
20320 LDKGossipTimestampFilter this_ptr_conv;
20321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20322 this_ptr_conv.is_owned = false;
20323 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
20326 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) {
20327 LDKThirtyTwoBytes chain_hash_arg_ref;
20328 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
20329 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
20330 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
20331 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20332 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20333 uint64_t ret_ref = (uint64_t)ret_var.inner;
20334 if (ret_var.is_owned) {
20340 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20341 LDKGossipTimestampFilter orig_conv;
20342 orig_conv.inner = (void*)(orig & (~1));
20343 orig_conv.is_owned = false;
20344 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
20345 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20346 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20347 uint64_t ret_ref = (uint64_t)ret_var.inner;
20348 if (ret_var.is_owned) {
20354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20355 if ((this_ptr & 1) != 0) return;
20356 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)(((uint64_t)this_ptr) & ~1);
20357 FREE((void*)this_ptr);
20358 ErrorAction_free(this_ptr_conv);
20361 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20362 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
20363 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20364 *ret_copy = ErrorAction_clone(orig_conv);
20365 uint64_t ret_ref = (uint64_t)ret_copy;
20369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20370 LDKLightningError this_obj_conv;
20371 this_obj_conv.inner = (void*)(this_obj & (~1));
20372 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20373 LightningError_free(this_obj_conv);
20376 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
20377 LDKLightningError this_ptr_conv;
20378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20379 this_ptr_conv.is_owned = false;
20380 LDKStr ret_str = LightningError_get_err(&this_ptr_conv);
20381 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
20386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) {
20387 LDKLightningError this_ptr_conv;
20388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20389 this_ptr_conv.is_owned = false;
20390 LDKStr val_conv = java_to_owned_str(env, val);
20391 LightningError_set_err(&this_ptr_conv, val_conv);
20394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
20395 LDKLightningError this_ptr_conv;
20396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20397 this_ptr_conv.is_owned = false;
20398 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
20399 *ret_copy = LightningError_get_action(&this_ptr_conv);
20400 uint64_t ret_ref = (uint64_t)ret_copy;
20404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20405 LDKLightningError this_ptr_conv;
20406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20407 this_ptr_conv.is_owned = false;
20408 LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
20409 LightningError_set_action(&this_ptr_conv, val_conv);
20412 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
20413 LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
20414 LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
20415 LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
20416 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20417 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20418 uint64_t ret_ref = (uint64_t)ret_var.inner;
20419 if (ret_var.is_owned) {
20425 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20426 LDKLightningError orig_conv;
20427 orig_conv.inner = (void*)(orig & (~1));
20428 orig_conv.is_owned = false;
20429 LDKLightningError ret_var = LightningError_clone(&orig_conv);
20430 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20431 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20432 uint64_t ret_ref = (uint64_t)ret_var.inner;
20433 if (ret_var.is_owned) {
20439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
20440 LDKCommitmentUpdate this_obj_conv;
20441 this_obj_conv.inner = (void*)(this_obj & (~1));
20442 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
20443 CommitmentUpdate_free(this_obj_conv);
20446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20447 LDKCommitmentUpdate this_ptr_conv;
20448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20449 this_ptr_conv.is_owned = false;
20450 LDKCVec_UpdateAddHTLCZ val_constr;
20451 val_constr.datalen = (*env)->GetArrayLength(env, val);
20452 if (val_constr.datalen > 0)
20453 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20455 val_constr.data = NULL;
20456 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20457 for (size_t p = 0; p < val_constr.datalen; p++) {
20458 int64_t val_conv_15 = val_vals[p];
20459 LDKUpdateAddHTLC val_conv_15_conv;
20460 val_conv_15_conv.inner = (void*)(val_conv_15 & (~1));
20461 val_conv_15_conv.is_owned = (val_conv_15 & 1) || (val_conv_15 == 0);
20462 val_conv_15_conv = UpdateAddHTLC_clone(&val_conv_15_conv);
20463 val_constr.data[p] = val_conv_15_conv;
20465 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20466 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
20469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20470 LDKCommitmentUpdate this_ptr_conv;
20471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20472 this_ptr_conv.is_owned = false;
20473 LDKCVec_UpdateFulfillHTLCZ val_constr;
20474 val_constr.datalen = (*env)->GetArrayLength(env, val);
20475 if (val_constr.datalen > 0)
20476 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20478 val_constr.data = NULL;
20479 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20480 for (size_t t = 0; t < val_constr.datalen; t++) {
20481 int64_t val_conv_19 = val_vals[t];
20482 LDKUpdateFulfillHTLC val_conv_19_conv;
20483 val_conv_19_conv.inner = (void*)(val_conv_19 & (~1));
20484 val_conv_19_conv.is_owned = (val_conv_19 & 1) || (val_conv_19 == 0);
20485 val_conv_19_conv = UpdateFulfillHTLC_clone(&val_conv_19_conv);
20486 val_constr.data[t] = val_conv_19_conv;
20488 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20489 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
20492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
20493 LDKCommitmentUpdate this_ptr_conv;
20494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20495 this_ptr_conv.is_owned = false;
20496 LDKCVec_UpdateFailHTLCZ val_constr;
20497 val_constr.datalen = (*env)->GetArrayLength(env, val);
20498 if (val_constr.datalen > 0)
20499 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20501 val_constr.data = NULL;
20502 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20503 for (size_t q = 0; q < val_constr.datalen; q++) {
20504 int64_t val_conv_16 = val_vals[q];
20505 LDKUpdateFailHTLC val_conv_16_conv;
20506 val_conv_16_conv.inner = (void*)(val_conv_16 & (~1));
20507 val_conv_16_conv.is_owned = (val_conv_16 & 1) || (val_conv_16 == 0);
20508 val_conv_16_conv = UpdateFailHTLC_clone(&val_conv_16_conv);
20509 val_constr.data[q] = val_conv_16_conv;
20511 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20512 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
20515 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) {
20516 LDKCommitmentUpdate this_ptr_conv;
20517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20518 this_ptr_conv.is_owned = false;
20519 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
20520 val_constr.datalen = (*env)->GetArrayLength(env, val);
20521 if (val_constr.datalen > 0)
20522 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20524 val_constr.data = NULL;
20525 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
20526 for (size_t z = 0; z < val_constr.datalen; z++) {
20527 int64_t val_conv_25 = val_vals[z];
20528 LDKUpdateFailMalformedHTLC val_conv_25_conv;
20529 val_conv_25_conv.inner = (void*)(val_conv_25 & (~1));
20530 val_conv_25_conv.is_owned = (val_conv_25 & 1) || (val_conv_25 == 0);
20531 val_conv_25_conv = UpdateFailMalformedHTLC_clone(&val_conv_25_conv);
20532 val_constr.data[z] = val_conv_25_conv;
20534 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
20535 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
20538 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
20539 LDKCommitmentUpdate this_ptr_conv;
20540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20541 this_ptr_conv.is_owned = false;
20542 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
20543 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20544 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20545 uint64_t ret_ref = (uint64_t)ret_var.inner;
20546 if (ret_var.is_owned) {
20552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20553 LDKCommitmentUpdate this_ptr_conv;
20554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20555 this_ptr_conv.is_owned = false;
20556 LDKUpdateFee val_conv;
20557 val_conv.inner = (void*)(val & (~1));
20558 val_conv.is_owned = (val & 1) || (val == 0);
20559 val_conv = UpdateFee_clone(&val_conv);
20560 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
20563 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
20564 LDKCommitmentUpdate this_ptr_conv;
20565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20566 this_ptr_conv.is_owned = false;
20567 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
20568 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20569 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20570 uint64_t ret_ref = (uint64_t)ret_var.inner;
20571 if (ret_var.is_owned) {
20577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
20578 LDKCommitmentUpdate this_ptr_conv;
20579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
20580 this_ptr_conv.is_owned = false;
20581 LDKCommitmentSigned val_conv;
20582 val_conv.inner = (void*)(val & (~1));
20583 val_conv.is_owned = (val & 1) || (val == 0);
20584 val_conv = CommitmentSigned_clone(&val_conv);
20585 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
20588 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) {
20589 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
20590 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
20591 if (update_add_htlcs_arg_constr.datalen > 0)
20592 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
20594 update_add_htlcs_arg_constr.data = NULL;
20595 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
20596 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
20597 int64_t update_add_htlcs_arg_conv_15 = update_add_htlcs_arg_vals[p];
20598 LDKUpdateAddHTLC update_add_htlcs_arg_conv_15_conv;
20599 update_add_htlcs_arg_conv_15_conv.inner = (void*)(update_add_htlcs_arg_conv_15 & (~1));
20600 update_add_htlcs_arg_conv_15_conv.is_owned = (update_add_htlcs_arg_conv_15 & 1) || (update_add_htlcs_arg_conv_15 == 0);
20601 update_add_htlcs_arg_conv_15_conv = UpdateAddHTLC_clone(&update_add_htlcs_arg_conv_15_conv);
20602 update_add_htlcs_arg_constr.data[p] = update_add_htlcs_arg_conv_15_conv;
20604 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
20605 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
20606 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
20607 if (update_fulfill_htlcs_arg_constr.datalen > 0)
20608 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
20610 update_fulfill_htlcs_arg_constr.data = NULL;
20611 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
20612 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
20613 int64_t update_fulfill_htlcs_arg_conv_19 = update_fulfill_htlcs_arg_vals[t];
20614 LDKUpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19_conv;
20615 update_fulfill_htlcs_arg_conv_19_conv.inner = (void*)(update_fulfill_htlcs_arg_conv_19 & (~1));
20616 update_fulfill_htlcs_arg_conv_19_conv.is_owned = (update_fulfill_htlcs_arg_conv_19 & 1) || (update_fulfill_htlcs_arg_conv_19 == 0);
20617 update_fulfill_htlcs_arg_conv_19_conv = UpdateFulfillHTLC_clone(&update_fulfill_htlcs_arg_conv_19_conv);
20618 update_fulfill_htlcs_arg_constr.data[t] = update_fulfill_htlcs_arg_conv_19_conv;
20620 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
20621 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
20622 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
20623 if (update_fail_htlcs_arg_constr.datalen > 0)
20624 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
20626 update_fail_htlcs_arg_constr.data = NULL;
20627 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
20628 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
20629 int64_t update_fail_htlcs_arg_conv_16 = update_fail_htlcs_arg_vals[q];
20630 LDKUpdateFailHTLC update_fail_htlcs_arg_conv_16_conv;
20631 update_fail_htlcs_arg_conv_16_conv.inner = (void*)(update_fail_htlcs_arg_conv_16 & (~1));
20632 update_fail_htlcs_arg_conv_16_conv.is_owned = (update_fail_htlcs_arg_conv_16 & 1) || (update_fail_htlcs_arg_conv_16 == 0);
20633 update_fail_htlcs_arg_conv_16_conv = UpdateFailHTLC_clone(&update_fail_htlcs_arg_conv_16_conv);
20634 update_fail_htlcs_arg_constr.data[q] = update_fail_htlcs_arg_conv_16_conv;
20636 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
20637 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
20638 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
20639 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
20640 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
20642 update_fail_malformed_htlcs_arg_constr.data = NULL;
20643 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
20644 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
20645 int64_t update_fail_malformed_htlcs_arg_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
20646 LDKUpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25_conv;
20647 update_fail_malformed_htlcs_arg_conv_25_conv.inner = (void*)(update_fail_malformed_htlcs_arg_conv_25 & (~1));
20648 update_fail_malformed_htlcs_arg_conv_25_conv.is_owned = (update_fail_malformed_htlcs_arg_conv_25 & 1) || (update_fail_malformed_htlcs_arg_conv_25 == 0);
20649 update_fail_malformed_htlcs_arg_conv_25_conv = UpdateFailMalformedHTLC_clone(&update_fail_malformed_htlcs_arg_conv_25_conv);
20650 update_fail_malformed_htlcs_arg_constr.data[z] = update_fail_malformed_htlcs_arg_conv_25_conv;
20652 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
20653 LDKUpdateFee update_fee_arg_conv;
20654 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
20655 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
20656 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
20657 LDKCommitmentSigned commitment_signed_arg_conv;
20658 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
20659 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
20660 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
20661 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);
20662 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20663 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20664 uint64_t ret_ref = (uint64_t)ret_var.inner;
20665 if (ret_var.is_owned) {
20671 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20672 LDKCommitmentUpdate orig_conv;
20673 orig_conv.inner = (void*)(orig & (~1));
20674 orig_conv.is_owned = false;
20675 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
20676 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
20677 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
20678 uint64_t ret_ref = (uint64_t)ret_var.inner;
20679 if (ret_var.is_owned) {
20685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20686 if ((this_ptr & 1) != 0) return;
20687 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
20688 FREE((void*)this_ptr);
20689 HTLCFailChannelUpdate_free(this_ptr_conv);
20692 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
20693 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
20694 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
20695 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
20696 uint64_t ret_ref = (uint64_t)ret_copy;
20700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20701 if ((this_ptr & 1) != 0) return;
20702 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
20703 FREE((void*)this_ptr);
20704 ChannelMessageHandler_free(this_ptr_conv);
20707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
20708 if ((this_ptr & 1) != 0) return;
20709 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)(((uint64_t)this_ptr) & ~1);
20710 FREE((void*)this_ptr);
20711 RoutingMessageHandler_free(this_ptr_conv);
20714 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20715 LDKAcceptChannel obj_conv;
20716 obj_conv.inner = (void*)(obj & (~1));
20717 obj_conv.is_owned = false;
20718 LDKCVec_u8Z ret_var = AcceptChannel_write(&obj_conv);
20719 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20720 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20721 CVec_u8Z_free(ret_var);
20725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20726 LDKu8slice ser_ref;
20727 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20728 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20729 LDKCResult_AcceptChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AcceptChannelDecodeErrorZ), "LDKCResult_AcceptChannelDecodeErrorZ");
20730 *ret_conv = AcceptChannel_read(ser_ref);
20731 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20732 return (uint64_t)ret_conv;
20735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
20736 LDKAnnouncementSignatures obj_conv;
20737 obj_conv.inner = (void*)(obj & (~1));
20738 obj_conv.is_owned = false;
20739 LDKCVec_u8Z ret_var = AnnouncementSignatures_write(&obj_conv);
20740 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20741 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20742 CVec_u8Z_free(ret_var);
20746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20747 LDKu8slice ser_ref;
20748 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20749 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20750 LDKCResult_AnnouncementSignaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ), "LDKCResult_AnnouncementSignaturesDecodeErrorZ");
20751 *ret_conv = AnnouncementSignatures_read(ser_ref);
20752 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20753 return (uint64_t)ret_conv;
20756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
20757 LDKChannelReestablish obj_conv;
20758 obj_conv.inner = (void*)(obj & (~1));
20759 obj_conv.is_owned = false;
20760 LDKCVec_u8Z ret_var = ChannelReestablish_write(&obj_conv);
20761 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20762 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20763 CVec_u8Z_free(ret_var);
20767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20768 LDKu8slice ser_ref;
20769 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20770 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20771 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
20772 *ret_conv = ChannelReestablish_read(ser_ref);
20773 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20774 return (uint64_t)ret_conv;
20777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20778 LDKClosingSigned obj_conv;
20779 obj_conv.inner = (void*)(obj & (~1));
20780 obj_conv.is_owned = false;
20781 LDKCVec_u8Z ret_var = ClosingSigned_write(&obj_conv);
20782 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20783 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20784 CVec_u8Z_free(ret_var);
20788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20789 LDKu8slice ser_ref;
20790 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20791 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20792 LDKCResult_ClosingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ClosingSignedDecodeErrorZ), "LDKCResult_ClosingSignedDecodeErrorZ");
20793 *ret_conv = ClosingSigned_read(ser_ref);
20794 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20795 return (uint64_t)ret_conv;
20798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20799 LDKCommitmentSigned obj_conv;
20800 obj_conv.inner = (void*)(obj & (~1));
20801 obj_conv.is_owned = false;
20802 LDKCVec_u8Z ret_var = CommitmentSigned_write(&obj_conv);
20803 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20804 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20805 CVec_u8Z_free(ret_var);
20809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20810 LDKu8slice ser_ref;
20811 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20812 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20813 LDKCResult_CommitmentSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentSignedDecodeErrorZ), "LDKCResult_CommitmentSignedDecodeErrorZ");
20814 *ret_conv = CommitmentSigned_read(ser_ref);
20815 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20816 return (uint64_t)ret_conv;
20819 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
20820 LDKFundingCreated obj_conv;
20821 obj_conv.inner = (void*)(obj & (~1));
20822 obj_conv.is_owned = false;
20823 LDKCVec_u8Z ret_var = FundingCreated_write(&obj_conv);
20824 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20825 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20826 CVec_u8Z_free(ret_var);
20830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20831 LDKu8slice ser_ref;
20832 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20833 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20834 LDKCResult_FundingCreatedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingCreatedDecodeErrorZ), "LDKCResult_FundingCreatedDecodeErrorZ");
20835 *ret_conv = FundingCreated_read(ser_ref);
20836 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20837 return (uint64_t)ret_conv;
20840 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
20841 LDKFundingSigned obj_conv;
20842 obj_conv.inner = (void*)(obj & (~1));
20843 obj_conv.is_owned = false;
20844 LDKCVec_u8Z ret_var = FundingSigned_write(&obj_conv);
20845 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20846 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20847 CVec_u8Z_free(ret_var);
20851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20852 LDKu8slice ser_ref;
20853 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20854 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20855 LDKCResult_FundingSignedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingSignedDecodeErrorZ), "LDKCResult_FundingSignedDecodeErrorZ");
20856 *ret_conv = FundingSigned_read(ser_ref);
20857 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20858 return (uint64_t)ret_conv;
20861 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
20862 LDKFundingLocked obj_conv;
20863 obj_conv.inner = (void*)(obj & (~1));
20864 obj_conv.is_owned = false;
20865 LDKCVec_u8Z ret_var = FundingLocked_write(&obj_conv);
20866 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20867 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20868 CVec_u8Z_free(ret_var);
20872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20873 LDKu8slice ser_ref;
20874 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20875 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20876 LDKCResult_FundingLockedDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_FundingLockedDecodeErrorZ), "LDKCResult_FundingLockedDecodeErrorZ");
20877 *ret_conv = FundingLocked_read(ser_ref);
20878 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20879 return (uint64_t)ret_conv;
20882 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
20884 obj_conv.inner = (void*)(obj & (~1));
20885 obj_conv.is_owned = false;
20886 LDKCVec_u8Z ret_var = Init_write(&obj_conv);
20887 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20888 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20889 CVec_u8Z_free(ret_var);
20893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20894 LDKu8slice ser_ref;
20895 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20896 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20897 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
20898 *ret_conv = Init_read(ser_ref);
20899 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20900 return (uint64_t)ret_conv;
20903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
20904 LDKOpenChannel obj_conv;
20905 obj_conv.inner = (void*)(obj & (~1));
20906 obj_conv.is_owned = false;
20907 LDKCVec_u8Z ret_var = OpenChannel_write(&obj_conv);
20908 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20909 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20910 CVec_u8Z_free(ret_var);
20914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20915 LDKu8slice ser_ref;
20916 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20917 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20918 LDKCResult_OpenChannelDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_OpenChannelDecodeErrorZ), "LDKCResult_OpenChannelDecodeErrorZ");
20919 *ret_conv = OpenChannel_read(ser_ref);
20920 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20921 return (uint64_t)ret_conv;
20924 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
20925 LDKRevokeAndACK obj_conv;
20926 obj_conv.inner = (void*)(obj & (~1));
20927 obj_conv.is_owned = false;
20928 LDKCVec_u8Z ret_var = RevokeAndACK_write(&obj_conv);
20929 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20930 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20931 CVec_u8Z_free(ret_var);
20935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20936 LDKu8slice ser_ref;
20937 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20938 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20939 LDKCResult_RevokeAndACKDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RevokeAndACKDecodeErrorZ), "LDKCResult_RevokeAndACKDecodeErrorZ");
20940 *ret_conv = RevokeAndACK_read(ser_ref);
20941 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20942 return (uint64_t)ret_conv;
20945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
20946 LDKShutdown obj_conv;
20947 obj_conv.inner = (void*)(obj & (~1));
20948 obj_conv.is_owned = false;
20949 LDKCVec_u8Z ret_var = Shutdown_write(&obj_conv);
20950 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20951 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20952 CVec_u8Z_free(ret_var);
20956 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20957 LDKu8slice ser_ref;
20958 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20959 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20960 LDKCResult_ShutdownDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ShutdownDecodeErrorZ), "LDKCResult_ShutdownDecodeErrorZ");
20961 *ret_conv = Shutdown_read(ser_ref);
20962 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20963 return (uint64_t)ret_conv;
20966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20967 LDKUpdateFailHTLC obj_conv;
20968 obj_conv.inner = (void*)(obj & (~1));
20969 obj_conv.is_owned = false;
20970 LDKCVec_u8Z ret_var = UpdateFailHTLC_write(&obj_conv);
20971 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20972 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20973 CVec_u8Z_free(ret_var);
20977 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20978 LDKu8slice ser_ref;
20979 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
20980 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
20981 LDKCResult_UpdateFailHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ), "LDKCResult_UpdateFailHTLCDecodeErrorZ");
20982 *ret_conv = UpdateFailHTLC_read(ser_ref);
20983 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
20984 return (uint64_t)ret_conv;
20987 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
20988 LDKUpdateFailMalformedHTLC obj_conv;
20989 obj_conv.inner = (void*)(obj & (~1));
20990 obj_conv.is_owned = false;
20991 LDKCVec_u8Z ret_var = UpdateFailMalformedHTLC_write(&obj_conv);
20992 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
20993 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
20994 CVec_u8Z_free(ret_var);
20998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
20999 LDKu8slice ser_ref;
21000 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21001 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21002 LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ), "LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ");
21003 *ret_conv = UpdateFailMalformedHTLC_read(ser_ref);
21004 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21005 return (uint64_t)ret_conv;
21008 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
21009 LDKUpdateFee obj_conv;
21010 obj_conv.inner = (void*)(obj & (~1));
21011 obj_conv.is_owned = false;
21012 LDKCVec_u8Z ret_var = UpdateFee_write(&obj_conv);
21013 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21014 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21015 CVec_u8Z_free(ret_var);
21019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21020 LDKu8slice ser_ref;
21021 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21022 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21023 LDKCResult_UpdateFeeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFeeDecodeErrorZ), "LDKCResult_UpdateFeeDecodeErrorZ");
21024 *ret_conv = UpdateFee_read(ser_ref);
21025 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21026 return (uint64_t)ret_conv;
21029 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21030 LDKUpdateFulfillHTLC obj_conv;
21031 obj_conv.inner = (void*)(obj & (~1));
21032 obj_conv.is_owned = false;
21033 LDKCVec_u8Z ret_var = UpdateFulfillHTLC_write(&obj_conv);
21034 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21035 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21036 CVec_u8Z_free(ret_var);
21040 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21041 LDKu8slice ser_ref;
21042 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21043 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21044 LDKCResult_UpdateFulfillHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ), "LDKCResult_UpdateFulfillHTLCDecodeErrorZ");
21045 *ret_conv = UpdateFulfillHTLC_read(ser_ref);
21046 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21047 return (uint64_t)ret_conv;
21050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
21051 LDKUpdateAddHTLC obj_conv;
21052 obj_conv.inner = (void*)(obj & (~1));
21053 obj_conv.is_owned = false;
21054 LDKCVec_u8Z ret_var = UpdateAddHTLC_write(&obj_conv);
21055 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21056 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21057 CVec_u8Z_free(ret_var);
21061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21062 LDKu8slice ser_ref;
21063 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21064 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21065 LDKCResult_UpdateAddHTLCDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ), "LDKCResult_UpdateAddHTLCDecodeErrorZ");
21066 *ret_conv = UpdateAddHTLC_read(ser_ref);
21067 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21068 return (uint64_t)ret_conv;
21071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
21073 obj_conv.inner = (void*)(obj & (~1));
21074 obj_conv.is_owned = false;
21075 LDKCVec_u8Z ret_var = Ping_write(&obj_conv);
21076 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21077 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21078 CVec_u8Z_free(ret_var);
21082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21083 LDKu8slice ser_ref;
21084 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21085 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21086 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
21087 *ret_conv = Ping_read(ser_ref);
21088 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21089 return (uint64_t)ret_conv;
21092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
21094 obj_conv.inner = (void*)(obj & (~1));
21095 obj_conv.is_owned = false;
21096 LDKCVec_u8Z ret_var = Pong_write(&obj_conv);
21097 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21098 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21099 CVec_u8Z_free(ret_var);
21103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21104 LDKu8slice ser_ref;
21105 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21106 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21107 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
21108 *ret_conv = Pong_read(ser_ref);
21109 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21110 return (uint64_t)ret_conv;
21113 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
21114 LDKUnsignedChannelAnnouncement obj_conv;
21115 obj_conv.inner = (void*)(obj & (~1));
21116 obj_conv.is_owned = false;
21117 LDKCVec_u8Z ret_var = UnsignedChannelAnnouncement_write(&obj_conv);
21118 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21119 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21120 CVec_u8Z_free(ret_var);
21124 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21125 LDKu8slice ser_ref;
21126 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21127 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21128 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
21129 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
21130 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21131 return (uint64_t)ret_conv;
21134 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
21135 LDKChannelAnnouncement obj_conv;
21136 obj_conv.inner = (void*)(obj & (~1));
21137 obj_conv.is_owned = false;
21138 LDKCVec_u8Z ret_var = ChannelAnnouncement_write(&obj_conv);
21139 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21140 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21141 CVec_u8Z_free(ret_var);
21145 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21146 LDKu8slice ser_ref;
21147 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21148 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21149 LDKCResult_ChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ), "LDKCResult_ChannelAnnouncementDecodeErrorZ");
21150 *ret_conv = ChannelAnnouncement_read(ser_ref);
21151 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21152 return (uint64_t)ret_conv;
21155 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
21156 LDKUnsignedChannelUpdate obj_conv;
21157 obj_conv.inner = (void*)(obj & (~1));
21158 obj_conv.is_owned = false;
21159 LDKCVec_u8Z ret_var = UnsignedChannelUpdate_write(&obj_conv);
21160 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21161 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21162 CVec_u8Z_free(ret_var);
21166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21167 LDKu8slice ser_ref;
21168 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21169 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21170 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
21171 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
21172 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21173 return (uint64_t)ret_conv;
21176 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
21177 LDKChannelUpdate obj_conv;
21178 obj_conv.inner = (void*)(obj & (~1));
21179 obj_conv.is_owned = false;
21180 LDKCVec_u8Z ret_var = ChannelUpdate_write(&obj_conv);
21181 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21182 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21183 CVec_u8Z_free(ret_var);
21187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21188 LDKu8slice ser_ref;
21189 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21190 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21191 LDKCResult_ChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelUpdateDecodeErrorZ), "LDKCResult_ChannelUpdateDecodeErrorZ");
21192 *ret_conv = ChannelUpdate_read(ser_ref);
21193 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21194 return (uint64_t)ret_conv;
21197 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
21198 LDKErrorMessage obj_conv;
21199 obj_conv.inner = (void*)(obj & (~1));
21200 obj_conv.is_owned = false;
21201 LDKCVec_u8Z ret_var = ErrorMessage_write(&obj_conv);
21202 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21203 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21204 CVec_u8Z_free(ret_var);
21208 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21209 LDKu8slice ser_ref;
21210 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21211 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21212 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
21213 *ret_conv = ErrorMessage_read(ser_ref);
21214 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21215 return (uint64_t)ret_conv;
21218 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
21219 LDKUnsignedNodeAnnouncement obj_conv;
21220 obj_conv.inner = (void*)(obj & (~1));
21221 obj_conv.is_owned = false;
21222 LDKCVec_u8Z ret_var = UnsignedNodeAnnouncement_write(&obj_conv);
21223 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21224 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21225 CVec_u8Z_free(ret_var);
21229 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21230 LDKu8slice ser_ref;
21231 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21232 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21233 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
21234 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
21235 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21236 return (uint64_t)ret_conv;
21239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
21240 LDKNodeAnnouncement obj_conv;
21241 obj_conv.inner = (void*)(obj & (~1));
21242 obj_conv.is_owned = false;
21243 LDKCVec_u8Z ret_var = NodeAnnouncement_write(&obj_conv);
21244 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21245 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21246 CVec_u8Z_free(ret_var);
21250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21251 LDKu8slice ser_ref;
21252 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21253 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21254 LDKCResult_NodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ), "LDKCResult_NodeAnnouncementDecodeErrorZ");
21255 *ret_conv = NodeAnnouncement_read(ser_ref);
21256 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21257 return (uint64_t)ret_conv;
21260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21261 LDKu8slice ser_ref;
21262 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21263 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21264 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
21265 *ret_conv = QueryShortChannelIds_read(ser_ref);
21266 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21267 return (uint64_t)ret_conv;
21270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
21271 LDKQueryShortChannelIds obj_conv;
21272 obj_conv.inner = (void*)(obj & (~1));
21273 obj_conv.is_owned = false;
21274 LDKCVec_u8Z ret_var = QueryShortChannelIds_write(&obj_conv);
21275 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21276 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21277 CVec_u8Z_free(ret_var);
21281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21282 LDKu8slice ser_ref;
21283 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21284 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21285 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
21286 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
21287 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21288 return (uint64_t)ret_conv;
21291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
21292 LDKReplyShortChannelIdsEnd obj_conv;
21293 obj_conv.inner = (void*)(obj & (~1));
21294 obj_conv.is_owned = false;
21295 LDKCVec_u8Z ret_var = ReplyShortChannelIdsEnd_write(&obj_conv);
21296 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21297 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21298 CVec_u8Z_free(ret_var);
21302 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
21303 LDKQueryChannelRange this_arg_conv;
21304 this_arg_conv.inner = (void*)(this_arg & (~1));
21305 this_arg_conv.is_owned = false;
21306 int32_t ret_val = QueryChannelRange_end_blocknum(&this_arg_conv);
21310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21311 LDKu8slice ser_ref;
21312 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21313 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21314 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
21315 *ret_conv = QueryChannelRange_read(ser_ref);
21316 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21317 return (uint64_t)ret_conv;
21320 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
21321 LDKQueryChannelRange obj_conv;
21322 obj_conv.inner = (void*)(obj & (~1));
21323 obj_conv.is_owned = false;
21324 LDKCVec_u8Z ret_var = QueryChannelRange_write(&obj_conv);
21325 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21326 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21327 CVec_u8Z_free(ret_var);
21331 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21332 LDKu8slice ser_ref;
21333 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21334 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21335 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
21336 *ret_conv = ReplyChannelRange_read(ser_ref);
21337 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21338 return (uint64_t)ret_conv;
21341 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
21342 LDKReplyChannelRange obj_conv;
21343 obj_conv.inner = (void*)(obj & (~1));
21344 obj_conv.is_owned = false;
21345 LDKCVec_u8Z ret_var = ReplyChannelRange_write(&obj_conv);
21346 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21347 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21348 CVec_u8Z_free(ret_var);
21352 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21353 LDKu8slice ser_ref;
21354 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21355 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21356 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
21357 *ret_conv = GossipTimestampFilter_read(ser_ref);
21358 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21359 return (uint64_t)ret_conv;
21362 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
21363 LDKGossipTimestampFilter obj_conv;
21364 obj_conv.inner = (void*)(obj & (~1));
21365 obj_conv.is_owned = false;
21366 LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
21367 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21368 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21369 CVec_u8Z_free(ret_var);
21373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21374 LDKIgnoringMessageHandler this_obj_conv;
21375 this_obj_conv.inner = (void*)(this_obj & (~1));
21376 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21377 IgnoringMessageHandler_free(this_obj_conv);
21380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1new(JNIEnv *env, jclass clz) {
21381 LDKIgnoringMessageHandler ret_var = IgnoringMessageHandler_new();
21382 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21383 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21384 uint64_t ret_ref = (uint64_t)ret_var.inner;
21385 if (ret_var.is_owned) {
21391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
21392 LDKIgnoringMessageHandler this_arg_conv;
21393 this_arg_conv.inner = (void*)(this_arg & (~1));
21394 this_arg_conv.is_owned = false;
21395 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21396 *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
21397 return (uint64_t)ret;
21400 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
21401 LDKIgnoringMessageHandler this_arg_conv;
21402 this_arg_conv.inner = (void*)(this_arg & (~1));
21403 this_arg_conv.is_owned = false;
21404 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
21405 *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
21406 return (uint64_t)ret;
21409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21410 LDKErroringMessageHandler this_obj_conv;
21411 this_obj_conv.inner = (void*)(this_obj & (~1));
21412 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21413 ErroringMessageHandler_free(this_obj_conv);
21416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1new(JNIEnv *env, jclass clz) {
21417 LDKErroringMessageHandler ret_var = ErroringMessageHandler_new();
21418 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21419 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21420 uint64_t ret_ref = (uint64_t)ret_var.inner;
21421 if (ret_var.is_owned) {
21427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
21428 LDKErroringMessageHandler this_arg_conv;
21429 this_arg_conv.inner = (void*)(this_arg & (~1));
21430 this_arg_conv.is_owned = false;
21431 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
21432 *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
21433 return (uint64_t)ret;
21436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
21437 LDKErroringMessageHandler this_arg_conv;
21438 this_arg_conv.inner = (void*)(this_arg & (~1));
21439 this_arg_conv.is_owned = false;
21440 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
21441 *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
21442 return (uint64_t)ret;
21445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21446 LDKMessageHandler this_obj_conv;
21447 this_obj_conv.inner = (void*)(this_obj & (~1));
21448 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21449 MessageHandler_free(this_obj_conv);
21452 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
21453 LDKMessageHandler this_ptr_conv;
21454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21455 this_ptr_conv.is_owned = false;
21456 uint64_t ret_ret = (uint64_t)MessageHandler_get_chan_handler(&this_ptr_conv);
21460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21461 LDKMessageHandler this_ptr_conv;
21462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21463 this_ptr_conv.is_owned = false;
21464 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)(((uint64_t)val) & ~1);
21465 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
21466 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21467 LDKChannelMessageHandler_JCalls_cloned(&val_conv);
21469 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
21472 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
21473 LDKMessageHandler this_ptr_conv;
21474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21475 this_ptr_conv.is_owned = false;
21476 uint64_t ret_ret = (uint64_t)MessageHandler_get_route_handler(&this_ptr_conv);
21480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
21481 LDKMessageHandler this_ptr_conv;
21482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21483 this_ptr_conv.is_owned = false;
21484 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)(((uint64_t)val) & ~1);
21485 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
21486 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21487 LDKRoutingMessageHandler_JCalls_cloned(&val_conv);
21489 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
21492 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) {
21493 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)(((uint64_t)chan_handler_arg) & ~1);
21494 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
21495 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21496 LDKChannelMessageHandler_JCalls_cloned(&chan_handler_arg_conv);
21498 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)(((uint64_t)route_handler_arg) & ~1);
21499 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
21500 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21501 LDKRoutingMessageHandler_JCalls_cloned(&route_handler_arg_conv);
21503 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
21504 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21505 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21506 uint64_t ret_ref = (uint64_t)ret_var.inner;
21507 if (ret_var.is_owned) {
21513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21514 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
21515 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
21516 *ret = SocketDescriptor_clone(orig_conv);
21517 return (uint64_t)ret;
21520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
21521 if ((this_ptr & 1) != 0) return;
21522 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)(((uint64_t)this_ptr) & ~1);
21523 FREE((void*)this_ptr);
21524 SocketDescriptor_free(this_ptr_conv);
21527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21528 LDKPeerHandleError this_obj_conv;
21529 this_obj_conv.inner = (void*)(this_obj & (~1));
21530 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21531 PeerHandleError_free(this_obj_conv);
21534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
21535 LDKPeerHandleError this_ptr_conv;
21536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21537 this_ptr_conv.is_owned = false;
21538 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
21542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
21543 LDKPeerHandleError this_ptr_conv;
21544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21545 this_ptr_conv.is_owned = false;
21546 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
21549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
21550 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
21551 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21552 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21553 uint64_t ret_ref = (uint64_t)ret_var.inner;
21554 if (ret_var.is_owned) {
21560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21561 LDKPeerHandleError orig_conv;
21562 orig_conv.inner = (void*)(orig & (~1));
21563 orig_conv.is_owned = false;
21564 LDKPeerHandleError ret_var = PeerHandleError_clone(&orig_conv);
21565 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21566 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21567 uint64_t ret_ref = (uint64_t)ret_var.inner;
21568 if (ret_var.is_owned) {
21574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21575 LDKPeerManager this_obj_conv;
21576 this_obj_conv.inner = (void*)(this_obj & (~1));
21577 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21578 PeerManager_free(this_obj_conv);
21581 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) {
21582 LDKMessageHandler message_handler_conv;
21583 message_handler_conv.inner = (void*)(message_handler & (~1));
21584 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
21585 // Warning: we need a move here but no clone is available for LDKMessageHandler
21586 LDKSecretKey our_node_secret_ref;
21587 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
21588 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
21589 unsigned char ephemeral_random_data_arr[32];
21590 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
21591 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
21592 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
21593 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
21594 if (logger_conv.free == LDKLogger_JCalls_free) {
21595 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21596 LDKLogger_JCalls_cloned(&logger_conv);
21598 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
21599 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21600 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21601 uint64_t ret_ref = (uint64_t)ret_var.inner;
21602 if (ret_var.is_owned) {
21608 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
21609 LDKPeerManager this_arg_conv;
21610 this_arg_conv.inner = (void*)(this_arg & (~1));
21611 this_arg_conv.is_owned = false;
21612 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
21613 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
21615 for (size_t i = 0; i < ret_var.datalen; i++) {
21616 int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 33);
21617 (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
21618 (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
21620 FREE(ret_var.data);
21624 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) {
21625 LDKPeerManager this_arg_conv;
21626 this_arg_conv.inner = (void*)(this_arg & (~1));
21627 this_arg_conv.is_owned = false;
21628 LDKPublicKey their_node_id_ref;
21629 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
21630 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
21631 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21632 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
21633 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21634 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
21636 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
21637 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
21638 return (uint64_t)ret_conv;
21641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
21642 LDKPeerManager this_arg_conv;
21643 this_arg_conv.inner = (void*)(this_arg & (~1));
21644 this_arg_conv.is_owned = false;
21645 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21646 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
21647 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
21648 LDKSocketDescriptor_JCalls_cloned(&descriptor_conv);
21650 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21651 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
21652 return (uint64_t)ret_conv;
21655 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) {
21656 LDKPeerManager this_arg_conv;
21657 this_arg_conv.inner = (void*)(this_arg & (~1));
21658 this_arg_conv.is_owned = false;
21659 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21660 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
21661 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
21662 return (uint64_t)ret_conv;
21665 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) {
21666 LDKPeerManager this_arg_conv;
21667 this_arg_conv.inner = (void*)(this_arg & (~1));
21668 this_arg_conv.is_owned = false;
21669 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)peer_descriptor) & ~1);
21670 LDKu8slice data_ref;
21671 data_ref.datalen = (*env)->GetArrayLength(env, data);
21672 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
21673 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
21674 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
21675 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
21676 return (uint64_t)ret_conv;
21679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
21680 LDKPeerManager this_arg_conv;
21681 this_arg_conv.inner = (void*)(this_arg & (~1));
21682 this_arg_conv.is_owned = false;
21683 PeerManager_process_events(&this_arg_conv);
21686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
21687 LDKPeerManager this_arg_conv;
21688 this_arg_conv.inner = (void*)(this_arg & (~1));
21689 this_arg_conv.is_owned = false;
21690 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)(((uint64_t)descriptor) & ~1);
21691 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
21694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1by_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray node_id, jboolean no_connection_possible) {
21695 LDKPeerManager this_arg_conv;
21696 this_arg_conv.inner = (void*)(this_arg & (~1));
21697 this_arg_conv.is_owned = false;
21698 LDKPublicKey node_id_ref;
21699 CHECK((*env)->GetArrayLength(env, node_id) == 33);
21700 (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
21701 PeerManager_disconnect_by_node_id(&this_arg_conv, node_id_ref, no_connection_possible);
21704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred(JNIEnv *env, jclass clz, int64_t this_arg) {
21705 LDKPeerManager this_arg_conv;
21706 this_arg_conv.inner = (void*)(this_arg & (~1));
21707 this_arg_conv.is_owned = false;
21708 PeerManager_timer_tick_occurred(&this_arg_conv);
21711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
21712 unsigned char commitment_seed_arr[32];
21713 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
21714 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
21715 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
21716 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
21717 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
21721 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) {
21722 LDKPublicKey per_commitment_point_ref;
21723 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21724 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21725 unsigned char base_secret_arr[32];
21726 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
21727 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
21728 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
21729 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21730 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
21731 return (uint64_t)ret_conv;
21734 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) {
21735 LDKPublicKey per_commitment_point_ref;
21736 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21737 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21738 LDKPublicKey base_point_ref;
21739 CHECK((*env)->GetArrayLength(env, base_point) == 33);
21740 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
21741 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21742 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
21743 return (uint64_t)ret_conv;
21746 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) {
21747 unsigned char per_commitment_secret_arr[32];
21748 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
21749 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
21750 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
21751 unsigned char countersignatory_revocation_base_secret_arr[32];
21752 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
21753 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
21754 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
21755 LDKCResult_SecretKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeyErrorZ), "LDKCResult_SecretKeyErrorZ");
21756 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
21757 return (uint64_t)ret_conv;
21760 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) {
21761 LDKPublicKey per_commitment_point_ref;
21762 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
21763 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
21764 LDKPublicKey countersignatory_revocation_base_point_ref;
21765 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
21766 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
21767 LDKCResult_PublicKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeyErrorZ), "LDKCResult_PublicKeyErrorZ");
21768 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
21769 return (uint64_t)ret_conv;
21772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21773 LDKTxCreationKeys this_obj_conv;
21774 this_obj_conv.inner = (void*)(this_obj & (~1));
21775 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21776 TxCreationKeys_free(this_obj_conv);
21779 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21780 LDKTxCreationKeys this_ptr_conv;
21781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21782 this_ptr_conv.is_owned = false;
21783 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21784 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
21788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21789 LDKTxCreationKeys this_ptr_conv;
21790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21791 this_ptr_conv.is_owned = false;
21792 LDKPublicKey val_ref;
21793 CHECK((*env)->GetArrayLength(env, val) == 33);
21794 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21795 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
21798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21799 LDKTxCreationKeys this_ptr_conv;
21800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21801 this_ptr_conv.is_owned = false;
21802 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21803 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
21807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21808 LDKTxCreationKeys this_ptr_conv;
21809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21810 this_ptr_conv.is_owned = false;
21811 LDKPublicKey val_ref;
21812 CHECK((*env)->GetArrayLength(env, val) == 33);
21813 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21814 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
21817 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21818 LDKTxCreationKeys this_ptr_conv;
21819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21820 this_ptr_conv.is_owned = false;
21821 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21822 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
21826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21827 LDKTxCreationKeys this_ptr_conv;
21828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21829 this_ptr_conv.is_owned = false;
21830 LDKPublicKey val_ref;
21831 CHECK((*env)->GetArrayLength(env, val) == 33);
21832 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21833 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
21836 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21837 LDKTxCreationKeys this_ptr_conv;
21838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21839 this_ptr_conv.is_owned = false;
21840 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21841 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
21845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21846 LDKTxCreationKeys this_ptr_conv;
21847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21848 this_ptr_conv.is_owned = false;
21849 LDKPublicKey val_ref;
21850 CHECK((*env)->GetArrayLength(env, val) == 33);
21851 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21852 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
21855 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
21856 LDKTxCreationKeys this_ptr_conv;
21857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21858 this_ptr_conv.is_owned = false;
21859 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21860 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
21864 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) {
21865 LDKTxCreationKeys this_ptr_conv;
21866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21867 this_ptr_conv.is_owned = false;
21868 LDKPublicKey val_ref;
21869 CHECK((*env)->GetArrayLength(env, val) == 33);
21870 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21871 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
21874 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) {
21875 LDKPublicKey per_commitment_point_arg_ref;
21876 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
21877 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
21878 LDKPublicKey revocation_key_arg_ref;
21879 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
21880 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
21881 LDKPublicKey broadcaster_htlc_key_arg_ref;
21882 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
21883 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
21884 LDKPublicKey countersignatory_htlc_key_arg_ref;
21885 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
21886 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
21887 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
21888 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
21889 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
21890 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);
21891 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21892 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21893 uint64_t ret_ref = (uint64_t)ret_var.inner;
21894 if (ret_var.is_owned) {
21900 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
21901 LDKTxCreationKeys orig_conv;
21902 orig_conv.inner = (void*)(orig & (~1));
21903 orig_conv.is_owned = false;
21904 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
21905 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
21906 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
21907 uint64_t ret_ref = (uint64_t)ret_var.inner;
21908 if (ret_var.is_owned) {
21914 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
21915 LDKTxCreationKeys obj_conv;
21916 obj_conv.inner = (void*)(obj & (~1));
21917 obj_conv.is_owned = false;
21918 LDKCVec_u8Z ret_var = TxCreationKeys_write(&obj_conv);
21919 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
21920 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
21921 CVec_u8Z_free(ret_var);
21925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
21926 LDKu8slice ser_ref;
21927 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
21928 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
21929 LDKCResult_TxCreationKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysDecodeErrorZ), "LDKCResult_TxCreationKeysDecodeErrorZ");
21930 *ret_conv = TxCreationKeys_read(ser_ref);
21931 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
21932 return (uint64_t)ret_conv;
21935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
21936 LDKChannelPublicKeys this_obj_conv;
21937 this_obj_conv.inner = (void*)(this_obj & (~1));
21938 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
21939 ChannelPublicKeys_free(this_obj_conv);
21942 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
21943 LDKChannelPublicKeys this_ptr_conv;
21944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21945 this_ptr_conv.is_owned = false;
21946 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21947 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
21951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21952 LDKChannelPublicKeys this_ptr_conv;
21953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21954 this_ptr_conv.is_owned = false;
21955 LDKPublicKey val_ref;
21956 CHECK((*env)->GetArrayLength(env, val) == 33);
21957 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21958 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
21961 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
21962 LDKChannelPublicKeys this_ptr_conv;
21963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21964 this_ptr_conv.is_owned = false;
21965 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21966 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
21970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21971 LDKChannelPublicKeys this_ptr_conv;
21972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21973 this_ptr_conv.is_owned = false;
21974 LDKPublicKey val_ref;
21975 CHECK((*env)->GetArrayLength(env, val) == 33);
21976 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21977 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
21980 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
21981 LDKChannelPublicKeys this_ptr_conv;
21982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21983 this_ptr_conv.is_owned = false;
21984 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
21985 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
21989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
21990 LDKChannelPublicKeys this_ptr_conv;
21991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
21992 this_ptr_conv.is_owned = false;
21993 LDKPublicKey val_ref;
21994 CHECK((*env)->GetArrayLength(env, val) == 33);
21995 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
21996 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
21999 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22000 LDKChannelPublicKeys this_ptr_conv;
22001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22002 this_ptr_conv.is_owned = false;
22003 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22004 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
22008 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22009 LDKChannelPublicKeys this_ptr_conv;
22010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22011 this_ptr_conv.is_owned = false;
22012 LDKPublicKey val_ref;
22013 CHECK((*env)->GetArrayLength(env, val) == 33);
22014 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22015 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
22018 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22019 LDKChannelPublicKeys this_ptr_conv;
22020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22021 this_ptr_conv.is_owned = false;
22022 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
22023 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
22027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22028 LDKChannelPublicKeys this_ptr_conv;
22029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22030 this_ptr_conv.is_owned = false;
22031 LDKPublicKey val_ref;
22032 CHECK((*env)->GetArrayLength(env, val) == 33);
22033 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
22034 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
22037 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) {
22038 LDKPublicKey funding_pubkey_arg_ref;
22039 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
22040 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
22041 LDKPublicKey revocation_basepoint_arg_ref;
22042 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
22043 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
22044 LDKPublicKey payment_point_arg_ref;
22045 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
22046 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
22047 LDKPublicKey delayed_payment_basepoint_arg_ref;
22048 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
22049 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
22050 LDKPublicKey htlc_basepoint_arg_ref;
22051 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
22052 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
22053 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);
22054 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22055 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22056 uint64_t ret_ref = (uint64_t)ret_var.inner;
22057 if (ret_var.is_owned) {
22063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22064 LDKChannelPublicKeys orig_conv;
22065 orig_conv.inner = (void*)(orig & (~1));
22066 orig_conv.is_owned = false;
22067 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
22068 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22069 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22070 uint64_t ret_ref = (uint64_t)ret_var.inner;
22071 if (ret_var.is_owned) {
22077 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
22078 LDKChannelPublicKeys obj_conv;
22079 obj_conv.inner = (void*)(obj & (~1));
22080 obj_conv.is_owned = false;
22081 LDKCVec_u8Z ret_var = ChannelPublicKeys_write(&obj_conv);
22082 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22083 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22084 CVec_u8Z_free(ret_var);
22088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22089 LDKu8slice ser_ref;
22090 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22091 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22092 LDKCResult_ChannelPublicKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ), "LDKCResult_ChannelPublicKeysDecodeErrorZ");
22093 *ret_conv = ChannelPublicKeys_read(ser_ref);
22094 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22095 return (uint64_t)ret_conv;
22098 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) {
22099 LDKPublicKey per_commitment_point_ref;
22100 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22101 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22102 LDKPublicKey broadcaster_delayed_payment_base_ref;
22103 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
22104 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
22105 LDKPublicKey broadcaster_htlc_base_ref;
22106 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
22107 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
22108 LDKPublicKey countersignatory_revocation_base_ref;
22109 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
22110 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
22111 LDKPublicKey countersignatory_htlc_base_ref;
22112 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
22113 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
22114 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22115 *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);
22116 return (uint64_t)ret_conv;
22119 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) {
22120 LDKPublicKey per_commitment_point_ref;
22121 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
22122 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
22123 LDKChannelPublicKeys broadcaster_keys_conv;
22124 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
22125 broadcaster_keys_conv.is_owned = false;
22126 LDKChannelPublicKeys countersignatory_keys_conv;
22127 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
22128 countersignatory_keys_conv.is_owned = false;
22129 LDKCResult_TxCreationKeysErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysErrorZ), "LDKCResult_TxCreationKeysErrorZ");
22130 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
22131 return (uint64_t)ret_conv;
22134 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) {
22135 LDKPublicKey revocation_key_ref;
22136 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
22137 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
22138 LDKPublicKey broadcaster_delayed_payment_key_ref;
22139 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
22140 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
22141 LDKCVec_u8Z ret_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
22142 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22143 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22144 CVec_u8Z_free(ret_var);
22148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22149 LDKHTLCOutputInCommitment this_obj_conv;
22150 this_obj_conv.inner = (void*)(this_obj & (~1));
22151 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22152 HTLCOutputInCommitment_free(this_obj_conv);
22155 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
22156 LDKHTLCOutputInCommitment this_ptr_conv;
22157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22158 this_ptr_conv.is_owned = false;
22159 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
22163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22164 LDKHTLCOutputInCommitment this_ptr_conv;
22165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22166 this_ptr_conv.is_owned = false;
22167 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
22170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
22171 LDKHTLCOutputInCommitment this_ptr_conv;
22172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22173 this_ptr_conv.is_owned = false;
22174 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
22178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22179 LDKHTLCOutputInCommitment this_ptr_conv;
22180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22181 this_ptr_conv.is_owned = false;
22182 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
22185 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
22186 LDKHTLCOutputInCommitment this_ptr_conv;
22187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22188 this_ptr_conv.is_owned = false;
22189 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
22193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
22194 LDKHTLCOutputInCommitment this_ptr_conv;
22195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22196 this_ptr_conv.is_owned = false;
22197 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
22200 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
22201 LDKHTLCOutputInCommitment this_ptr_conv;
22202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22203 this_ptr_conv.is_owned = false;
22204 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22205 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
22209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22210 LDKHTLCOutputInCommitment this_ptr_conv;
22211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22212 this_ptr_conv.is_owned = false;
22213 LDKThirtyTwoBytes val_ref;
22214 CHECK((*env)->GetArrayLength(env, val) == 32);
22215 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22216 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
22219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
22220 LDKHTLCOutputInCommitment this_ptr_conv;
22221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22222 this_ptr_conv.is_owned = false;
22223 LDKCOption_u32Z *ret_copy = MALLOC(sizeof(LDKCOption_u32Z), "LDKCOption_u32Z");
22224 *ret_copy = HTLCOutputInCommitment_get_transaction_output_index(&this_ptr_conv);
22225 uint64_t ret_ref = (uint64_t)ret_copy;
22229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1transaction_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22230 LDKHTLCOutputInCommitment this_ptr_conv;
22231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22232 this_ptr_conv.is_owned = false;
22233 LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
22234 HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
22237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1new(JNIEnv *env, jclass clz, jboolean offered_arg, int64_t amount_msat_arg, int32_t cltv_expiry_arg, int8_tArray payment_hash_arg, int64_t transaction_output_index_arg) {
22238 LDKThirtyTwoBytes payment_hash_arg_ref;
22239 CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
22240 (*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
22241 LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
22242 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
22243 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22244 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22245 uint64_t ret_ref = (uint64_t)ret_var.inner;
22246 if (ret_var.is_owned) {
22252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22253 LDKHTLCOutputInCommitment orig_conv;
22254 orig_conv.inner = (void*)(orig & (~1));
22255 orig_conv.is_owned = false;
22256 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
22257 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22258 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22259 uint64_t ret_ref = (uint64_t)ret_var.inner;
22260 if (ret_var.is_owned) {
22266 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
22267 LDKHTLCOutputInCommitment obj_conv;
22268 obj_conv.inner = (void*)(obj & (~1));
22269 obj_conv.is_owned = false;
22270 LDKCVec_u8Z ret_var = HTLCOutputInCommitment_write(&obj_conv);
22271 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22272 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22273 CVec_u8Z_free(ret_var);
22277 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22278 LDKu8slice ser_ref;
22279 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22280 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22281 LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ), "LDKCResult_HTLCOutputInCommitmentDecodeErrorZ");
22282 *ret_conv = HTLCOutputInCommitment_read(ser_ref);
22283 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22284 return (uint64_t)ret_conv;
22287 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
22288 LDKHTLCOutputInCommitment htlc_conv;
22289 htlc_conv.inner = (void*)(htlc & (~1));
22290 htlc_conv.is_owned = false;
22291 LDKTxCreationKeys keys_conv;
22292 keys_conv.inner = (void*)(keys & (~1));
22293 keys_conv.is_owned = false;
22294 LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
22295 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22296 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22297 CVec_u8Z_free(ret_var);
22301 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
22302 LDKPublicKey broadcaster_ref;
22303 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
22304 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
22305 LDKPublicKey countersignatory_ref;
22306 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
22307 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
22308 LDKCVec_u8Z ret_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
22309 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22310 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22311 CVec_u8Z_free(ret_var);
22315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
22316 unsigned char commitment_txid_arr[32];
22317 CHECK((*env)->GetArrayLength(env, commitment_txid) == 32);
22318 (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr);
22319 unsigned char (*commitment_txid_ref)[32] = &commitment_txid_arr;
22320 LDKHTLCOutputInCommitment htlc_conv;
22321 htlc_conv.inner = (void*)(htlc & (~1));
22322 htlc_conv.is_owned = false;
22323 LDKPublicKey broadcaster_delayed_payment_key_ref;
22324 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
22325 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
22326 LDKPublicKey revocation_key_ref;
22327 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
22328 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
22329 LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
22330 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22331 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22332 Transaction_free(ret_var);
22336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22337 LDKChannelTransactionParameters this_obj_conv;
22338 this_obj_conv.inner = (void*)(this_obj & (~1));
22339 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22340 ChannelTransactionParameters_free(this_obj_conv);
22343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
22344 LDKChannelTransactionParameters this_ptr_conv;
22345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22346 this_ptr_conv.is_owned = false;
22347 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
22348 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22349 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22350 uint64_t ret_ref = (uint64_t)ret_var.inner;
22351 if (ret_var.is_owned) {
22357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22358 LDKChannelTransactionParameters this_ptr_conv;
22359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22360 this_ptr_conv.is_owned = false;
22361 LDKChannelPublicKeys val_conv;
22362 val_conv.inner = (void*)(val & (~1));
22363 val_conv.is_owned = (val & 1) || (val == 0);
22364 val_conv = ChannelPublicKeys_clone(&val_conv);
22365 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
22368 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22369 LDKChannelTransactionParameters this_ptr_conv;
22370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22371 this_ptr_conv.is_owned = false;
22372 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
22376 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) {
22377 LDKChannelTransactionParameters this_ptr_conv;
22378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22379 this_ptr_conv.is_owned = false;
22380 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
22383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
22384 LDKChannelTransactionParameters this_ptr_conv;
22385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22386 this_ptr_conv.is_owned = false;
22387 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
22391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
22392 LDKChannelTransactionParameters this_ptr_conv;
22393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22394 this_ptr_conv.is_owned = false;
22395 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
22398 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
22399 LDKChannelTransactionParameters this_ptr_conv;
22400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22401 this_ptr_conv.is_owned = false;
22402 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
22403 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22404 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22405 uint64_t ret_ref = (uint64_t)ret_var.inner;
22406 if (ret_var.is_owned) {
22412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22413 LDKChannelTransactionParameters this_ptr_conv;
22414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22415 this_ptr_conv.is_owned = false;
22416 LDKCounterpartyChannelTransactionParameters val_conv;
22417 val_conv.inner = (void*)(val & (~1));
22418 val_conv.is_owned = (val & 1) || (val == 0);
22419 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
22420 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
22423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
22424 LDKChannelTransactionParameters this_ptr_conv;
22425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22426 this_ptr_conv.is_owned = false;
22427 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
22428 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22429 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22430 uint64_t ret_ref = (uint64_t)ret_var.inner;
22431 if (ret_var.is_owned) {
22437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22438 LDKChannelTransactionParameters this_ptr_conv;
22439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22440 this_ptr_conv.is_owned = false;
22441 LDKOutPoint val_conv;
22442 val_conv.inner = (void*)(val & (~1));
22443 val_conv.is_owned = (val & 1) || (val == 0);
22444 val_conv = OutPoint_clone(&val_conv);
22445 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
22448 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) {
22449 LDKChannelPublicKeys holder_pubkeys_arg_conv;
22450 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
22451 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
22452 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
22453 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
22454 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
22455 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
22456 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
22457 LDKOutPoint funding_outpoint_arg_conv;
22458 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
22459 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
22460 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
22461 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);
22462 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22463 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22464 uint64_t ret_ref = (uint64_t)ret_var.inner;
22465 if (ret_var.is_owned) {
22471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22472 LDKChannelTransactionParameters orig_conv;
22473 orig_conv.inner = (void*)(orig & (~1));
22474 orig_conv.is_owned = false;
22475 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
22476 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22477 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22478 uint64_t ret_ref = (uint64_t)ret_var.inner;
22479 if (ret_var.is_owned) {
22485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22486 LDKCounterpartyChannelTransactionParameters this_obj_conv;
22487 this_obj_conv.inner = (void*)(this_obj & (~1));
22488 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22489 CounterpartyChannelTransactionParameters_free(this_obj_conv);
22492 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
22493 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22495 this_ptr_conv.is_owned = false;
22496 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
22497 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22498 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22499 uint64_t ret_ref = (uint64_t)ret_var.inner;
22500 if (ret_var.is_owned) {
22506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
22507 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22509 this_ptr_conv.is_owned = false;
22510 LDKChannelPublicKeys val_conv;
22511 val_conv.inner = (void*)(val & (~1));
22512 val_conv.is_owned = (val & 1) || (val == 0);
22513 val_conv = ChannelPublicKeys_clone(&val_conv);
22514 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
22517 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
22518 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22520 this_ptr_conv.is_owned = false;
22521 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
22525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
22526 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
22527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22528 this_ptr_conv.is_owned = false;
22529 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
22532 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) {
22533 LDKChannelPublicKeys pubkeys_arg_conv;
22534 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
22535 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
22536 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
22537 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
22538 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22539 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22540 uint64_t ret_ref = (uint64_t)ret_var.inner;
22541 if (ret_var.is_owned) {
22547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22548 LDKCounterpartyChannelTransactionParameters orig_conv;
22549 orig_conv.inner = (void*)(orig & (~1));
22550 orig_conv.is_owned = false;
22551 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
22552 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22553 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22554 uint64_t ret_ref = (uint64_t)ret_var.inner;
22555 if (ret_var.is_owned) {
22561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
22562 LDKChannelTransactionParameters this_arg_conv;
22563 this_arg_conv.inner = (void*)(this_arg & (~1));
22564 this_arg_conv.is_owned = false;
22565 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
22569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
22570 LDKChannelTransactionParameters this_arg_conv;
22571 this_arg_conv.inner = (void*)(this_arg & (~1));
22572 this_arg_conv.is_owned = false;
22573 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
22574 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22575 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22576 uint64_t ret_ref = (uint64_t)ret_var.inner;
22577 if (ret_var.is_owned) {
22583 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
22584 LDKChannelTransactionParameters this_arg_conv;
22585 this_arg_conv.inner = (void*)(this_arg & (~1));
22586 this_arg_conv.is_owned = false;
22587 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
22588 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22589 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22590 uint64_t ret_ref = (uint64_t)ret_var.inner;
22591 if (ret_var.is_owned) {
22597 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
22598 LDKCounterpartyChannelTransactionParameters obj_conv;
22599 obj_conv.inner = (void*)(obj & (~1));
22600 obj_conv.is_owned = false;
22601 LDKCVec_u8Z ret_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
22602 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22603 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22604 CVec_u8Z_free(ret_var);
22608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22609 LDKu8slice ser_ref;
22610 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22611 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22612 LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ), "LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ");
22613 *ret_conv = CounterpartyChannelTransactionParameters_read(ser_ref);
22614 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22615 return (uint64_t)ret_conv;
22618 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
22619 LDKChannelTransactionParameters obj_conv;
22620 obj_conv.inner = (void*)(obj & (~1));
22621 obj_conv.is_owned = false;
22622 LDKCVec_u8Z ret_var = ChannelTransactionParameters_write(&obj_conv);
22623 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22624 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22625 CVec_u8Z_free(ret_var);
22629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22630 LDKu8slice ser_ref;
22631 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22632 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22633 LDKCResult_ChannelTransactionParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ), "LDKCResult_ChannelTransactionParametersDecodeErrorZ");
22634 *ret_conv = ChannelTransactionParameters_read(ser_ref);
22635 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22636 return (uint64_t)ret_conv;
22639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22640 LDKDirectedChannelTransactionParameters this_obj_conv;
22641 this_obj_conv.inner = (void*)(this_obj & (~1));
22642 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22643 DirectedChannelTransactionParameters_free(this_obj_conv);
22646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
22647 LDKDirectedChannelTransactionParameters this_arg_conv;
22648 this_arg_conv.inner = (void*)(this_arg & (~1));
22649 this_arg_conv.is_owned = false;
22650 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
22651 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22652 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22653 uint64_t ret_ref = (uint64_t)ret_var.inner;
22654 if (ret_var.is_owned) {
22660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
22661 LDKDirectedChannelTransactionParameters this_arg_conv;
22662 this_arg_conv.inner = (void*)(this_arg & (~1));
22663 this_arg_conv.is_owned = false;
22664 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
22665 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22666 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22667 uint64_t ret_ref = (uint64_t)ret_var.inner;
22668 if (ret_var.is_owned) {
22674 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
22675 LDKDirectedChannelTransactionParameters this_arg_conv;
22676 this_arg_conv.inner = (void*)(this_arg & (~1));
22677 this_arg_conv.is_owned = false;
22678 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
22682 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
22683 LDKDirectedChannelTransactionParameters this_arg_conv;
22684 this_arg_conv.inner = (void*)(this_arg & (~1));
22685 this_arg_conv.is_owned = false;
22686 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
22690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
22691 LDKDirectedChannelTransactionParameters this_arg_conv;
22692 this_arg_conv.inner = (void*)(this_arg & (~1));
22693 this_arg_conv.is_owned = false;
22694 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
22695 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22696 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22697 uint64_t ret_ref = (uint64_t)ret_var.inner;
22698 if (ret_var.is_owned) {
22704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22705 LDKHolderCommitmentTransaction this_obj_conv;
22706 this_obj_conv.inner = (void*)(this_obj & (~1));
22707 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22708 HolderCommitmentTransaction_free(this_obj_conv);
22711 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
22712 LDKHolderCommitmentTransaction this_ptr_conv;
22713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22714 this_ptr_conv.is_owned = false;
22715 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22716 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
22720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22721 LDKHolderCommitmentTransaction this_ptr_conv;
22722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22723 this_ptr_conv.is_owned = false;
22724 LDKSignature val_ref;
22725 CHECK((*env)->GetArrayLength(env, val) == 64);
22726 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
22727 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
22730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
22731 LDKHolderCommitmentTransaction this_ptr_conv;
22732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22733 this_ptr_conv.is_owned = false;
22734 LDKCVec_SignatureZ val_constr;
22735 val_constr.datalen = (*env)->GetArrayLength(env, val);
22736 if (val_constr.datalen > 0)
22737 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22739 val_constr.data = NULL;
22740 for (size_t i = 0; i < val_constr.datalen; i++) {
22741 int8_tArray val_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
22742 LDKSignature val_conv_8_ref;
22743 CHECK((*env)->GetArrayLength(env, val_conv_8) == 64);
22744 (*env)->GetByteArrayRegion(env, val_conv_8, 0, 64, val_conv_8_ref.compact_form);
22745 val_constr.data[i] = val_conv_8_ref;
22747 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
22750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22751 LDKHolderCommitmentTransaction orig_conv;
22752 orig_conv.inner = (void*)(orig & (~1));
22753 orig_conv.is_owned = false;
22754 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
22755 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22756 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22757 uint64_t ret_ref = (uint64_t)ret_var.inner;
22758 if (ret_var.is_owned) {
22764 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22765 LDKHolderCommitmentTransaction obj_conv;
22766 obj_conv.inner = (void*)(obj & (~1));
22767 obj_conv.is_owned = false;
22768 LDKCVec_u8Z ret_var = HolderCommitmentTransaction_write(&obj_conv);
22769 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22770 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22771 CVec_u8Z_free(ret_var);
22775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22776 LDKu8slice ser_ref;
22777 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22778 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22779 LDKCResult_HolderCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ), "LDKCResult_HolderCommitmentTransactionDecodeErrorZ");
22780 *ret_conv = HolderCommitmentTransaction_read(ser_ref);
22781 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22782 return (uint64_t)ret_conv;
22785 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) {
22786 LDKCommitmentTransaction commitment_tx_conv;
22787 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
22788 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
22789 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
22790 LDKSignature counterparty_sig_ref;
22791 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
22792 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
22793 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
22794 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
22795 if (counterparty_htlc_sigs_constr.datalen > 0)
22796 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
22798 counterparty_htlc_sigs_constr.data = NULL;
22799 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
22800 int8_tArray counterparty_htlc_sigs_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
22801 LDKSignature counterparty_htlc_sigs_conv_8_ref;
22802 CHECK((*env)->GetArrayLength(env, counterparty_htlc_sigs_conv_8) == 64);
22803 (*env)->GetByteArrayRegion(env, counterparty_htlc_sigs_conv_8, 0, 64, counterparty_htlc_sigs_conv_8_ref.compact_form);
22804 counterparty_htlc_sigs_constr.data[i] = counterparty_htlc_sigs_conv_8_ref;
22806 LDKPublicKey holder_funding_key_ref;
22807 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
22808 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
22809 LDKPublicKey counterparty_funding_key_ref;
22810 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
22811 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
22812 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
22813 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22814 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22815 uint64_t ret_ref = (uint64_t)ret_var.inner;
22816 if (ret_var.is_owned) {
22822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22823 LDKBuiltCommitmentTransaction this_obj_conv;
22824 this_obj_conv.inner = (void*)(this_obj & (~1));
22825 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22826 BuiltCommitmentTransaction_free(this_obj_conv);
22829 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
22830 LDKBuiltCommitmentTransaction this_ptr_conv;
22831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22832 this_ptr_conv.is_owned = false;
22833 LDKTransaction ret_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
22834 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22835 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22836 Transaction_free(ret_var);
22840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22841 LDKBuiltCommitmentTransaction this_ptr_conv;
22842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22843 this_ptr_conv.is_owned = false;
22844 LDKTransaction val_ref;
22845 val_ref.datalen = (*env)->GetArrayLength(env, val);
22846 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
22847 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
22848 val_ref.data_is_owned = true;
22849 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
22852 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
22853 LDKBuiltCommitmentTransaction this_ptr_conv;
22854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22855 this_ptr_conv.is_owned = false;
22856 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22857 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
22861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
22862 LDKBuiltCommitmentTransaction this_ptr_conv;
22863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
22864 this_ptr_conv.is_owned = false;
22865 LDKThirtyTwoBytes val_ref;
22866 CHECK((*env)->GetArrayLength(env, val) == 32);
22867 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
22868 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
22871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
22872 LDKTransaction transaction_arg_ref;
22873 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
22874 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
22875 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
22876 transaction_arg_ref.data_is_owned = true;
22877 LDKThirtyTwoBytes txid_arg_ref;
22878 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
22879 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
22880 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
22881 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22882 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22883 uint64_t ret_ref = (uint64_t)ret_var.inner;
22884 if (ret_var.is_owned) {
22890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22891 LDKBuiltCommitmentTransaction orig_conv;
22892 orig_conv.inner = (void*)(orig & (~1));
22893 orig_conv.is_owned = false;
22894 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
22895 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22896 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22897 uint64_t ret_ref = (uint64_t)ret_var.inner;
22898 if (ret_var.is_owned) {
22904 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22905 LDKBuiltCommitmentTransaction obj_conv;
22906 obj_conv.inner = (void*)(obj & (~1));
22907 obj_conv.is_owned = false;
22908 LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
22909 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22910 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22911 CVec_u8Z_free(ret_var);
22915 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22916 LDKu8slice ser_ref;
22917 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22918 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22919 LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
22920 *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
22921 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22922 return (uint64_t)ret_conv;
22925 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) {
22926 LDKBuiltCommitmentTransaction this_arg_conv;
22927 this_arg_conv.inner = (void*)(this_arg & (~1));
22928 this_arg_conv.is_owned = false;
22929 LDKu8slice funding_redeemscript_ref;
22930 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22931 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22932 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
22933 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
22934 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22938 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) {
22939 LDKBuiltCommitmentTransaction this_arg_conv;
22940 this_arg_conv.inner = (void*)(this_arg & (~1));
22941 this_arg_conv.is_owned = false;
22942 unsigned char funding_key_arr[32];
22943 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
22944 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
22945 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
22946 LDKu8slice funding_redeemscript_ref;
22947 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
22948 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
22949 int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
22950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
22951 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
22955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
22956 LDKCommitmentTransaction this_obj_conv;
22957 this_obj_conv.inner = (void*)(this_obj & (~1));
22958 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
22959 CommitmentTransaction_free(this_obj_conv);
22962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
22963 LDKCommitmentTransaction orig_conv;
22964 orig_conv.inner = (void*)(orig & (~1));
22965 orig_conv.is_owned = false;
22966 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
22967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
22968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
22969 uint64_t ret_ref = (uint64_t)ret_var.inner;
22970 if (ret_var.is_owned) {
22976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
22977 LDKCommitmentTransaction obj_conv;
22978 obj_conv.inner = (void*)(obj & (~1));
22979 obj_conv.is_owned = false;
22980 LDKCVec_u8Z ret_var = CommitmentTransaction_write(&obj_conv);
22981 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
22982 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
22983 CVec_u8Z_free(ret_var);
22987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
22988 LDKu8slice ser_ref;
22989 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
22990 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
22991 LDKCResult_CommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ), "LDKCResult_CommitmentTransactionDecodeErrorZ");
22992 *ret_conv = CommitmentTransaction_read(ser_ref);
22993 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
22994 return (uint64_t)ret_conv;
22997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
22998 LDKCommitmentTransaction this_arg_conv;
22999 this_arg_conv.inner = (void*)(this_arg & (~1));
23000 this_arg_conv.is_owned = false;
23001 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
23005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
23006 LDKCommitmentTransaction this_arg_conv;
23007 this_arg_conv.inner = (void*)(this_arg & (~1));
23008 this_arg_conv.is_owned = false;
23009 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
23013 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
23014 LDKCommitmentTransaction this_arg_conv;
23015 this_arg_conv.inner = (void*)(this_arg & (~1));
23016 this_arg_conv.is_owned = false;
23017 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
23021 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
23022 LDKCommitmentTransaction this_arg_conv;
23023 this_arg_conv.inner = (void*)(this_arg & (~1));
23024 this_arg_conv.is_owned = false;
23025 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
23029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
23030 LDKCommitmentTransaction this_arg_conv;
23031 this_arg_conv.inner = (void*)(this_arg & (~1));
23032 this_arg_conv.is_owned = false;
23033 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
23034 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23035 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23036 uint64_t ret_ref = (uint64_t)ret_var.inner;
23037 if (ret_var.is_owned) {
23043 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) {
23044 LDKCommitmentTransaction this_arg_conv;
23045 this_arg_conv.inner = (void*)(this_arg & (~1));
23046 this_arg_conv.is_owned = false;
23047 LDKDirectedChannelTransactionParameters channel_parameters_conv;
23048 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
23049 channel_parameters_conv.is_owned = false;
23050 LDKChannelPublicKeys broadcaster_keys_conv;
23051 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
23052 broadcaster_keys_conv.is_owned = false;
23053 LDKChannelPublicKeys countersignatory_keys_conv;
23054 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
23055 countersignatory_keys_conv.is_owned = false;
23056 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
23057 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
23058 return (uint64_t)ret_conv;
23061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23062 LDKTrustedCommitmentTransaction this_obj_conv;
23063 this_obj_conv.inner = (void*)(this_obj & (~1));
23064 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23065 TrustedCommitmentTransaction_free(this_obj_conv);
23068 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
23069 LDKTrustedCommitmentTransaction this_arg_conv;
23070 this_arg_conv.inner = (void*)(this_arg & (~1));
23071 this_arg_conv.is_owned = false;
23072 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
23073 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
23077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
23078 LDKTrustedCommitmentTransaction this_arg_conv;
23079 this_arg_conv.inner = (void*)(this_arg & (~1));
23080 this_arg_conv.is_owned = false;
23081 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
23082 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23083 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23084 uint64_t ret_ref = (uint64_t)ret_var.inner;
23085 if (ret_var.is_owned) {
23091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
23092 LDKTrustedCommitmentTransaction this_arg_conv;
23093 this_arg_conv.inner = (void*)(this_arg & (~1));
23094 this_arg_conv.is_owned = false;
23095 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
23096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23098 uint64_t ret_ref = (uint64_t)ret_var.inner;
23099 if (ret_var.is_owned) {
23105 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) {
23106 LDKTrustedCommitmentTransaction this_arg_conv;
23107 this_arg_conv.inner = (void*)(this_arg & (~1));
23108 this_arg_conv.is_owned = false;
23109 unsigned char htlc_base_key_arr[32];
23110 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
23111 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
23112 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
23113 LDKDirectedChannelTransactionParameters channel_parameters_conv;
23114 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
23115 channel_parameters_conv.is_owned = false;
23116 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
23117 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
23118 return (uint64_t)ret_conv;
23121 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) {
23122 LDKPublicKey broadcaster_payment_basepoint_ref;
23123 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
23124 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
23125 LDKPublicKey countersignatory_payment_basepoint_ref;
23126 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
23127 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
23128 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
23132 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23133 LDKInitFeatures a_conv;
23134 a_conv.inner = (void*)(a & (~1));
23135 a_conv.is_owned = false;
23136 LDKInitFeatures b_conv;
23137 b_conv.inner = (void*)(b & (~1));
23138 b_conv.is_owned = false;
23139 jboolean ret_val = InitFeatures_eq(&a_conv, &b_conv);
23143 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23144 LDKNodeFeatures a_conv;
23145 a_conv.inner = (void*)(a & (~1));
23146 a_conv.is_owned = false;
23147 LDKNodeFeatures b_conv;
23148 b_conv.inner = (void*)(b & (~1));
23149 b_conv.is_owned = false;
23150 jboolean ret_val = NodeFeatures_eq(&a_conv, &b_conv);
23154 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23155 LDKChannelFeatures a_conv;
23156 a_conv.inner = (void*)(a & (~1));
23157 a_conv.is_owned = false;
23158 LDKChannelFeatures b_conv;
23159 b_conv.inner = (void*)(b & (~1));
23160 b_conv.is_owned = false;
23161 jboolean ret_val = ChannelFeatures_eq(&a_conv, &b_conv);
23165 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23166 LDKInvoiceFeatures a_conv;
23167 a_conv.inner = (void*)(a & (~1));
23168 a_conv.is_owned = false;
23169 LDKInvoiceFeatures b_conv;
23170 b_conv.inner = (void*)(b & (~1));
23171 b_conv.is_owned = false;
23172 jboolean ret_val = InvoiceFeatures_eq(&a_conv, &b_conv);
23176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23177 LDKInitFeatures orig_conv;
23178 orig_conv.inner = (void*)(orig & (~1));
23179 orig_conv.is_owned = false;
23180 LDKInitFeatures ret_var = InitFeatures_clone(&orig_conv);
23181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23183 uint64_t ret_ref = (uint64_t)ret_var.inner;
23184 if (ret_var.is_owned) {
23190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23191 LDKNodeFeatures orig_conv;
23192 orig_conv.inner = (void*)(orig & (~1));
23193 orig_conv.is_owned = false;
23194 LDKNodeFeatures ret_var = NodeFeatures_clone(&orig_conv);
23195 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23196 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23197 uint64_t ret_ref = (uint64_t)ret_var.inner;
23198 if (ret_var.is_owned) {
23204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23205 LDKChannelFeatures orig_conv;
23206 orig_conv.inner = (void*)(orig & (~1));
23207 orig_conv.is_owned = false;
23208 LDKChannelFeatures ret_var = ChannelFeatures_clone(&orig_conv);
23209 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23210 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23211 uint64_t ret_ref = (uint64_t)ret_var.inner;
23212 if (ret_var.is_owned) {
23218 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23219 LDKInvoiceFeatures orig_conv;
23220 orig_conv.inner = (void*)(orig & (~1));
23221 orig_conv.is_owned = false;
23222 LDKInvoiceFeatures ret_var = InvoiceFeatures_clone(&orig_conv);
23223 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23224 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23225 uint64_t ret_ref = (uint64_t)ret_var.inner;
23226 if (ret_var.is_owned) {
23232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23233 LDKInitFeatures this_obj_conv;
23234 this_obj_conv.inner = (void*)(this_obj & (~1));
23235 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23236 InitFeatures_free(this_obj_conv);
23239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23240 LDKNodeFeatures this_obj_conv;
23241 this_obj_conv.inner = (void*)(this_obj & (~1));
23242 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23243 NodeFeatures_free(this_obj_conv);
23246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23247 LDKChannelFeatures this_obj_conv;
23248 this_obj_conv.inner = (void*)(this_obj & (~1));
23249 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23250 ChannelFeatures_free(this_obj_conv);
23253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23254 LDKInvoiceFeatures this_obj_conv;
23255 this_obj_conv.inner = (void*)(this_obj & (~1));
23256 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23257 InvoiceFeatures_free(this_obj_conv);
23260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) {
23261 LDKInitFeatures ret_var = InitFeatures_empty();
23262 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23263 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23264 uint64_t ret_ref = (uint64_t)ret_var.inner;
23265 if (ret_var.is_owned) {
23271 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known(JNIEnv *env, jclass clz) {
23272 LDKInitFeatures ret_var = InitFeatures_known();
23273 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23274 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23275 uint64_t ret_ref = (uint64_t)ret_var.inner;
23276 if (ret_var.is_owned) {
23282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
23283 LDKNodeFeatures ret_var = NodeFeatures_empty();
23284 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23285 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23286 uint64_t ret_ref = (uint64_t)ret_var.inner;
23287 if (ret_var.is_owned) {
23293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known(JNIEnv *env, jclass clz) {
23294 LDKNodeFeatures ret_var = NodeFeatures_known();
23295 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23296 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23297 uint64_t ret_ref = (uint64_t)ret_var.inner;
23298 if (ret_var.is_owned) {
23304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
23305 LDKChannelFeatures ret_var = ChannelFeatures_empty();
23306 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23307 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23308 uint64_t ret_ref = (uint64_t)ret_var.inner;
23309 if (ret_var.is_owned) {
23315 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known(JNIEnv *env, jclass clz) {
23316 LDKChannelFeatures ret_var = ChannelFeatures_known();
23317 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23318 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23319 uint64_t ret_ref = (uint64_t)ret_var.inner;
23320 if (ret_var.is_owned) {
23326 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
23327 LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
23328 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23329 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23330 uint64_t ret_ref = (uint64_t)ret_var.inner;
23331 if (ret_var.is_owned) {
23337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known(JNIEnv *env, jclass clz) {
23338 LDKInvoiceFeatures ret_var = InvoiceFeatures_known();
23339 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23340 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23341 uint64_t ret_ref = (uint64_t)ret_var.inner;
23342 if (ret_var.is_owned) {
23348 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
23349 LDKInitFeatures this_arg_conv;
23350 this_arg_conv.inner = (void*)(this_arg & (~1));
23351 this_arg_conv.is_owned = false;
23352 jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv);
23356 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
23357 LDKNodeFeatures this_arg_conv;
23358 this_arg_conv.inner = (void*)(this_arg & (~1));
23359 this_arg_conv.is_owned = false;
23360 jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv);
23364 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
23365 LDKInvoiceFeatures this_arg_conv;
23366 this_arg_conv.inner = (void*)(this_arg & (~1));
23367 this_arg_conv.is_owned = false;
23368 jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv);
23372 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
23373 LDKInitFeatures obj_conv;
23374 obj_conv.inner = (void*)(obj & (~1));
23375 obj_conv.is_owned = false;
23376 LDKCVec_u8Z ret_var = InitFeatures_write(&obj_conv);
23377 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23378 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23379 CVec_u8Z_free(ret_var);
23383 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
23384 LDKNodeFeatures obj_conv;
23385 obj_conv.inner = (void*)(obj & (~1));
23386 obj_conv.is_owned = false;
23387 LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv);
23388 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23389 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23390 CVec_u8Z_free(ret_var);
23394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
23395 LDKChannelFeatures obj_conv;
23396 obj_conv.inner = (void*)(obj & (~1));
23397 obj_conv.is_owned = false;
23398 LDKCVec_u8Z ret_var = ChannelFeatures_write(&obj_conv);
23399 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23400 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23401 CVec_u8Z_free(ret_var);
23405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
23406 LDKInvoiceFeatures obj_conv;
23407 obj_conv.inner = (void*)(obj & (~1));
23408 obj_conv.is_owned = false;
23409 LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv);
23410 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23411 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23412 CVec_u8Z_free(ret_var);
23416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23417 LDKu8slice ser_ref;
23418 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23419 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23420 LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ");
23421 *ret_conv = InitFeatures_read(ser_ref);
23422 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23423 return (uint64_t)ret_conv;
23426 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23427 LDKu8slice ser_ref;
23428 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23429 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23430 LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ");
23431 *ret_conv = NodeFeatures_read(ser_ref);
23432 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23433 return (uint64_t)ret_conv;
23436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23437 LDKu8slice ser_ref;
23438 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23439 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23440 LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ");
23441 *ret_conv = ChannelFeatures_read(ser_ref);
23442 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23443 return (uint64_t)ret_conv;
23446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23447 LDKu8slice ser_ref;
23448 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23449 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23450 LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ");
23451 *ret_conv = InvoiceFeatures_read(ser_ref);
23452 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23453 return (uint64_t)ret_conv;
23456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23457 LDKRouteHop this_obj_conv;
23458 this_obj_conv.inner = (void*)(this_obj & (~1));
23459 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23460 RouteHop_free(this_obj_conv);
23463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
23464 LDKRouteHop this_ptr_conv;
23465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23466 this_ptr_conv.is_owned = false;
23467 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23468 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
23472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23473 LDKRouteHop this_ptr_conv;
23474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23475 this_ptr_conv.is_owned = false;
23476 LDKPublicKey val_ref;
23477 CHECK((*env)->GetArrayLength(env, val) == 33);
23478 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23479 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
23482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23483 LDKRouteHop this_ptr_conv;
23484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23485 this_ptr_conv.is_owned = false;
23486 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
23487 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23488 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23489 uint64_t ret_ref = (uint64_t)ret_var.inner;
23490 if (ret_var.is_owned) {
23496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23497 LDKRouteHop this_ptr_conv;
23498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23499 this_ptr_conv.is_owned = false;
23500 LDKNodeFeatures val_conv;
23501 val_conv.inner = (void*)(val & (~1));
23502 val_conv.is_owned = (val & 1) || (val == 0);
23503 val_conv = NodeFeatures_clone(&val_conv);
23504 RouteHop_set_node_features(&this_ptr_conv, val_conv);
23507 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23508 LDKRouteHop this_ptr_conv;
23509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23510 this_ptr_conv.is_owned = false;
23511 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
23515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23516 LDKRouteHop this_ptr_conv;
23517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23518 this_ptr_conv.is_owned = false;
23519 RouteHop_set_short_channel_id(&this_ptr_conv, val);
23522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
23523 LDKRouteHop this_ptr_conv;
23524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23525 this_ptr_conv.is_owned = false;
23526 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
23527 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23528 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23529 uint64_t ret_ref = (uint64_t)ret_var.inner;
23530 if (ret_var.is_owned) {
23536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23537 LDKRouteHop this_ptr_conv;
23538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23539 this_ptr_conv.is_owned = false;
23540 LDKChannelFeatures val_conv;
23541 val_conv.inner = (void*)(val & (~1));
23542 val_conv.is_owned = (val & 1) || (val == 0);
23543 val_conv = ChannelFeatures_clone(&val_conv);
23544 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
23547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23548 LDKRouteHop this_ptr_conv;
23549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23550 this_ptr_conv.is_owned = false;
23551 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
23555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23556 LDKRouteHop this_ptr_conv;
23557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23558 this_ptr_conv.is_owned = false;
23559 RouteHop_set_fee_msat(&this_ptr_conv, val);
23562 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23563 LDKRouteHop this_ptr_conv;
23564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23565 this_ptr_conv.is_owned = false;
23566 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
23570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
23571 LDKRouteHop this_ptr_conv;
23572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23573 this_ptr_conv.is_owned = false;
23574 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23577 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) {
23578 LDKPublicKey pubkey_arg_ref;
23579 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
23580 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
23581 LDKNodeFeatures node_features_arg_conv;
23582 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
23583 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
23584 node_features_arg_conv = NodeFeatures_clone(&node_features_arg_conv);
23585 LDKChannelFeatures channel_features_arg_conv;
23586 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
23587 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
23588 channel_features_arg_conv = ChannelFeatures_clone(&channel_features_arg_conv);
23589 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);
23590 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23591 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23592 uint64_t ret_ref = (uint64_t)ret_var.inner;
23593 if (ret_var.is_owned) {
23599 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23600 LDKRouteHop orig_conv;
23601 orig_conv.inner = (void*)(orig & (~1));
23602 orig_conv.is_owned = false;
23603 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
23604 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23605 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23606 uint64_t ret_ref = (uint64_t)ret_var.inner;
23607 if (ret_var.is_owned) {
23613 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
23614 LDKRouteHop obj_conv;
23615 obj_conv.inner = (void*)(obj & (~1));
23616 obj_conv.is_owned = false;
23617 LDKCVec_u8Z ret_var = RouteHop_write(&obj_conv);
23618 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23619 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23620 CVec_u8Z_free(ret_var);
23624 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23625 LDKu8slice ser_ref;
23626 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23627 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23628 LDKCResult_RouteHopDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteHopDecodeErrorZ), "LDKCResult_RouteHopDecodeErrorZ");
23629 *ret_conv = RouteHop_read(ser_ref);
23630 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23631 return (uint64_t)ret_conv;
23634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23635 LDKRoute this_obj_conv;
23636 this_obj_conv.inner = (void*)(this_obj & (~1));
23637 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23638 Route_free(this_obj_conv);
23641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
23642 LDKRoute this_ptr_conv;
23643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23644 this_ptr_conv.is_owned = false;
23645 LDKCVec_CVec_RouteHopZZ val_constr;
23646 val_constr.datalen = (*env)->GetArrayLength(env, val);
23647 if (val_constr.datalen > 0)
23648 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23650 val_constr.data = NULL;
23651 for (size_t m = 0; m < val_constr.datalen; m++) {
23652 int64_tArray val_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
23653 LDKCVec_RouteHopZ val_conv_12_constr;
23654 val_conv_12_constr.datalen = (*env)->GetArrayLength(env, val_conv_12);
23655 if (val_conv_12_constr.datalen > 0)
23656 val_conv_12_constr.data = MALLOC(val_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23658 val_conv_12_constr.data = NULL;
23659 int64_t* val_conv_12_vals = (*env)->GetLongArrayElements (env, val_conv_12, NULL);
23660 for (size_t k = 0; k < val_conv_12_constr.datalen; k++) {
23661 int64_t val_conv_12_conv_10 = val_conv_12_vals[k];
23662 LDKRouteHop val_conv_12_conv_10_conv;
23663 val_conv_12_conv_10_conv.inner = (void*)(val_conv_12_conv_10 & (~1));
23664 val_conv_12_conv_10_conv.is_owned = (val_conv_12_conv_10 & 1) || (val_conv_12_conv_10 == 0);
23665 val_conv_12_conv_10_conv = RouteHop_clone(&val_conv_12_conv_10_conv);
23666 val_conv_12_constr.data[k] = val_conv_12_conv_10_conv;
23668 (*env)->ReleaseLongArrayElements(env, val_conv_12, val_conv_12_vals, 0);
23669 val_constr.data[m] = val_conv_12_constr;
23671 Route_set_paths(&this_ptr_conv, val_constr);
23674 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
23675 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
23676 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
23677 if (paths_arg_constr.datalen > 0)
23678 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
23680 paths_arg_constr.data = NULL;
23681 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
23682 int64_tArray paths_arg_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
23683 LDKCVec_RouteHopZ paths_arg_conv_12_constr;
23684 paths_arg_conv_12_constr.datalen = (*env)->GetArrayLength(env, paths_arg_conv_12);
23685 if (paths_arg_conv_12_constr.datalen > 0)
23686 paths_arg_conv_12_constr.data = MALLOC(paths_arg_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
23688 paths_arg_conv_12_constr.data = NULL;
23689 int64_t* paths_arg_conv_12_vals = (*env)->GetLongArrayElements (env, paths_arg_conv_12, NULL);
23690 for (size_t k = 0; k < paths_arg_conv_12_constr.datalen; k++) {
23691 int64_t paths_arg_conv_12_conv_10 = paths_arg_conv_12_vals[k];
23692 LDKRouteHop paths_arg_conv_12_conv_10_conv;
23693 paths_arg_conv_12_conv_10_conv.inner = (void*)(paths_arg_conv_12_conv_10 & (~1));
23694 paths_arg_conv_12_conv_10_conv.is_owned = (paths_arg_conv_12_conv_10 & 1) || (paths_arg_conv_12_conv_10 == 0);
23695 paths_arg_conv_12_conv_10_conv = RouteHop_clone(&paths_arg_conv_12_conv_10_conv);
23696 paths_arg_conv_12_constr.data[k] = paths_arg_conv_12_conv_10_conv;
23698 (*env)->ReleaseLongArrayElements(env, paths_arg_conv_12, paths_arg_conv_12_vals, 0);
23699 paths_arg_constr.data[m] = paths_arg_conv_12_constr;
23701 LDKRoute ret_var = Route_new(paths_arg_constr);
23702 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23703 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23704 uint64_t ret_ref = (uint64_t)ret_var.inner;
23705 if (ret_var.is_owned) {
23711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23712 LDKRoute orig_conv;
23713 orig_conv.inner = (void*)(orig & (~1));
23714 orig_conv.is_owned = false;
23715 LDKRoute ret_var = Route_clone(&orig_conv);
23716 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23717 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23718 uint64_t ret_ref = (uint64_t)ret_var.inner;
23719 if (ret_var.is_owned) {
23725 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
23727 obj_conv.inner = (void*)(obj & (~1));
23728 obj_conv.is_owned = false;
23729 LDKCVec_u8Z ret_var = Route_write(&obj_conv);
23730 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
23731 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
23732 CVec_u8Z_free(ret_var);
23736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
23737 LDKu8slice ser_ref;
23738 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
23739 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
23740 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
23741 *ret_conv = Route_read(ser_ref);
23742 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
23743 return (uint64_t)ret_conv;
23746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23747 LDKRouteHint this_obj_conv;
23748 this_obj_conv.inner = (void*)(this_obj & (~1));
23749 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23750 RouteHint_free(this_obj_conv);
23753 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23754 LDKRouteHint a_conv;
23755 a_conv.inner = (void*)(a & (~1));
23756 a_conv.is_owned = false;
23757 LDKRouteHint b_conv;
23758 b_conv.inner = (void*)(b & (~1));
23759 b_conv.is_owned = false;
23760 jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
23764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23765 LDKRouteHint orig_conv;
23766 orig_conv.inner = (void*)(orig & (~1));
23767 orig_conv.is_owned = false;
23768 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
23769 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23770 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23771 uint64_t ret_ref = (uint64_t)ret_var.inner;
23772 if (ret_var.is_owned) {
23778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
23779 LDKRouteHintHop this_obj_conv;
23780 this_obj_conv.inner = (void*)(this_obj & (~1));
23781 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
23782 RouteHintHop_free(this_obj_conv);
23785 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23786 LDKRouteHintHop this_ptr_conv;
23787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23788 this_ptr_conv.is_owned = false;
23789 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
23790 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, RouteHintHop_get_src_node_id(&this_ptr_conv).compressed_form);
23794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
23795 LDKRouteHintHop this_ptr_conv;
23796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23797 this_ptr_conv.is_owned = false;
23798 LDKPublicKey val_ref;
23799 CHECK((*env)->GetArrayLength(env, val) == 33);
23800 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
23801 RouteHintHop_set_src_node_id(&this_ptr_conv, val_ref);
23804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
23805 LDKRouteHintHop this_ptr_conv;
23806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23807 this_ptr_conv.is_owned = false;
23808 int64_t ret_val = RouteHintHop_get_short_channel_id(&this_ptr_conv);
23812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23813 LDKRouteHintHop this_ptr_conv;
23814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23815 this_ptr_conv.is_owned = false;
23816 RouteHintHop_set_short_channel_id(&this_ptr_conv, val);
23819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
23820 LDKRouteHintHop this_ptr_conv;
23821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23822 this_ptr_conv.is_owned = false;
23823 LDKRoutingFees ret_var = RouteHintHop_get_fees(&this_ptr_conv);
23824 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23825 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23826 uint64_t ret_ref = (uint64_t)ret_var.inner;
23827 if (ret_var.is_owned) {
23833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23834 LDKRouteHintHop this_ptr_conv;
23835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23836 this_ptr_conv.is_owned = false;
23837 LDKRoutingFees val_conv;
23838 val_conv.inner = (void*)(val & (~1));
23839 val_conv.is_owned = (val & 1) || (val == 0);
23840 val_conv = RoutingFees_clone(&val_conv);
23841 RouteHintHop_set_fees(&this_ptr_conv, val_conv);
23844 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
23845 LDKRouteHintHop this_ptr_conv;
23846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23847 this_ptr_conv.is_owned = false;
23848 int16_t ret_val = RouteHintHop_get_cltv_expiry_delta(&this_ptr_conv);
23852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
23853 LDKRouteHintHop this_ptr_conv;
23854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23855 this_ptr_conv.is_owned = false;
23856 RouteHintHop_set_cltv_expiry_delta(&this_ptr_conv, val);
23859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23860 LDKRouteHintHop this_ptr_conv;
23861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23862 this_ptr_conv.is_owned = false;
23863 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23864 *ret_copy = RouteHintHop_get_htlc_minimum_msat(&this_ptr_conv);
23865 uint64_t ret_ref = (uint64_t)ret_copy;
23869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23870 LDKRouteHintHop this_ptr_conv;
23871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23872 this_ptr_conv.is_owned = false;
23873 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23874 RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
23877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
23878 LDKRouteHintHop this_ptr_conv;
23879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23880 this_ptr_conv.is_owned = false;
23881 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
23882 *ret_copy = RouteHintHop_get_htlc_maximum_msat(&this_ptr_conv);
23883 uint64_t ret_ref = (uint64_t)ret_copy;
23887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
23888 LDKRouteHintHop this_ptr_conv;
23889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
23890 this_ptr_conv.is_owned = false;
23891 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
23892 RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
23895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_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, int64_t htlc_maximum_msat_arg) {
23896 LDKPublicKey src_node_id_arg_ref;
23897 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
23898 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
23899 LDKRoutingFees fees_arg_conv;
23900 fees_arg_conv.inner = (void*)(fees_arg & (~1));
23901 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
23902 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
23903 LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
23904 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
23905 LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
23906 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23907 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23908 uint64_t ret_ref = (uint64_t)ret_var.inner;
23909 if (ret_var.is_owned) {
23915 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
23916 LDKRouteHintHop a_conv;
23917 a_conv.inner = (void*)(a & (~1));
23918 a_conv.is_owned = false;
23919 LDKRouteHintHop b_conv;
23920 b_conv.inner = (void*)(b & (~1));
23921 b_conv.is_owned = false;
23922 jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
23926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
23927 LDKRouteHintHop orig_conv;
23928 orig_conv.inner = (void*)(orig & (~1));
23929 orig_conv.is_owned = false;
23930 LDKRouteHintHop ret_var = RouteHintHop_clone(&orig_conv);
23931 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
23932 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
23933 uint64_t ret_ref = (uint64_t)ret_var.inner;
23934 if (ret_var.is_owned) {
23940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
23941 LDKPublicKey our_node_id_ref;
23942 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23943 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23944 LDKNetworkGraph network_conv;
23945 network_conv.inner = (void*)(network & (~1));
23946 network_conv.is_owned = false;
23947 LDKPublicKey payee_ref;
23948 CHECK((*env)->GetArrayLength(env, payee) == 33);
23949 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
23950 LDKCVec_ChannelDetailsZ first_hops_constr;
23951 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
23952 if (first_hops_constr.datalen > 0)
23953 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
23955 first_hops_constr.data = NULL;
23956 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
23957 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
23958 int64_t first_hops_conv_16 = first_hops_vals[q];
23959 LDKChannelDetails first_hops_conv_16_conv;
23960 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
23961 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
23962 first_hops_constr.data[q] = first_hops_conv_16_conv;
23964 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
23965 LDKCVec_RouteHintZ last_hops_constr;
23966 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
23967 if (last_hops_constr.datalen > 0)
23968 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
23970 last_hops_constr.data = NULL;
23971 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
23972 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
23973 int64_t last_hops_conv_11 = last_hops_vals[l];
23974 LDKRouteHint last_hops_conv_11_conv;
23975 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
23976 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
23977 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
23978 last_hops_constr.data[l] = last_hops_conv_11_conv;
23980 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
23981 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
23982 if (logger_conv.free == LDKLogger_JCalls_free) {
23983 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
23984 LDKLogger_JCalls_cloned(&logger_conv);
23986 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
23987 *ret_conv = get_keysend_route(our_node_id_ref, &network_conv, payee_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
23988 FREE(first_hops_constr.data);
23989 return (uint64_t)ret_conv;
23992 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 payee, int64_t payee_features, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
23993 LDKPublicKey our_node_id_ref;
23994 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
23995 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
23996 LDKNetworkGraph network_conv;
23997 network_conv.inner = (void*)(network & (~1));
23998 network_conv.is_owned = false;
23999 LDKPublicKey payee_ref;
24000 CHECK((*env)->GetArrayLength(env, payee) == 33);
24001 (*env)->GetByteArrayRegion(env, payee, 0, 33, payee_ref.compressed_form);
24002 LDKInvoiceFeatures payee_features_conv;
24003 payee_features_conv.inner = (void*)(payee_features & (~1));
24004 payee_features_conv.is_owned = (payee_features & 1) || (payee_features == 0);
24005 payee_features_conv = InvoiceFeatures_clone(&payee_features_conv);
24006 LDKCVec_ChannelDetailsZ first_hops_constr;
24007 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
24008 if (first_hops_constr.datalen > 0)
24009 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
24011 first_hops_constr.data = NULL;
24012 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
24013 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
24014 int64_t first_hops_conv_16 = first_hops_vals[q];
24015 LDKChannelDetails first_hops_conv_16_conv;
24016 first_hops_conv_16_conv.inner = (void*)(first_hops_conv_16 & (~1));
24017 first_hops_conv_16_conv.is_owned = (first_hops_conv_16 & 1) || (first_hops_conv_16 == 0);
24018 first_hops_constr.data[q] = first_hops_conv_16_conv;
24020 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
24021 LDKCVec_RouteHintZ last_hops_constr;
24022 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
24023 if (last_hops_constr.datalen > 0)
24024 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
24026 last_hops_constr.data = NULL;
24027 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
24028 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
24029 int64_t last_hops_conv_11 = last_hops_vals[l];
24030 LDKRouteHint last_hops_conv_11_conv;
24031 last_hops_conv_11_conv.inner = (void*)(last_hops_conv_11 & (~1));
24032 last_hops_conv_11_conv.is_owned = (last_hops_conv_11 & 1) || (last_hops_conv_11 == 0);
24033 last_hops_conv_11_conv = RouteHint_clone(&last_hops_conv_11_conv);
24034 last_hops_constr.data[l] = last_hops_conv_11_conv;
24036 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
24037 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24038 if (logger_conv.free == LDKLogger_JCalls_free) {
24039 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24040 LDKLogger_JCalls_cloned(&logger_conv);
24042 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
24043 *ret_conv = get_route(our_node_id_ref, &network_conv, payee_ref, payee_features_conv, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
24044 FREE(first_hops_constr.data);
24045 return (uint64_t)ret_conv;
24048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24049 LDKNetworkGraph this_obj_conv;
24050 this_obj_conv.inner = (void*)(this_obj & (~1));
24051 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24052 NetworkGraph_free(this_obj_conv);
24055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24056 LDKNetworkGraph orig_conv;
24057 orig_conv.inner = (void*)(orig & (~1));
24058 orig_conv.is_owned = false;
24059 LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
24060 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24061 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24062 uint64_t ret_ref = (uint64_t)ret_var.inner;
24063 if (ret_var.is_owned) {
24069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24070 LDKLockedNetworkGraph this_obj_conv;
24071 this_obj_conv.inner = (void*)(this_obj & (~1));
24072 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24073 LockedNetworkGraph_free(this_obj_conv);
24076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24077 LDKNetGraphMsgHandler this_obj_conv;
24078 this_obj_conv.inner = (void*)(this_obj & (~1));
24079 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24080 NetGraphMsgHandler_free(this_obj_conv);
24083 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) {
24084 LDKThirtyTwoBytes genesis_hash_ref;
24085 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
24086 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
24087 LDKAccess *chain_access_conv_ptr = NULL;
24088 if (chain_access != 0) {
24089 LDKAccess chain_access_conv;
24090 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24091 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24092 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24093 LDKAccess_JCalls_cloned(&chain_access_conv);
24095 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24096 *chain_access_conv_ptr = chain_access_conv;
24098 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24099 if (logger_conv.free == LDKLogger_JCalls_free) {
24100 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24101 LDKLogger_JCalls_cloned(&logger_conv);
24103 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
24104 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24105 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24106 uint64_t ret_ref = (uint64_t)ret_var.inner;
24107 if (ret_var.is_owned) {
24113 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) {
24114 LDKAccess *chain_access_conv_ptr = NULL;
24115 if (chain_access != 0) {
24116 LDKAccess chain_access_conv;
24117 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24118 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24119 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24120 LDKAccess_JCalls_cloned(&chain_access_conv);
24122 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24123 *chain_access_conv_ptr = chain_access_conv;
24125 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
24126 if (logger_conv.free == LDKLogger_JCalls_free) {
24127 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24128 LDKLogger_JCalls_cloned(&logger_conv);
24130 LDKNetworkGraph network_graph_conv;
24131 network_graph_conv.inner = (void*)(network_graph & (~1));
24132 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
24133 network_graph_conv = NetworkGraph_clone(&network_graph_conv);
24134 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
24135 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24136 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24137 uint64_t ret_ref = (uint64_t)ret_var.inner;
24138 if (ret_var.is_owned) {
24144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access(JNIEnv *env, jclass clz, int64_t this_arg, int64_t chain_access) {
24145 LDKNetGraphMsgHandler this_arg_conv;
24146 this_arg_conv.inner = (void*)(this_arg & (~1));
24147 this_arg_conv.is_owned = false;
24148 LDKAccess *chain_access_conv_ptr = NULL;
24149 if (chain_access != 0) {
24150 LDKAccess chain_access_conv;
24151 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
24152 if (chain_access_conv.free == LDKAccess_JCalls_free) {
24153 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
24154 LDKAccess_JCalls_cloned(&chain_access_conv);
24156 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
24157 *chain_access_conv_ptr = chain_access_conv;
24159 NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
24162 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
24163 LDKNetGraphMsgHandler this_arg_conv;
24164 this_arg_conv.inner = (void*)(this_arg & (~1));
24165 this_arg_conv.is_owned = false;
24166 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
24167 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24168 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24169 uint64_t ret_ref = (uint64_t)ret_var.inner;
24170 if (ret_var.is_owned) {
24176 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
24177 LDKLockedNetworkGraph this_arg_conv;
24178 this_arg_conv.inner = (void*)(this_arg & (~1));
24179 this_arg_conv.is_owned = false;
24180 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
24181 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24182 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24183 uint64_t ret_ref = (uint64_t)ret_var.inner;
24184 if (ret_var.is_owned) {
24190 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
24191 LDKNetGraphMsgHandler this_arg_conv;
24192 this_arg_conv.inner = (void*)(this_arg & (~1));
24193 this_arg_conv.is_owned = false;
24194 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
24195 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
24196 return (uint64_t)ret;
24199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
24200 LDKNetGraphMsgHandler this_arg_conv;
24201 this_arg_conv.inner = (void*)(this_arg & (~1));
24202 this_arg_conv.is_owned = false;
24203 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
24204 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
24205 return (uint64_t)ret;
24208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24209 LDKDirectionalChannelInfo this_obj_conv;
24210 this_obj_conv.inner = (void*)(this_obj & (~1));
24211 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24212 DirectionalChannelInfo_free(this_obj_conv);
24215 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
24216 LDKDirectionalChannelInfo this_ptr_conv;
24217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24218 this_ptr_conv.is_owned = false;
24219 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
24223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24224 LDKDirectionalChannelInfo this_ptr_conv;
24225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24226 this_ptr_conv.is_owned = false;
24227 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
24230 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
24231 LDKDirectionalChannelInfo this_ptr_conv;
24232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24233 this_ptr_conv.is_owned = false;
24234 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
24238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
24239 LDKDirectionalChannelInfo this_ptr_conv;
24240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24241 this_ptr_conv.is_owned = false;
24242 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
24245 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
24246 LDKDirectionalChannelInfo this_ptr_conv;
24247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24248 this_ptr_conv.is_owned = false;
24249 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
24253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
24254 LDKDirectionalChannelInfo this_ptr_conv;
24255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24256 this_ptr_conv.is_owned = false;
24257 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
24260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24261 LDKDirectionalChannelInfo this_ptr_conv;
24262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24263 this_ptr_conv.is_owned = false;
24264 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
24268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24269 LDKDirectionalChannelInfo this_ptr_conv;
24270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24271 this_ptr_conv.is_owned = false;
24272 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
24275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24276 LDKDirectionalChannelInfo this_ptr_conv;
24277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24278 this_ptr_conv.is_owned = false;
24279 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24280 *ret_copy = DirectionalChannelInfo_get_htlc_maximum_msat(&this_ptr_conv);
24281 uint64_t ret_ref = (uint64_t)ret_copy;
24285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1maximum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24286 LDKDirectionalChannelInfo this_ptr_conv;
24287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24288 this_ptr_conv.is_owned = false;
24289 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24290 DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
24293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24294 LDKDirectionalChannelInfo this_ptr_conv;
24295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24296 this_ptr_conv.is_owned = false;
24297 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
24298 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24299 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24300 uint64_t ret_ref = (uint64_t)ret_var.inner;
24301 if (ret_var.is_owned) {
24307 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24308 LDKDirectionalChannelInfo this_ptr_conv;
24309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24310 this_ptr_conv.is_owned = false;
24311 LDKRoutingFees val_conv;
24312 val_conv.inner = (void*)(val & (~1));
24313 val_conv.is_owned = (val & 1) || (val == 0);
24314 val_conv = RoutingFees_clone(&val_conv);
24315 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
24318 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
24319 LDKDirectionalChannelInfo this_ptr_conv;
24320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24321 this_ptr_conv.is_owned = false;
24322 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
24323 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24324 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24325 uint64_t ret_ref = (uint64_t)ret_var.inner;
24326 if (ret_var.is_owned) {
24332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24333 LDKDirectionalChannelInfo this_ptr_conv;
24334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24335 this_ptr_conv.is_owned = false;
24336 LDKChannelUpdate val_conv;
24337 val_conv.inner = (void*)(val & (~1));
24338 val_conv.is_owned = (val & 1) || (val == 0);
24339 val_conv = ChannelUpdate_clone(&val_conv);
24340 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
24343 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
24344 LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
24345 LDKRoutingFees fees_arg_conv;
24346 fees_arg_conv.inner = (void*)(fees_arg & (~1));
24347 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
24348 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
24349 LDKChannelUpdate last_update_message_arg_conv;
24350 last_update_message_arg_conv.inner = (void*)(last_update_message_arg & (~1));
24351 last_update_message_arg_conv.is_owned = (last_update_message_arg & 1) || (last_update_message_arg == 0);
24352 last_update_message_arg_conv = ChannelUpdate_clone(&last_update_message_arg_conv);
24353 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg_conv, fees_arg_conv, last_update_message_arg_conv);
24354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24356 uint64_t ret_ref = (uint64_t)ret_var.inner;
24357 if (ret_var.is_owned) {
24363 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24364 LDKDirectionalChannelInfo orig_conv;
24365 orig_conv.inner = (void*)(orig & (~1));
24366 orig_conv.is_owned = false;
24367 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_clone(&orig_conv);
24368 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24369 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24370 uint64_t ret_ref = (uint64_t)ret_var.inner;
24371 if (ret_var.is_owned) {
24377 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24378 LDKDirectionalChannelInfo obj_conv;
24379 obj_conv.inner = (void*)(obj & (~1));
24380 obj_conv.is_owned = false;
24381 LDKCVec_u8Z ret_var = DirectionalChannelInfo_write(&obj_conv);
24382 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24383 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24384 CVec_u8Z_free(ret_var);
24388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24389 LDKu8slice ser_ref;
24390 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24391 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24392 LDKCResult_DirectionalChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DirectionalChannelInfoDecodeErrorZ), "LDKCResult_DirectionalChannelInfoDecodeErrorZ");
24393 *ret_conv = DirectionalChannelInfo_read(ser_ref);
24394 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24395 return (uint64_t)ret_conv;
24398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24399 LDKChannelInfo this_obj_conv;
24400 this_obj_conv.inner = (void*)(this_obj & (~1));
24401 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24402 ChannelInfo_free(this_obj_conv);
24405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24406 LDKChannelInfo this_ptr_conv;
24407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24408 this_ptr_conv.is_owned = false;
24409 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
24410 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24411 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24412 uint64_t ret_ref = (uint64_t)ret_var.inner;
24413 if (ret_var.is_owned) {
24419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24420 LDKChannelInfo this_ptr_conv;
24421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24422 this_ptr_conv.is_owned = false;
24423 LDKChannelFeatures val_conv;
24424 val_conv.inner = (void*)(val & (~1));
24425 val_conv.is_owned = (val & 1) || (val == 0);
24426 val_conv = ChannelFeatures_clone(&val_conv);
24427 ChannelInfo_set_features(&this_ptr_conv, val_conv);
24430 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
24431 LDKChannelInfo this_ptr_conv;
24432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24433 this_ptr_conv.is_owned = false;
24434 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24435 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
24439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24440 LDKChannelInfo this_ptr_conv;
24441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24442 this_ptr_conv.is_owned = false;
24443 LDKPublicKey val_ref;
24444 CHECK((*env)->GetArrayLength(env, val) == 33);
24445 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24446 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
24449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
24450 LDKChannelInfo this_ptr_conv;
24451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24452 this_ptr_conv.is_owned = false;
24453 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
24454 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24455 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24456 uint64_t ret_ref = (uint64_t)ret_var.inner;
24457 if (ret_var.is_owned) {
24463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24464 LDKChannelInfo this_ptr_conv;
24465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24466 this_ptr_conv.is_owned = false;
24467 LDKDirectionalChannelInfo val_conv;
24468 val_conv.inner = (void*)(val & (~1));
24469 val_conv.is_owned = (val & 1) || (val == 0);
24470 val_conv = DirectionalChannelInfo_clone(&val_conv);
24471 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
24474 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
24475 LDKChannelInfo this_ptr_conv;
24476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24477 this_ptr_conv.is_owned = false;
24478 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
24479 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
24483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24484 LDKChannelInfo this_ptr_conv;
24485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24486 this_ptr_conv.is_owned = false;
24487 LDKPublicKey val_ref;
24488 CHECK((*env)->GetArrayLength(env, val) == 33);
24489 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
24490 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
24493 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
24494 LDKChannelInfo this_ptr_conv;
24495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24496 this_ptr_conv.is_owned = false;
24497 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
24498 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24499 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24500 uint64_t ret_ref = (uint64_t)ret_var.inner;
24501 if (ret_var.is_owned) {
24507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24508 LDKChannelInfo this_ptr_conv;
24509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24510 this_ptr_conv.is_owned = false;
24511 LDKDirectionalChannelInfo val_conv;
24512 val_conv.inner = (void*)(val & (~1));
24513 val_conv.is_owned = (val & 1) || (val == 0);
24514 val_conv = DirectionalChannelInfo_clone(&val_conv);
24515 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
24518 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr) {
24519 LDKChannelInfo this_ptr_conv;
24520 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24521 this_ptr_conv.is_owned = false;
24522 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
24523 *ret_copy = ChannelInfo_get_capacity_sats(&this_ptr_conv);
24524 uint64_t ret_ref = (uint64_t)ret_copy;
24528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1capacity_1sats(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24529 LDKChannelInfo this_ptr_conv;
24530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24531 this_ptr_conv.is_owned = false;
24532 LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
24533 ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
24536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
24537 LDKChannelInfo this_ptr_conv;
24538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24539 this_ptr_conv.is_owned = false;
24540 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
24541 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24542 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24543 uint64_t ret_ref = (uint64_t)ret_var.inner;
24544 if (ret_var.is_owned) {
24550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24551 LDKChannelInfo this_ptr_conv;
24552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24553 this_ptr_conv.is_owned = false;
24554 LDKChannelAnnouncement val_conv;
24555 val_conv.inner = (void*)(val & (~1));
24556 val_conv.is_owned = (val & 1) || (val == 0);
24557 val_conv = ChannelAnnouncement_clone(&val_conv);
24558 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
24561 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int8_tArray node_one_arg, int64_t one_to_two_arg, int8_tArray node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) {
24562 LDKChannelFeatures features_arg_conv;
24563 features_arg_conv.inner = (void*)(features_arg & (~1));
24564 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24565 features_arg_conv = ChannelFeatures_clone(&features_arg_conv);
24566 LDKPublicKey node_one_arg_ref;
24567 CHECK((*env)->GetArrayLength(env, node_one_arg) == 33);
24568 (*env)->GetByteArrayRegion(env, node_one_arg, 0, 33, node_one_arg_ref.compressed_form);
24569 LDKDirectionalChannelInfo one_to_two_arg_conv;
24570 one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1));
24571 one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0);
24572 one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv);
24573 LDKPublicKey node_two_arg_ref;
24574 CHECK((*env)->GetArrayLength(env, node_two_arg) == 33);
24575 (*env)->GetByteArrayRegion(env, node_two_arg, 0, 33, node_two_arg_ref.compressed_form);
24576 LDKDirectionalChannelInfo two_to_one_arg_conv;
24577 two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1));
24578 two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
24579 two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
24580 LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
24581 LDKChannelAnnouncement announcement_message_arg_conv;
24582 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24583 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24584 announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv);
24585 LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_ref, one_to_two_arg_conv, node_two_arg_ref, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv);
24586 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24587 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24588 uint64_t ret_ref = (uint64_t)ret_var.inner;
24589 if (ret_var.is_owned) {
24595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24596 LDKChannelInfo orig_conv;
24597 orig_conv.inner = (void*)(orig & (~1));
24598 orig_conv.is_owned = false;
24599 LDKChannelInfo ret_var = ChannelInfo_clone(&orig_conv);
24600 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24601 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24602 uint64_t ret_ref = (uint64_t)ret_var.inner;
24603 if (ret_var.is_owned) {
24609 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24610 LDKChannelInfo obj_conv;
24611 obj_conv.inner = (void*)(obj & (~1));
24612 obj_conv.is_owned = false;
24613 LDKCVec_u8Z ret_var = ChannelInfo_write(&obj_conv);
24614 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24615 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24616 CVec_u8Z_free(ret_var);
24620 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24621 LDKu8slice ser_ref;
24622 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24623 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24624 LDKCResult_ChannelInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelInfoDecodeErrorZ), "LDKCResult_ChannelInfoDecodeErrorZ");
24625 *ret_conv = ChannelInfo_read(ser_ref);
24626 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24627 return (uint64_t)ret_conv;
24630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24631 LDKRoutingFees this_obj_conv;
24632 this_obj_conv.inner = (void*)(this_obj & (~1));
24633 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24634 RoutingFees_free(this_obj_conv);
24637 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
24638 LDKRoutingFees this_ptr_conv;
24639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24640 this_ptr_conv.is_owned = false;
24641 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
24645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24646 LDKRoutingFees this_ptr_conv;
24647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24648 this_ptr_conv.is_owned = false;
24649 RoutingFees_set_base_msat(&this_ptr_conv, val);
24652 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
24653 LDKRoutingFees this_ptr_conv;
24654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24655 this_ptr_conv.is_owned = false;
24656 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
24660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24661 LDKRoutingFees this_ptr_conv;
24662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24663 this_ptr_conv.is_owned = false;
24664 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
24667 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) {
24668 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
24669 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24670 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24671 uint64_t ret_ref = (uint64_t)ret_var.inner;
24672 if (ret_var.is_owned) {
24678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingFees_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
24679 LDKRoutingFees a_conv;
24680 a_conv.inner = (void*)(a & (~1));
24681 a_conv.is_owned = false;
24682 LDKRoutingFees b_conv;
24683 b_conv.inner = (void*)(b & (~1));
24684 b_conv.is_owned = false;
24685 jboolean ret_val = RoutingFees_eq(&a_conv, &b_conv);
24689 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24690 LDKRoutingFees orig_conv;
24691 orig_conv.inner = (void*)(orig & (~1));
24692 orig_conv.is_owned = false;
24693 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
24694 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24695 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24696 uint64_t ret_ref = (uint64_t)ret_var.inner;
24697 if (ret_var.is_owned) {
24703 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
24704 LDKRoutingFees obj_conv;
24705 obj_conv.inner = (void*)(obj & (~1));
24706 obj_conv.is_owned = false;
24707 LDKCVec_u8Z ret_var = RoutingFees_write(&obj_conv);
24708 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24709 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24710 CVec_u8Z_free(ret_var);
24714 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24715 LDKu8slice ser_ref;
24716 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24717 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24718 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
24719 *ret_conv = RoutingFees_read(ser_ref);
24720 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24721 return (uint64_t)ret_conv;
24724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24725 LDKNodeAnnouncementInfo this_obj_conv;
24726 this_obj_conv.inner = (void*)(this_obj & (~1));
24727 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24728 NodeAnnouncementInfo_free(this_obj_conv);
24731 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
24732 LDKNodeAnnouncementInfo this_ptr_conv;
24733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24734 this_ptr_conv.is_owned = false;
24735 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
24736 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24737 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24738 uint64_t ret_ref = (uint64_t)ret_var.inner;
24739 if (ret_var.is_owned) {
24745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24746 LDKNodeAnnouncementInfo this_ptr_conv;
24747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24748 this_ptr_conv.is_owned = false;
24749 LDKNodeFeatures val_conv;
24750 val_conv.inner = (void*)(val & (~1));
24751 val_conv.is_owned = (val & 1) || (val == 0);
24752 val_conv = NodeFeatures_clone(&val_conv);
24753 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
24756 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
24757 LDKNodeAnnouncementInfo this_ptr_conv;
24758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24759 this_ptr_conv.is_owned = false;
24760 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
24764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
24765 LDKNodeAnnouncementInfo this_ptr_conv;
24766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24767 this_ptr_conv.is_owned = false;
24768 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
24771 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
24772 LDKNodeAnnouncementInfo this_ptr_conv;
24773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24774 this_ptr_conv.is_owned = false;
24775 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
24776 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
24780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24781 LDKNodeAnnouncementInfo this_ptr_conv;
24782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24783 this_ptr_conv.is_owned = false;
24784 LDKThreeBytes val_ref;
24785 CHECK((*env)->GetArrayLength(env, val) == 3);
24786 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
24787 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
24790 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
24791 LDKNodeAnnouncementInfo this_ptr_conv;
24792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24793 this_ptr_conv.is_owned = false;
24794 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
24795 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
24799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
24800 LDKNodeAnnouncementInfo this_ptr_conv;
24801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24802 this_ptr_conv.is_owned = false;
24803 LDKThirtyTwoBytes val_ref;
24804 CHECK((*env)->GetArrayLength(env, val) == 32);
24805 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
24806 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
24809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24810 LDKNodeAnnouncementInfo this_ptr_conv;
24811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24812 this_ptr_conv.is_owned = false;
24813 LDKCVec_NetAddressZ val_constr;
24814 val_constr.datalen = (*env)->GetArrayLength(env, val);
24815 if (val_constr.datalen > 0)
24816 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24818 val_constr.data = NULL;
24819 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24820 for (size_t m = 0; m < val_constr.datalen; m++) {
24821 int64_t val_conv_12 = val_vals[m];
24822 LDKNetAddress val_conv_12_conv = *(LDKNetAddress*)(((uint64_t)val_conv_12) & ~1);
24823 val_conv_12_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)val_conv_12) & ~1));
24824 val_constr.data[m] = val_conv_12_conv;
24826 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24827 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
24830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
24831 LDKNodeAnnouncementInfo this_ptr_conv;
24832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24833 this_ptr_conv.is_owned = false;
24834 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
24835 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24836 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24837 uint64_t ret_ref = (uint64_t)ret_var.inner;
24838 if (ret_var.is_owned) {
24844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24845 LDKNodeAnnouncementInfo this_ptr_conv;
24846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24847 this_ptr_conv.is_owned = false;
24848 LDKNodeAnnouncement val_conv;
24849 val_conv.inner = (void*)(val & (~1));
24850 val_conv.is_owned = (val & 1) || (val == 0);
24851 val_conv = NodeAnnouncement_clone(&val_conv);
24852 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
24855 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) {
24856 LDKNodeFeatures features_arg_conv;
24857 features_arg_conv.inner = (void*)(features_arg & (~1));
24858 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
24859 features_arg_conv = NodeFeatures_clone(&features_arg_conv);
24860 LDKThreeBytes rgb_arg_ref;
24861 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
24862 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
24863 LDKThirtyTwoBytes alias_arg_ref;
24864 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
24865 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
24866 LDKCVec_NetAddressZ addresses_arg_constr;
24867 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
24868 if (addresses_arg_constr.datalen > 0)
24869 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
24871 addresses_arg_constr.data = NULL;
24872 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
24873 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
24874 int64_t addresses_arg_conv_12 = addresses_arg_vals[m];
24875 LDKNetAddress addresses_arg_conv_12_conv = *(LDKNetAddress*)(((uint64_t)addresses_arg_conv_12) & ~1);
24876 addresses_arg_constr.data[m] = addresses_arg_conv_12_conv;
24878 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
24879 LDKNodeAnnouncement announcement_message_arg_conv;
24880 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
24881 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
24882 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
24883 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
24884 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24885 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24886 uint64_t ret_ref = (uint64_t)ret_var.inner;
24887 if (ret_var.is_owned) {
24893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
24894 LDKNodeAnnouncementInfo orig_conv;
24895 orig_conv.inner = (void*)(orig & (~1));
24896 orig_conv.is_owned = false;
24897 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_clone(&orig_conv);
24898 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24899 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24900 uint64_t ret_ref = (uint64_t)ret_var.inner;
24901 if (ret_var.is_owned) {
24907 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
24908 LDKNodeAnnouncementInfo obj_conv;
24909 obj_conv.inner = (void*)(obj & (~1));
24910 obj_conv.is_owned = false;
24911 LDKCVec_u8Z ret_var = NodeAnnouncementInfo_write(&obj_conv);
24912 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
24913 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
24914 CVec_u8Z_free(ret_var);
24918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
24919 LDKu8slice ser_ref;
24920 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
24921 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
24922 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
24923 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
24924 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
24925 return (uint64_t)ret_conv;
24928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
24929 LDKNodeInfo this_obj_conv;
24930 this_obj_conv.inner = (void*)(this_obj & (~1));
24931 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
24932 NodeInfo_free(this_obj_conv);
24935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
24936 LDKNodeInfo this_ptr_conv;
24937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24938 this_ptr_conv.is_owned = false;
24939 LDKCVec_u64Z val_constr;
24940 val_constr.datalen = (*env)->GetArrayLength(env, val);
24941 if (val_constr.datalen > 0)
24942 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
24944 val_constr.data = NULL;
24945 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
24946 for (size_t g = 0; g < val_constr.datalen; g++) {
24947 int64_t val_conv_6 = val_vals[g];
24948 val_constr.data[g] = val_conv_6;
24950 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
24951 NodeInfo_set_channels(&this_ptr_conv, val_constr);
24954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
24955 LDKNodeInfo this_ptr_conv;
24956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24957 this_ptr_conv.is_owned = false;
24958 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
24959 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24960 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24961 uint64_t ret_ref = (uint64_t)ret_var.inner;
24962 if (ret_var.is_owned) {
24968 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) {
24969 LDKNodeInfo this_ptr_conv;
24970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24971 this_ptr_conv.is_owned = false;
24972 LDKRoutingFees val_conv;
24973 val_conv.inner = (void*)(val & (~1));
24974 val_conv.is_owned = (val & 1) || (val == 0);
24975 val_conv = RoutingFees_clone(&val_conv);
24976 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
24979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
24980 LDKNodeInfo this_ptr_conv;
24981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24982 this_ptr_conv.is_owned = false;
24983 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
24984 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
24985 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
24986 uint64_t ret_ref = (uint64_t)ret_var.inner;
24987 if (ret_var.is_owned) {
24993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
24994 LDKNodeInfo this_ptr_conv;
24995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
24996 this_ptr_conv.is_owned = false;
24997 LDKNodeAnnouncementInfo val_conv;
24998 val_conv.inner = (void*)(val & (~1));
24999 val_conv.is_owned = (val & 1) || (val == 0);
25000 val_conv = NodeAnnouncementInfo_clone(&val_conv);
25001 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
25004 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) {
25005 LDKCVec_u64Z channels_arg_constr;
25006 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
25007 if (channels_arg_constr.datalen > 0)
25008 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
25010 channels_arg_constr.data = NULL;
25011 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
25012 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
25013 int64_t channels_arg_conv_6 = channels_arg_vals[g];
25014 channels_arg_constr.data[g] = channels_arg_conv_6;
25016 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
25017 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
25018 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
25019 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
25020 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
25021 LDKNodeAnnouncementInfo announcement_info_arg_conv;
25022 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
25023 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
25024 announcement_info_arg_conv = NodeAnnouncementInfo_clone(&announcement_info_arg_conv);
25025 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
25026 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25027 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25028 uint64_t ret_ref = (uint64_t)ret_var.inner;
25029 if (ret_var.is_owned) {
25035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25036 LDKNodeInfo orig_conv;
25037 orig_conv.inner = (void*)(orig & (~1));
25038 orig_conv.is_owned = false;
25039 LDKNodeInfo ret_var = NodeInfo_clone(&orig_conv);
25040 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25041 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25042 uint64_t ret_ref = (uint64_t)ret_var.inner;
25043 if (ret_var.is_owned) {
25049 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
25050 LDKNodeInfo obj_conv;
25051 obj_conv.inner = (void*)(obj & (~1));
25052 obj_conv.is_owned = false;
25053 LDKCVec_u8Z ret_var = NodeInfo_write(&obj_conv);
25054 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25055 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25056 CVec_u8Z_free(ret_var);
25060 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25061 LDKu8slice ser_ref;
25062 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25063 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25064 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
25065 *ret_conv = NodeInfo_read(ser_ref);
25066 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25067 return (uint64_t)ret_conv;
25070 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
25071 LDKNetworkGraph obj_conv;
25072 obj_conv.inner = (void*)(obj & (~1));
25073 obj_conv.is_owned = false;
25074 LDKCVec_u8Z ret_var = NetworkGraph_write(&obj_conv);
25075 int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
25076 (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
25077 CVec_u8Z_free(ret_var);
25081 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
25082 LDKu8slice ser_ref;
25083 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
25084 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
25085 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
25086 *ret_conv = NetworkGraph_read(ser_ref);
25087 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
25088 return (uint64_t)ret_conv;
25091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
25092 LDKThirtyTwoBytes genesis_hash_ref;
25093 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
25094 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
25095 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
25096 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25097 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25098 uint64_t ret_ref = (uint64_t)ret_var.inner;
25099 if (ret_var.is_owned) {
25105 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) {
25106 LDKNetworkGraph this_arg_conv;
25107 this_arg_conv.inner = (void*)(this_arg & (~1));
25108 this_arg_conv.is_owned = false;
25109 LDKNodeAnnouncement msg_conv;
25110 msg_conv.inner = (void*)(msg & (~1));
25111 msg_conv.is_owned = false;
25112 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25113 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
25114 return (uint64_t)ret_conv;
25117 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) {
25118 LDKNetworkGraph this_arg_conv;
25119 this_arg_conv.inner = (void*)(this_arg & (~1));
25120 this_arg_conv.is_owned = false;
25121 LDKUnsignedNodeAnnouncement msg_conv;
25122 msg_conv.inner = (void*)(msg & (~1));
25123 msg_conv.is_owned = false;
25124 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25125 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
25126 return (uint64_t)ret_conv;
25129 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) {
25130 LDKNetworkGraph this_arg_conv;
25131 this_arg_conv.inner = (void*)(this_arg & (~1));
25132 this_arg_conv.is_owned = false;
25133 LDKChannelAnnouncement msg_conv;
25134 msg_conv.inner = (void*)(msg & (~1));
25135 msg_conv.is_owned = false;
25136 LDKAccess *chain_access_conv_ptr = NULL;
25137 if (chain_access != 0) {
25138 LDKAccess chain_access_conv;
25139 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25140 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25141 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25142 LDKAccess_JCalls_cloned(&chain_access_conv);
25144 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25145 *chain_access_conv_ptr = chain_access_conv;
25147 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25148 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
25149 return (uint64_t)ret_conv;
25152 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) {
25153 LDKNetworkGraph this_arg_conv;
25154 this_arg_conv.inner = (void*)(this_arg & (~1));
25155 this_arg_conv.is_owned = false;
25156 LDKUnsignedChannelAnnouncement msg_conv;
25157 msg_conv.inner = (void*)(msg & (~1));
25158 msg_conv.is_owned = false;
25159 LDKAccess *chain_access_conv_ptr = NULL;
25160 if (chain_access != 0) {
25161 LDKAccess chain_access_conv;
25162 chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
25163 if (chain_access_conv.free == LDKAccess_JCalls_free) {
25164 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25165 LDKAccess_JCalls_cloned(&chain_access_conv);
25167 chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
25168 *chain_access_conv_ptr = chain_access_conv;
25170 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25171 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
25172 return (uint64_t)ret_conv;
25175 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) {
25176 LDKNetworkGraph this_arg_conv;
25177 this_arg_conv.inner = (void*)(this_arg & (~1));
25178 this_arg_conv.is_owned = false;
25179 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
25182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
25183 LDKNetworkGraph this_arg_conv;
25184 this_arg_conv.inner = (void*)(this_arg & (~1));
25185 this_arg_conv.is_owned = false;
25186 LDKChannelUpdate msg_conv;
25187 msg_conv.inner = (void*)(msg & (~1));
25188 msg_conv.is_owned = false;
25189 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25190 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
25191 return (uint64_t)ret_conv;
25194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
25195 LDKNetworkGraph this_arg_conv;
25196 this_arg_conv.inner = (void*)(this_arg & (~1));
25197 this_arg_conv.is_owned = false;
25198 LDKUnsignedChannelUpdate msg_conv;
25199 msg_conv.inner = (void*)(msg & (~1));
25200 msg_conv.is_owned = false;
25201 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
25202 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
25203 return (uint64_t)ret_conv;
25206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25207 LDKFilesystemPersister this_obj_conv;
25208 this_obj_conv.inner = (void*)(this_obj & (~1));
25209 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25210 FilesystemPersister_free(this_obj_conv);
25213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1new(JNIEnv *env, jclass clz, jstring path_to_channel_data) {
25214 LDKStr path_to_channel_data_conv = java_to_owned_str(env, path_to_channel_data);
25215 LDKFilesystemPersister ret_var = FilesystemPersister_new(path_to_channel_data_conv);
25216 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25217 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25218 uint64_t ret_ref = (uint64_t)ret_var.inner;
25219 if (ret_var.is_owned) {
25225 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1get_1data_1dir(JNIEnv *env, jclass clz, int64_t this_arg) {
25226 LDKFilesystemPersister this_arg_conv;
25227 this_arg_conv.inner = (void*)(this_arg & (~1));
25228 this_arg_conv.is_owned = false;
25229 LDKStr ret_str = FilesystemPersister_get_data_dir(&this_arg_conv);
25230 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
25235 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1persist_1manager(JNIEnv *env, jclass clz, jstring data_dir, int64_t manager) {
25236 LDKStr data_dir_conv = java_to_owned_str(env, data_dir);
25237 LDKChannelManager manager_conv;
25238 manager_conv.inner = (void*)(manager & (~1));
25239 manager_conv.is_owned = false;
25240 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25241 *ret_conv = FilesystemPersister_persist_manager(data_dir_conv, &manager_conv);
25242 return (uint64_t)ret_conv;
25245 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1read_1channelmonitors(JNIEnv *env, jclass clz, int64_t this_arg, int64_t keys_manager) {
25246 LDKFilesystemPersister this_arg_conv;
25247 this_arg_conv.inner = (void*)(this_arg & (~1));
25248 this_arg_conv.is_owned = false;
25249 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
25250 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
25251 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25252 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
25254 LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ), "LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ");
25255 *ret_conv = FilesystemPersister_read_channelmonitors(&this_arg_conv, keys_manager_conv);
25256 return (uint64_t)ret_conv;
25259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FilesystemPersister_1as_1Persist(JNIEnv *env, jclass clz, int64_t this_arg) {
25260 LDKFilesystemPersister this_arg_conv;
25261 this_arg_conv.inner = (void*)(this_arg & (~1));
25262 this_arg_conv.is_owned = false;
25263 LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
25264 *ret = FilesystemPersister_as_Persist(&this_arg_conv);
25265 return (uint64_t)ret;
25268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25269 LDKBackgroundProcessor this_obj_conv;
25270 this_obj_conv.inner = (void*)(this_obj & (~1));
25271 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25272 BackgroundProcessor_free(this_obj_conv);
25275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerPersister_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25276 if ((this_ptr & 1) != 0) return;
25277 LDKChannelManagerPersister this_ptr_conv = *(LDKChannelManagerPersister*)(((uint64_t)this_ptr) & ~1);
25278 FREE((void*)this_ptr);
25279 ChannelManagerPersister_free(this_ptr_conv);
25282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t peer_manager, int64_t logger) {
25283 LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
25284 if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
25285 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25286 LDKChannelManagerPersister_JCalls_cloned(&persister_conv);
25288 LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
25289 if (event_handler_conv.free == LDKEventHandler_JCalls_free) {
25290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25291 LDKEventHandler_JCalls_cloned(&event_handler_conv);
25293 LDKChainMonitor chain_monitor_conv;
25294 chain_monitor_conv.inner = (void*)(chain_monitor & (~1));
25295 chain_monitor_conv.is_owned = false;
25296 LDKChannelManager channel_manager_conv;
25297 channel_manager_conv.inner = (void*)(channel_manager & (~1));
25298 channel_manager_conv.is_owned = false;
25299 LDKPeerManager peer_manager_conv;
25300 peer_manager_conv.inner = (void*)(peer_manager & (~1));
25301 peer_manager_conv.is_owned = false;
25302 LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
25303 if (logger_conv.free == LDKLogger_JCalls_free) {
25304 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
25305 LDKLogger_JCalls_cloned(&logger_conv);
25307 LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
25308 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25309 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25310 uint64_t ret_ref = (uint64_t)ret_var.inner;
25311 if (ret_var.is_owned) {
25317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1stop(JNIEnv *env, jclass clz, int64_t this_arg) {
25318 LDKBackgroundProcessor this_arg_conv;
25319 this_arg_conv.inner = (void*)(this_arg & (~1));
25320 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25321 // Warning: we need a move here but no clone is available for LDKBackgroundProcessor
25322 LDKCResult_NoneErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneErrorZ), "LDKCResult_NoneErrorZ");
25323 *ret_conv = BackgroundProcessor_stop(this_arg_conv);
25324 return (uint64_t)ret_conv;
25327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_check_1platform(JNIEnv *env, jclass clz) {
25331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Invoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25332 LDKInvoice this_obj_conv;
25333 this_obj_conv.inner = (void*)(this_obj & (~1));
25334 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25335 Invoice_free(this_obj_conv);
25338 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Invoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25340 a_conv.inner = (void*)(a & (~1));
25341 a_conv.is_owned = false;
25343 b_conv.inner = (void*)(b & (~1));
25344 b_conv.is_owned = false;
25345 jboolean ret_val = Invoice_eq(&a_conv, &b_conv);
25349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25350 LDKInvoice orig_conv;
25351 orig_conv.inner = (void*)(orig & (~1));
25352 orig_conv.is_owned = false;
25353 LDKInvoice ret_var = Invoice_clone(&orig_conv);
25354 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25355 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25356 uint64_t ret_ref = (uint64_t)ret_var.inner;
25357 if (ret_var.is_owned) {
25363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25364 LDKSignedRawInvoice this_obj_conv;
25365 this_obj_conv.inner = (void*)(this_obj & (~1));
25366 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25367 SignedRawInvoice_free(this_obj_conv);
25370 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25371 LDKSignedRawInvoice a_conv;
25372 a_conv.inner = (void*)(a & (~1));
25373 a_conv.is_owned = false;
25374 LDKSignedRawInvoice b_conv;
25375 b_conv.inner = (void*)(b & (~1));
25376 b_conv.is_owned = false;
25377 jboolean ret_val = SignedRawInvoice_eq(&a_conv, &b_conv);
25381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25382 LDKSignedRawInvoice orig_conv;
25383 orig_conv.inner = (void*)(orig & (~1));
25384 orig_conv.is_owned = false;
25385 LDKSignedRawInvoice ret_var = SignedRawInvoice_clone(&orig_conv);
25386 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25387 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25388 uint64_t ret_ref = (uint64_t)ret_var.inner;
25389 if (ret_var.is_owned) {
25395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25396 LDKRawInvoice this_obj_conv;
25397 this_obj_conv.inner = (void*)(this_obj & (~1));
25398 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25399 RawInvoice_free(this_obj_conv);
25402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
25403 LDKRawInvoice this_ptr_conv;
25404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25405 this_ptr_conv.is_owned = false;
25406 LDKRawDataPart ret_var = RawInvoice_get_data(&this_ptr_conv);
25407 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25408 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25409 uint64_t ret_ref = (uint64_t)ret_var.inner;
25410 if (ret_var.is_owned) {
25416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawInvoice_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25417 LDKRawInvoice this_ptr_conv;
25418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25419 this_ptr_conv.is_owned = false;
25420 LDKRawDataPart val_conv;
25421 val_conv.inner = (void*)(val & (~1));
25422 val_conv.is_owned = (val & 1) || (val == 0);
25423 val_conv = RawDataPart_clone(&val_conv);
25424 RawInvoice_set_data(&this_ptr_conv, val_conv);
25427 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawInvoice_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25428 LDKRawInvoice a_conv;
25429 a_conv.inner = (void*)(a & (~1));
25430 a_conv.is_owned = false;
25431 LDKRawInvoice b_conv;
25432 b_conv.inner = (void*)(b & (~1));
25433 b_conv.is_owned = false;
25434 jboolean ret_val = RawInvoice_eq(&a_conv, &b_conv);
25438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25439 LDKRawInvoice orig_conv;
25440 orig_conv.inner = (void*)(orig & (~1));
25441 orig_conv.is_owned = false;
25442 LDKRawInvoice ret_var = RawInvoice_clone(&orig_conv);
25443 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25444 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25445 uint64_t ret_ref = (uint64_t)ret_var.inner;
25446 if (ret_var.is_owned) {
25452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25453 LDKRawDataPart this_obj_conv;
25454 this_obj_conv.inner = (void*)(this_obj & (~1));
25455 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25456 RawDataPart_free(this_obj_conv);
25459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
25460 LDKRawDataPart this_ptr_conv;
25461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25462 this_ptr_conv.is_owned = false;
25463 LDKPositiveTimestamp ret_var = RawDataPart_get_timestamp(&this_ptr_conv);
25464 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25465 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25466 uint64_t ret_ref = (uint64_t)ret_var.inner;
25467 if (ret_var.is_owned) {
25473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RawDataPart_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
25474 LDKRawDataPart this_ptr_conv;
25475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
25476 this_ptr_conv.is_owned = false;
25477 LDKPositiveTimestamp val_conv;
25478 val_conv.inner = (void*)(val & (~1));
25479 val_conv.is_owned = (val & 1) || (val == 0);
25480 val_conv = PositiveTimestamp_clone(&val_conv);
25481 RawDataPart_set_timestamp(&this_ptr_conv, val_conv);
25484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RawDataPart_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25485 LDKRawDataPart a_conv;
25486 a_conv.inner = (void*)(a & (~1));
25487 a_conv.is_owned = false;
25488 LDKRawDataPart b_conv;
25489 b_conv.inner = (void*)(b & (~1));
25490 b_conv.is_owned = false;
25491 jboolean ret_val = RawDataPart_eq(&a_conv, &b_conv);
25495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawDataPart_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25496 LDKRawDataPart orig_conv;
25497 orig_conv.inner = (void*)(orig & (~1));
25498 orig_conv.is_owned = false;
25499 LDKRawDataPart ret_var = RawDataPart_clone(&orig_conv);
25500 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25501 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25502 uint64_t ret_ref = (uint64_t)ret_var.inner;
25503 if (ret_var.is_owned) {
25509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25510 LDKPositiveTimestamp this_obj_conv;
25511 this_obj_conv.inner = (void*)(this_obj & (~1));
25512 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25513 PositiveTimestamp_free(this_obj_conv);
25516 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25517 LDKPositiveTimestamp a_conv;
25518 a_conv.inner = (void*)(a & (~1));
25519 a_conv.is_owned = false;
25520 LDKPositiveTimestamp b_conv;
25521 b_conv.inner = (void*)(b & (~1));
25522 b_conv.is_owned = false;
25523 jboolean ret_val = PositiveTimestamp_eq(&a_conv, &b_conv);
25527 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25528 LDKPositiveTimestamp orig_conv;
25529 orig_conv.inner = (void*)(orig & (~1));
25530 orig_conv.is_owned = false;
25531 LDKPositiveTimestamp ret_var = PositiveTimestamp_clone(&orig_conv);
25532 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25533 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25534 uint64_t ret_ref = (uint64_t)ret_var.inner;
25535 if (ret_var.is_owned) {
25541 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SiPrefix_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25542 LDKSiPrefix* orig_conv = (LDKSiPrefix*)(orig & ~1);
25543 jclass ret_conv = LDKSiPrefix_to_java(env, SiPrefix_clone(orig_conv));
25547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SiPrefix_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25548 LDKSiPrefix* a_conv = (LDKSiPrefix*)(a & ~1);
25549 LDKSiPrefix* b_conv = (LDKSiPrefix*)(b & ~1);
25550 jboolean ret_val = SiPrefix_eq(a_conv, b_conv);
25554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1multiplier(JNIEnv *env, jclass clz, int64_t this_arg) {
25555 LDKSiPrefix* this_arg_conv = (LDKSiPrefix*)(this_arg & ~1);
25556 int64_t ret_val = SiPrefix_multiplier(this_arg_conv);
25560 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Currency_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25561 LDKCurrency* orig_conv = (LDKCurrency*)(orig & ~1);
25562 jclass ret_conv = LDKCurrency_to_java(env, Currency_clone(orig_conv));
25566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25567 LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
25568 LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
25569 jboolean ret_val = Currency_eq(a_conv, b_conv);
25573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25574 LDKSha256 this_obj_conv;
25575 this_obj_conv.inner = (void*)(this_obj & (~1));
25576 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25577 Sha256_free(this_obj_conv);
25580 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25582 a_conv.inner = (void*)(a & (~1));
25583 a_conv.is_owned = false;
25585 b_conv.inner = (void*)(b & (~1));
25586 b_conv.is_owned = false;
25587 jboolean ret_val = Sha256_eq(&a_conv, &b_conv);
25591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25592 LDKSha256 orig_conv;
25593 orig_conv.inner = (void*)(orig & (~1));
25594 orig_conv.is_owned = false;
25595 LDKSha256 ret_var = Sha256_clone(&orig_conv);
25596 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25597 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25598 uint64_t ret_ref = (uint64_t)ret_var.inner;
25599 if (ret_var.is_owned) {
25605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25606 LDKDescription this_obj_conv;
25607 this_obj_conv.inner = (void*)(this_obj & (~1));
25608 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25609 Description_free(this_obj_conv);
25612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25613 LDKDescription a_conv;
25614 a_conv.inner = (void*)(a & (~1));
25615 a_conv.is_owned = false;
25616 LDKDescription b_conv;
25617 b_conv.inner = (void*)(b & (~1));
25618 b_conv.is_owned = false;
25619 jboolean ret_val = Description_eq(&a_conv, &b_conv);
25623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25624 LDKDescription orig_conv;
25625 orig_conv.inner = (void*)(orig & (~1));
25626 orig_conv.is_owned = false;
25627 LDKDescription ret_var = Description_clone(&orig_conv);
25628 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25629 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25630 uint64_t ret_ref = (uint64_t)ret_var.inner;
25631 if (ret_var.is_owned) {
25637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25638 LDKPayeePubKey this_obj_conv;
25639 this_obj_conv.inner = (void*)(this_obj & (~1));
25640 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25641 PayeePubKey_free(this_obj_conv);
25644 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25645 LDKPayeePubKey a_conv;
25646 a_conv.inner = (void*)(a & (~1));
25647 a_conv.is_owned = false;
25648 LDKPayeePubKey b_conv;
25649 b_conv.inner = (void*)(b & (~1));
25650 b_conv.is_owned = false;
25651 jboolean ret_val = PayeePubKey_eq(&a_conv, &b_conv);
25655 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25656 LDKPayeePubKey orig_conv;
25657 orig_conv.inner = (void*)(orig & (~1));
25658 orig_conv.is_owned = false;
25659 LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
25660 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25661 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25662 uint64_t ret_ref = (uint64_t)ret_var.inner;
25663 if (ret_var.is_owned) {
25669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25670 LDKExpiryTime this_obj_conv;
25671 this_obj_conv.inner = (void*)(this_obj & (~1));
25672 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25673 ExpiryTime_free(this_obj_conv);
25676 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25677 LDKExpiryTime a_conv;
25678 a_conv.inner = (void*)(a & (~1));
25679 a_conv.is_owned = false;
25680 LDKExpiryTime b_conv;
25681 b_conv.inner = (void*)(b & (~1));
25682 b_conv.is_owned = false;
25683 jboolean ret_val = ExpiryTime_eq(&a_conv, &b_conv);
25687 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25688 LDKExpiryTime orig_conv;
25689 orig_conv.inner = (void*)(orig & (~1));
25690 orig_conv.is_owned = false;
25691 LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
25692 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25693 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25694 uint64_t ret_ref = (uint64_t)ret_var.inner;
25695 if (ret_var.is_owned) {
25701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25702 LDKMinFinalCltvExpiry this_obj_conv;
25703 this_obj_conv.inner = (void*)(this_obj & (~1));
25704 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25705 MinFinalCltvExpiry_free(this_obj_conv);
25708 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25709 LDKMinFinalCltvExpiry a_conv;
25710 a_conv.inner = (void*)(a & (~1));
25711 a_conv.is_owned = false;
25712 LDKMinFinalCltvExpiry b_conv;
25713 b_conv.inner = (void*)(b & (~1));
25714 b_conv.is_owned = false;
25715 jboolean ret_val = MinFinalCltvExpiry_eq(&a_conv, &b_conv);
25719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25720 LDKMinFinalCltvExpiry orig_conv;
25721 orig_conv.inner = (void*)(orig & (~1));
25722 orig_conv.is_owned = false;
25723 LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
25724 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25725 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25726 uint64_t ret_ref = (uint64_t)ret_var.inner;
25727 if (ret_var.is_owned) {
25733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
25734 if ((this_ptr & 1) != 0) return;
25735 LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
25736 FREE((void*)this_ptr);
25737 Fallback_free(this_ptr_conv);
25740 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25741 LDKFallback* orig_conv = (LDKFallback*)orig;
25742 LDKFallback *ret_copy = MALLOC(sizeof(LDKFallback), "LDKFallback");
25743 *ret_copy = Fallback_clone(orig_conv);
25744 uint64_t ret_ref = (uint64_t)ret_copy;
25748 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25749 LDKFallback* a_conv = (LDKFallback*)a;
25750 LDKFallback* b_conv = (LDKFallback*)b;
25751 jboolean ret_val = Fallback_eq(a_conv, b_conv);
25755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25756 LDKInvoiceSignature this_obj_conv;
25757 this_obj_conv.inner = (void*)(this_obj & (~1));
25758 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25759 InvoiceSignature_free(this_obj_conv);
25762 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25763 LDKInvoiceSignature a_conv;
25764 a_conv.inner = (void*)(a & (~1));
25765 a_conv.is_owned = false;
25766 LDKInvoiceSignature b_conv;
25767 b_conv.inner = (void*)(b & (~1));
25768 b_conv.is_owned = false;
25769 jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
25773 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25774 LDKInvoiceSignature orig_conv;
25775 orig_conv.inner = (void*)(orig & (~1));
25776 orig_conv.is_owned = false;
25777 LDKInvoiceSignature ret_var = InvoiceSignature_clone(&orig_conv);
25778 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25779 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25780 uint64_t ret_ref = (uint64_t)ret_var.inner;
25781 if (ret_var.is_owned) {
25787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
25788 LDKPrivateRoute this_obj_conv;
25789 this_obj_conv.inner = (void*)(this_obj & (~1));
25790 this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
25791 PrivateRoute_free(this_obj_conv);
25794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
25795 LDKPrivateRoute a_conv;
25796 a_conv.inner = (void*)(a & (~1));
25797 a_conv.is_owned = false;
25798 LDKPrivateRoute b_conv;
25799 b_conv.inner = (void*)(b & (~1));
25800 b_conv.is_owned = false;
25801 jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
25805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
25806 LDKPrivateRoute orig_conv;
25807 orig_conv.inner = (void*)(orig & (~1));
25808 orig_conv.is_owned = false;
25809 LDKPrivateRoute ret_var = PrivateRoute_clone(&orig_conv);
25810 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25811 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25812 uint64_t ret_ref = (uint64_t)ret_var.inner;
25813 if (ret_var.is_owned) {
25819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
25820 LDKSignedRawInvoice this_arg_conv;
25821 this_arg_conv.inner = (void*)(this_arg & (~1));
25822 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
25823 this_arg_conv = SignedRawInvoice_clone(&this_arg_conv);
25824 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ), "LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ");
25825 *ret_ref = SignedRawInvoice_into_parts(this_arg_conv);
25826 return (uint64_t)ret_ref;
25829 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1raw_1invoice(JNIEnv *env, jclass clz, int64_t this_arg) {
25830 LDKSignedRawInvoice this_arg_conv;
25831 this_arg_conv.inner = (void*)(this_arg & (~1));
25832 this_arg_conv.is_owned = false;
25833 LDKRawInvoice ret_var = SignedRawInvoice_raw_invoice(&this_arg_conv);
25834 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25835 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25836 uint64_t ret_ref = (uint64_t)ret_var.inner;
25837 if (ret_var.is_owned) {
25843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25844 LDKSignedRawInvoice this_arg_conv;
25845 this_arg_conv.inner = (void*)(this_arg & (~1));
25846 this_arg_conv.is_owned = false;
25847 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *SignedRawInvoice_hash(&this_arg_conv));
25852 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25853 LDKSignedRawInvoice this_arg_conv;
25854 this_arg_conv.inner = (void*)(this_arg & (~1));
25855 this_arg_conv.is_owned = false;
25856 LDKInvoiceSignature ret_var = SignedRawInvoice_signature(&this_arg_conv);
25857 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25858 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25859 uint64_t ret_ref = (uint64_t)ret_var.inner;
25860 if (ret_var.is_owned) {
25866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25867 LDKSignedRawInvoice this_arg_conv;
25868 this_arg_conv.inner = (void*)(this_arg & (~1));
25869 this_arg_conv.is_owned = false;
25870 LDKCResult_PayeePubKeyErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PayeePubKeyErrorZ), "LDKCResult_PayeePubKeyErrorZ");
25871 *ret_conv = SignedRawInvoice_recover_payee_pub_key(&this_arg_conv);
25872 return (uint64_t)ret_conv;
25875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
25876 LDKSignedRawInvoice this_arg_conv;
25877 this_arg_conv.inner = (void*)(this_arg & (~1));
25878 this_arg_conv.is_owned = false;
25879 jboolean ret_val = SignedRawInvoice_check_signature(&this_arg_conv);
25883 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25884 LDKRawInvoice this_arg_conv;
25885 this_arg_conv.inner = (void*)(this_arg & (~1));
25886 this_arg_conv.is_owned = false;
25887 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25888 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_hash(&this_arg_conv).data);
25892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25893 LDKRawInvoice this_arg_conv;
25894 this_arg_conv.inner = (void*)(this_arg & (~1));
25895 this_arg_conv.is_owned = false;
25896 LDKSha256 ret_var = RawInvoice_payment_hash(&this_arg_conv);
25897 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25898 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25899 uint64_t ret_ref = (uint64_t)ret_var.inner;
25900 if (ret_var.is_owned) {
25906 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description(JNIEnv *env, jclass clz, int64_t this_arg) {
25907 LDKRawInvoice this_arg_conv;
25908 this_arg_conv.inner = (void*)(this_arg & (~1));
25909 this_arg_conv.is_owned = false;
25910 LDKDescription ret_var = RawInvoice_description(&this_arg_conv);
25911 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25912 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25913 uint64_t ret_ref = (uint64_t)ret_var.inner;
25914 if (ret_var.is_owned) {
25920 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
25921 LDKRawInvoice this_arg_conv;
25922 this_arg_conv.inner = (void*)(this_arg & (~1));
25923 this_arg_conv.is_owned = false;
25924 LDKPayeePubKey ret_var = RawInvoice_payee_pub_key(&this_arg_conv);
25925 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25926 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25927 uint64_t ret_ref = (uint64_t)ret_var.inner;
25928 if (ret_var.is_owned) {
25934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1description_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
25935 LDKRawInvoice this_arg_conv;
25936 this_arg_conv.inner = (void*)(this_arg & (~1));
25937 this_arg_conv.is_owned = false;
25938 LDKSha256 ret_var = RawInvoice_description_hash(&this_arg_conv);
25939 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25940 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25941 uint64_t ret_ref = (uint64_t)ret_var.inner;
25942 if (ret_var.is_owned) {
25948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
25949 LDKRawInvoice this_arg_conv;
25950 this_arg_conv.inner = (void*)(this_arg & (~1));
25951 this_arg_conv.is_owned = false;
25952 LDKExpiryTime ret_var = RawInvoice_expiry_time(&this_arg_conv);
25953 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25954 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25955 uint64_t ret_ref = (uint64_t)ret_var.inner;
25956 if (ret_var.is_owned) {
25962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
25963 LDKRawInvoice this_arg_conv;
25964 this_arg_conv.inner = (void*)(this_arg & (~1));
25965 this_arg_conv.is_owned = false;
25966 LDKMinFinalCltvExpiry ret_var = RawInvoice_min_final_cltv_expiry(&this_arg_conv);
25967 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25968 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25969 uint64_t ret_ref = (uint64_t)ret_var.inner;
25970 if (ret_var.is_owned) {
25976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
25977 LDKRawInvoice this_arg_conv;
25978 this_arg_conv.inner = (void*)(this_arg & (~1));
25979 this_arg_conv.is_owned = false;
25980 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
25981 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, RawInvoice_payment_secret(&this_arg_conv).data);
25985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
25986 LDKRawInvoice this_arg_conv;
25987 this_arg_conv.inner = (void*)(this_arg & (~1));
25988 this_arg_conv.is_owned = false;
25989 LDKInvoiceFeatures ret_var = RawInvoice_features(&this_arg_conv);
25990 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
25991 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
25992 uint64_t ret_ref = (uint64_t)ret_var.inner;
25993 if (ret_var.is_owned) {
25999 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RawInvoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
26000 LDKRawInvoice this_arg_conv;
26001 this_arg_conv.inner = (void*)(this_arg & (~1));
26002 this_arg_conv.is_owned = false;
26003 LDKCVec_PrivateRouteZ ret_var = RawInvoice_private_routes(&this_arg_conv);
26004 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26005 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26006 for (size_t o = 0; o < ret_var.datalen; o++) {
26007 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
26008 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26009 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26010 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
26011 if (ret_conv_14_var.is_owned) {
26012 ret_conv_14_ref |= 1;
26014 ret_arr_ptr[o] = ret_conv_14_ref;
26016 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26017 FREE(ret_var.data);
26021 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RawInvoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
26022 LDKRawInvoice this_arg_conv;
26023 this_arg_conv.inner = (void*)(this_arg & (~1));
26024 this_arg_conv.is_owned = false;
26025 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26026 *ret_copy = RawInvoice_amount_pico_btc(&this_arg_conv);
26027 uint64_t ret_ref = (uint64_t)ret_copy;
26031 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_RawInvoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
26032 LDKRawInvoice this_arg_conv;
26033 this_arg_conv.inner = (void*)(this_arg & (~1));
26034 this_arg_conv.is_owned = false;
26035 jclass ret_conv = LDKCurrency_to_java(env, RawInvoice_currency(&this_arg_conv));
26039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t unix_seconds) {
26040 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
26041 *ret_conv = PositiveTimestamp_from_unix_timestamp(unix_seconds);
26042 return (uint64_t)ret_conv;
26045 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1from_1system_1time(JNIEnv *env, jclass clz, int64_t time) {
26046 LDKCResult_PositiveTimestampCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PositiveTimestampCreationErrorZ), "LDKCResult_PositiveTimestampCreationErrorZ");
26047 *ret_conv = PositiveTimestamp_from_system_time(time);
26048 return (uint64_t)ret_conv;
26051 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1unix_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
26052 LDKPositiveTimestamp this_arg_conv;
26053 this_arg_conv.inner = (void*)(this_arg & (~1));
26054 this_arg_conv.is_owned = false;
26055 int64_t ret_val = PositiveTimestamp_as_unix_timestamp(&this_arg_conv);
26059 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PositiveTimestamp_1as_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
26060 LDKPositiveTimestamp this_arg_conv;
26061 this_arg_conv.inner = (void*)(this_arg & (~1));
26062 this_arg_conv.is_owned = false;
26063 int64_t ret_val = PositiveTimestamp_as_time(&this_arg_conv);
26067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1into_1signed_1raw(JNIEnv *env, jclass clz, int64_t this_arg) {
26068 LDKInvoice this_arg_conv;
26069 this_arg_conv.inner = (void*)(this_arg & (~1));
26070 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26071 this_arg_conv = Invoice_clone(&this_arg_conv);
26072 LDKSignedRawInvoice ret_var = Invoice_into_signed_raw(this_arg_conv);
26073 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26074 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26075 uint64_t ret_ref = (uint64_t)ret_var.inner;
26076 if (ret_var.is_owned) {
26082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1check_1signature(JNIEnv *env, jclass clz, int64_t this_arg) {
26083 LDKInvoice this_arg_conv;
26084 this_arg_conv.inner = (void*)(this_arg & (~1));
26085 this_arg_conv.is_owned = false;
26086 LDKCResult_NoneSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneSemanticErrorZ), "LDKCResult_NoneSemanticErrorZ");
26087 *ret_conv = Invoice_check_signature(&this_arg_conv);
26088 return (uint64_t)ret_conv;
26091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1signed(JNIEnv *env, jclass clz, int64_t signed_invoice) {
26092 LDKSignedRawInvoice signed_invoice_conv;
26093 signed_invoice_conv.inner = (void*)(signed_invoice & (~1));
26094 signed_invoice_conv.is_owned = (signed_invoice & 1) || (signed_invoice == 0);
26095 signed_invoice_conv = SignedRawInvoice_clone(&signed_invoice_conv);
26096 LDKCResult_InvoiceSemanticErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSemanticErrorZ), "LDKCResult_InvoiceSemanticErrorZ");
26097 *ret_conv = Invoice_from_signed(signed_invoice_conv);
26098 return (uint64_t)ret_conv;
26101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1timestamp(JNIEnv *env, jclass clz, int64_t this_arg) {
26102 LDKInvoice this_arg_conv;
26103 this_arg_conv.inner = (void*)(this_arg & (~1));
26104 this_arg_conv.is_owned = false;
26105 int64_t ret_val = Invoice_timestamp(&this_arg_conv);
26109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
26110 LDKInvoice this_arg_conv;
26111 this_arg_conv.inner = (void*)(this_arg & (~1));
26112 this_arg_conv.is_owned = false;
26113 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26114 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Invoice_payment_hash(&this_arg_conv));
26118 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
26119 LDKInvoice this_arg_conv;
26120 this_arg_conv.inner = (void*)(this_arg & (~1));
26121 this_arg_conv.is_owned = false;
26122 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26123 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_payee_pub_key(&this_arg_conv).compressed_form);
26127 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
26128 LDKInvoice this_arg_conv;
26129 this_arg_conv.inner = (void*)(this_arg & (~1));
26130 this_arg_conv.is_owned = false;
26131 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
26132 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, Invoice_payment_secret(&this_arg_conv).data);
26136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1features(JNIEnv *env, jclass clz, int64_t this_arg) {
26137 LDKInvoice this_arg_conv;
26138 this_arg_conv.inner = (void*)(this_arg & (~1));
26139 this_arg_conv.is_owned = false;
26140 LDKInvoiceFeatures ret_var = Invoice_features(&this_arg_conv);
26141 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26142 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26143 uint64_t ret_ref = (uint64_t)ret_var.inner;
26144 if (ret_var.is_owned) {
26150 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1recover_1payee_1pub_1key(JNIEnv *env, jclass clz, int64_t this_arg) {
26151 LDKInvoice this_arg_conv;
26152 this_arg_conv.inner = (void*)(this_arg & (~1));
26153 this_arg_conv.is_owned = false;
26154 int8_tArray ret_arr = (*env)->NewByteArray(env, 33);
26155 (*env)->SetByteArrayRegion(env, ret_arr, 0, 33, Invoice_recover_payee_pub_key(&this_arg_conv).compressed_form);
26159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1expiry_1time(JNIEnv *env, jclass clz, int64_t this_arg) {
26160 LDKInvoice this_arg_conv;
26161 this_arg_conv.inner = (void*)(this_arg & (~1));
26162 this_arg_conv.is_owned = false;
26163 int64_t ret_val = Invoice_expiry_time(&this_arg_conv);
26167 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1min_1final_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_arg) {
26168 LDKInvoice this_arg_conv;
26169 this_arg_conv.inner = (void*)(this_arg & (~1));
26170 this_arg_conv.is_owned = false;
26171 int64_t ret_val = Invoice_min_final_cltv_expiry(&this_arg_conv);
26175 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1private_1routes(JNIEnv *env, jclass clz, int64_t this_arg) {
26176 LDKInvoice this_arg_conv;
26177 this_arg_conv.inner = (void*)(this_arg & (~1));
26178 this_arg_conv.is_owned = false;
26179 LDKCVec_PrivateRouteZ ret_var = Invoice_private_routes(&this_arg_conv);
26180 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26181 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26182 for (size_t o = 0; o < ret_var.datalen; o++) {
26183 LDKPrivateRoute ret_conv_14_var = ret_var.data[o];
26184 CHECK((((uint64_t)ret_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26185 CHECK((((uint64_t)&ret_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26186 uint64_t ret_conv_14_ref = (uint64_t)ret_conv_14_var.inner;
26187 if (ret_conv_14_var.is_owned) {
26188 ret_conv_14_ref |= 1;
26190 ret_arr_ptr[o] = ret_conv_14_ref;
26192 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26193 FREE(ret_var.data);
26197 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Invoice_1route_1hints(JNIEnv *env, jclass clz, int64_t this_arg) {
26198 LDKInvoice this_arg_conv;
26199 this_arg_conv.inner = (void*)(this_arg & (~1));
26200 this_arg_conv.is_owned = false;
26201 LDKCVec_RouteHintZ ret_var = Invoice_route_hints(&this_arg_conv);
26202 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
26203 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
26204 for (size_t l = 0; l < ret_var.datalen; l++) {
26205 LDKRouteHint ret_conv_11_var = ret_var.data[l];
26206 CHECK((((uint64_t)ret_conv_11_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26207 CHECK((((uint64_t)&ret_conv_11_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26208 uint64_t ret_conv_11_ref = (uint64_t)ret_conv_11_var.inner;
26209 if (ret_conv_11_var.is_owned) {
26210 ret_conv_11_ref |= 1;
26212 ret_arr_ptr[l] = ret_conv_11_ref;
26214 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
26215 FREE(ret_var.data);
26219 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Invoice_1currency(JNIEnv *env, jclass clz, int64_t this_arg) {
26220 LDKInvoice this_arg_conv;
26221 this_arg_conv.inner = (void*)(this_arg & (~1));
26222 this_arg_conv.is_owned = false;
26223 jclass ret_conv = LDKCurrency_to_java(env, Invoice_currency(&this_arg_conv));
26227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1amount_1pico_1btc(JNIEnv *env, jclass clz, int64_t this_arg) {
26228 LDKInvoice this_arg_conv;
26229 this_arg_conv.inner = (void*)(this_arg & (~1));
26230 this_arg_conv.is_owned = false;
26231 LDKCOption_u64Z *ret_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z");
26232 *ret_copy = Invoice_amount_pico_btc(&this_arg_conv);
26233 uint64_t ret_ref = (uint64_t)ret_copy;
26237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1new(JNIEnv *env, jclass clz, jstring description) {
26238 LDKStr description_conv = java_to_owned_str(env, description);
26239 LDKCResult_DescriptionCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_DescriptionCreationErrorZ), "LDKCResult_DescriptionCreationErrorZ");
26240 *ret_conv = Description_new(description_conv);
26241 return (uint64_t)ret_conv;
26244 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Description_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
26245 LDKDescription this_arg_conv;
26246 this_arg_conv.inner = (void*)(this_arg & (~1));
26247 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26248 this_arg_conv = Description_clone(&this_arg_conv);
26249 LDKStr ret_str = Description_into_inner(this_arg_conv);
26250 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26255 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1seconds(JNIEnv *env, jclass clz, int64_t seconds) {
26256 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26257 *ret_conv = ExpiryTime_from_seconds(seconds);
26258 return (uint64_t)ret_conv;
26261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1from_1duration(JNIEnv *env, jclass clz, int64_t duration) {
26262 LDKCResult_ExpiryTimeCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ExpiryTimeCreationErrorZ), "LDKCResult_ExpiryTimeCreationErrorZ");
26263 *ret_conv = ExpiryTime_from_duration(duration);
26264 return (uint64_t)ret_conv;
26267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1seconds(JNIEnv *env, jclass clz, int64_t this_arg) {
26268 LDKExpiryTime this_arg_conv;
26269 this_arg_conv.inner = (void*)(this_arg & (~1));
26270 this_arg_conv.is_owned = false;
26271 int64_t ret_val = ExpiryTime_as_seconds(&this_arg_conv);
26275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1as_1duration(JNIEnv *env, jclass clz, int64_t this_arg) {
26276 LDKExpiryTime this_arg_conv;
26277 this_arg_conv.inner = (void*)(this_arg & (~1));
26278 this_arg_conv.is_owned = false;
26279 int64_t ret_val = ExpiryTime_as_duration(&this_arg_conv);
26283 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1new(JNIEnv *env, jclass clz, int64_t hops) {
26284 LDKRouteHint hops_conv;
26285 hops_conv.inner = (void*)(hops & (~1));
26286 hops_conv.is_owned = (hops & 1) || (hops == 0);
26287 hops_conv = RouteHint_clone(&hops_conv);
26288 LDKCResult_PrivateRouteCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PrivateRouteCreationErrorZ), "LDKCResult_PrivateRouteCreationErrorZ");
26289 *ret_conv = PrivateRoute_new(hops_conv);
26290 return (uint64_t)ret_conv;
26293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1into_1inner(JNIEnv *env, jclass clz, int64_t this_arg) {
26294 LDKPrivateRoute this_arg_conv;
26295 this_arg_conv.inner = (void*)(this_arg & (~1));
26296 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
26297 this_arg_conv = PrivateRoute_clone(&this_arg_conv);
26298 LDKRouteHint ret_var = PrivateRoute_into_inner(this_arg_conv);
26299 CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
26300 CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
26301 uint64_t ret_ref = (uint64_t)ret_var.inner;
26302 if (ret_var.is_owned) {
26308 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26309 LDKCreationError* orig_conv = (LDKCreationError*)(orig & ~1);
26310 jclass ret_conv = LDKCreationError_to_java(env, CreationError_clone(orig_conv));
26314 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26315 LDKCreationError* a_conv = (LDKCreationError*)(a & ~1);
26316 LDKCreationError* b_conv = (LDKCreationError*)(b & ~1);
26317 jboolean ret_val = CreationError_eq(a_conv, b_conv);
26321 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_CreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
26322 LDKCreationError* o_conv = (LDKCreationError*)(o & ~1);
26323 LDKStr ret_str = CreationError_to_str(o_conv);
26324 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26329 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26330 LDKSemanticError* orig_conv = (LDKSemanticError*)(orig & ~1);
26331 jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_clone(orig_conv));
26335 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26336 LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
26337 LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
26338 jboolean ret_val = SemanticError_eq(a_conv, b_conv);
26342 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SemanticError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
26343 LDKSemanticError* o_conv = (LDKSemanticError*)(o & ~1);
26344 LDKStr ret_str = SemanticError_to_str(o_conv);
26345 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
26351 if ((this_ptr & 1) != 0) return;
26352 LDKSignOrCreationError this_ptr_conv = *(LDKSignOrCreationError*)(((uint64_t)this_ptr) & ~1);
26353 FREE((void*)this_ptr);
26354 SignOrCreationError_free(this_ptr_conv);
26357 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
26358 LDKSignOrCreationError* orig_conv = (LDKSignOrCreationError*)orig;
26359 LDKSignOrCreationError *ret_copy = MALLOC(sizeof(LDKSignOrCreationError), "LDKSignOrCreationError");
26360 *ret_copy = SignOrCreationError_clone(orig_conv);
26361 uint64_t ret_ref = (uint64_t)ret_copy;
26365 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
26366 LDKSignOrCreationError* a_conv = (LDKSignOrCreationError*)a;
26367 LDKSignOrCreationError* b_conv = (LDKSignOrCreationError*)b;
26368 jboolean ret_val = SignOrCreationError_eq(a_conv, b_conv);
26372 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignOrCreationError_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
26373 LDKSignOrCreationError* o_conv = (LDKSignOrCreationError*)o;
26374 LDKStr ret_str = SignOrCreationError_to_str(o_conv);
26375 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26380 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_create_1invoice_1from_1channelmanager(JNIEnv *env, jclass clz, int64_t channelmanager, int64_t keys_manager, jclass network, int64_t amt_msat, jstring description) {
26381 LDKChannelManager channelmanager_conv;
26382 channelmanager_conv.inner = (void*)(channelmanager & (~1));
26383 channelmanager_conv.is_owned = false;
26384 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
26385 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
26386 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
26387 LDKKeysInterface_JCalls_cloned(&keys_manager_conv);
26389 LDKCurrency network_conv = LDKCurrency_from_java(env, network);
26390 LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
26391 LDKStr description_conv = java_to_owned_str(env, description);
26392 LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
26393 *ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
26394 return (uint64_t)ret_conv;
26397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SiPrefix_1from_1str(JNIEnv *env, jclass clz, jstring s) {
26398 LDKStr s_conv = java_to_owned_str(env, s);
26399 LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
26400 *ret_conv = SiPrefix_from_str(s_conv);
26401 return (uint64_t)ret_conv;
26404 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Invoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
26405 LDKStr s_conv = java_to_owned_str(env, s);
26406 LDKCResult_InvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceNoneZ), "LDKCResult_InvoiceNoneZ");
26407 *ret_conv = Invoice_from_str(s_conv);
26408 return (uint64_t)ret_conv;
26411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1from_1str(JNIEnv *env, jclass clz, jstring s) {
26412 LDKStr s_conv = java_to_owned_str(env, s);
26413 LDKCResult_SignedRawInvoiceNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignedRawInvoiceNoneZ), "LDKCResult_SignedRawInvoiceNoneZ");
26414 *ret_conv = SignedRawInvoice_from_str(s_conv);
26415 return (uint64_t)ret_conv;
26418 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Invoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
26420 o_conv.inner = (void*)(o & (~1));
26421 o_conv.is_owned = false;
26422 LDKStr ret_str = Invoice_to_str(&o_conv);
26423 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26428 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
26429 LDKSignedRawInvoice o_conv;
26430 o_conv.inner = (void*)(o & (~1));
26431 o_conv.is_owned = false;
26432 LDKStr ret_str = SignedRawInvoice_to_str(&o_conv);
26433 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26438 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Currency_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
26439 LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
26440 LDKStr ret_str = Currency_to_str(o_conv);
26441 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
26446 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_SiPrefix_1to_1str(JNIEnv *env, jclass clz, int64_t o) {
26447 LDKSiPrefix* o_conv = (LDKSiPrefix*)(o & ~1);
26448 LDKStr ret_str = SiPrefix_to_str(o_conv);
26449 jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);