1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
9 // Always run a, then assert it is true:
10 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
11 // Assert a is true or do nothing
12 #define CHECK(a) DO_ASSERT(a)
14 // Running a leak check across all the allocations and frees of the JDK is a mess,
15 // so instead we implement our own naive leak checker here, relying on the -wrap
16 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
17 // and free'd in Rust or C across the generated bindings shared library.
21 static mtx_t allocation_mtx;
23 void __attribute__((constructor)) init_mtx() {
24 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
28 typedef struct allocation {
29 struct allocation* next;
31 const char* struct_name;
35 static allocation* allocation_ll = NULL;
37 void* __real_malloc(size_t len);
38 void* __real_calloc(size_t nmemb, size_t len);
39 static void new_allocation(void* res, const char* struct_name) {
40 allocation* new_alloc = __real_malloc(sizeof(allocation));
42 new_alloc->struct_name = struct_name;
43 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
44 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
45 new_alloc->next = allocation_ll;
46 allocation_ll = new_alloc;
47 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
49 static void* MALLOC(size_t len, const char* struct_name) {
50 void* res = __real_malloc(len);
51 new_allocation(res, struct_name);
54 void __real_free(void* ptr);
55 static void alloc_freed(void* ptr) {
57 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
58 allocation* it = allocation_ll;
59 while (it->ptr != ptr) {
60 p = it; it = it->next;
62 fprintf(stderr, "Tried to free unknown pointer %p at:\n", ptr);
64 int bt_len = backtrace(bt, BT_MAX);
65 backtrace_symbols_fd(bt, bt_len, STDERR_FILENO);
66 fprintf(stderr, "\n\n");
67 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
68 return; // addrsan should catch malloc-unknown and print more info than we have
71 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
72 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
73 DO_ASSERT(it->ptr == ptr);
76 static void FREE(void* ptr) {
77 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
82 void* __wrap_malloc(size_t len) {
83 void* res = __real_malloc(len);
84 new_allocation(res, "malloc call");
87 void* __wrap_calloc(size_t nmemb, size_t len) {
88 void* res = __real_calloc(nmemb, len);
89 new_allocation(res, "calloc call");
92 void __wrap_free(void* ptr) {
93 if (ptr == NULL) return;
98 void* __real_realloc(void* ptr, size_t newlen);
99 void* __wrap_realloc(void* ptr, size_t len) {
100 if (ptr != NULL) alloc_freed(ptr);
101 void* res = __real_realloc(ptr, len);
102 new_allocation(res, "realloc call");
105 void __wrap_reallocarray(void* ptr, size_t new_sz) {
106 // Rust doesn't seem to use reallocarray currently
110 void __attribute__((destructor)) check_leaks() {
111 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
112 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
113 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
114 fprintf(stderr, "\n\n");
116 DO_ASSERT(allocation_ll == NULL);
119 static jmethodID ordinal_meth = NULL;
120 static jmethodID slicedef_meth = NULL;
121 static jclass slicedef_cls = NULL;
122 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
123 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
124 CHECK(ordinal_meth != NULL);
125 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
126 CHECK(slicedef_meth != NULL);
127 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
128 CHECK(slicedef_cls != NULL);
131 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
132 return *((bool*)ptr);
134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
135 return *((long*)ptr);
137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
140 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * env, jclass _b, jlong ptr, jlong len) {
141 jbyteArray ret_arr = (*env)->NewByteArray(env, len);
142 (*env)->SetByteArrayRegion(env, ret_arr, 0, len, (unsigned char*)ptr);
145 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * env, jclass _b, jlong slice_ptr) {
146 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
147 jbyteArray ret_arr = (*env)->NewByteArray(env, slice->datalen);
148 (*env)->SetByteArrayRegion(env, ret_arr, 0, slice->datalen, slice->data);
151 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * env, jclass _b, jbyteArray bytes) {
152 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
153 vec->datalen = (*env)->GetArrayLength(env, bytes);
154 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
155 (*env)->GetByteArrayRegion (env, bytes, 0, vec->datalen, vec->data);
158 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
159 LDKTransaction *txdata = (LDKTransaction*)ptr;
161 slice.data = txdata->data;
162 slice.datalen = txdata->datalen;
163 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
165 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
166 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
167 txdata->datalen = (*env)->GetArrayLength(env, bytes);
168 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
169 txdata->data_is_owned = false;
170 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
174 LDKTransaction *tx = (LDKTransaction*)ptr;
175 tx->data_is_owned = true;
176 Transaction_free(*tx);
179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
180 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
181 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
182 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
183 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
184 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
185 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
186 return (long)vec->datalen;
188 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * env, jclass _b) {
189 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
190 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
191 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
192 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
193 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
194 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
200 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
201 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
202 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
203 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
205 _Static_assert(sizeof(jlong) == sizeof(int64_t), "We assume that j-types are the same as C types");
206 _Static_assert(sizeof(jbyte) == sizeof(char), "We assume that j-types are the same as C types");
207 _Static_assert(sizeof(void*) <= 8, "Pointers must fit into 64 bits");
209 typedef jlongArray int64_tArray;
210 typedef jbyteArray int8_tArray;
212 static inline jstring str_ref_to_java(JNIEnv *env, const char* chars, size_t len) {
213 // Sadly we need to create a temporary because Java can't accept a char* without a 0-terminator
214 char* err_buf = MALLOC(len + 1, "str conv buf");
215 memcpy(err_buf, chars, len);
217 jstring err_conv = (*env)->NewStringUTF(env, chars);
221 static jclass arr_of_B_clz = NULL;
222 static jclass arr_of_J_clz = NULL;
223 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass clz) {
224 arr_of_B_clz = (*env)->FindClass(env, "[B");
225 CHECK(arr_of_B_clz != NULL);
226 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
227 arr_of_J_clz = (*env)->FindClass(env, "[J");
228 CHECK(arr_of_J_clz != NULL);
229 arr_of_J_clz = (*env)->NewGlobalRef(env, arr_of_J_clz);
231 static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; }
232 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) {
233 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
234 case 0: return LDKAccessError_UnknownChain;
235 case 1: return LDKAccessError_UnknownTx;
239 static jclass LDKAccessError_class = NULL;
240 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
241 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
242 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv *env, jclass clz) {
243 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
244 CHECK(LDKAccessError_class != NULL);
245 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
246 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
247 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
248 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
250 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
252 case LDKAccessError_UnknownChain:
253 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
254 case LDKAccessError_UnknownTx:
255 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
260 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) {
261 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
262 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
263 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
267 static jclass LDKChannelMonitorUpdateErr_class = NULL;
268 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
269 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
270 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv *env, jclass clz) {
271 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
272 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
273 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
274 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
275 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
276 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
278 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
280 case LDKChannelMonitorUpdateErr_TemporaryFailure:
281 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
282 case LDKChannelMonitorUpdateErr_PermanentFailure:
283 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
288 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) {
289 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
290 case 0: return LDKConfirmationTarget_Background;
291 case 1: return LDKConfirmationTarget_Normal;
292 case 2: return LDKConfirmationTarget_HighPriority;
296 static jclass LDKConfirmationTarget_class = NULL;
297 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
298 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
299 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
300 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv *env, jclass clz) {
301 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
302 CHECK(LDKConfirmationTarget_class != NULL);
303 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
304 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
305 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
306 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
307 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
308 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
310 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
312 case LDKConfirmationTarget_Background:
313 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
314 case LDKConfirmationTarget_Normal:
315 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
316 case LDKConfirmationTarget_HighPriority:
317 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
322 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) {
323 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
324 case 0: return LDKLevel_Off;
325 case 1: return LDKLevel_Error;
326 case 2: return LDKLevel_Warn;
327 case 3: return LDKLevel_Info;
328 case 4: return LDKLevel_Debug;
329 case 5: return LDKLevel_Trace;
333 static jclass LDKLevel_class = NULL;
334 static jfieldID LDKLevel_LDKLevel_Off = NULL;
335 static jfieldID LDKLevel_LDKLevel_Error = NULL;
336 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
337 static jfieldID LDKLevel_LDKLevel_Info = NULL;
338 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
339 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
340 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv *env, jclass clz) {
341 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
342 CHECK(LDKLevel_class != NULL);
343 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
344 CHECK(LDKLevel_LDKLevel_Off != NULL);
345 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
346 CHECK(LDKLevel_LDKLevel_Error != NULL);
347 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
348 CHECK(LDKLevel_LDKLevel_Warn != NULL);
349 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
350 CHECK(LDKLevel_LDKLevel_Info != NULL);
351 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
352 CHECK(LDKLevel_LDKLevel_Debug != NULL);
353 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
354 CHECK(LDKLevel_LDKLevel_Trace != NULL);
356 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
359 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
361 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
363 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
365 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
367 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
369 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
374 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) {
375 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
376 case 0: return LDKNetwork_Bitcoin;
377 case 1: return LDKNetwork_Testnet;
378 case 2: return LDKNetwork_Regtest;
382 static jclass LDKNetwork_class = NULL;
383 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
384 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
385 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
386 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv *env, jclass clz) {
387 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
388 CHECK(LDKNetwork_class != NULL);
389 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
390 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
391 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
392 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
393 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
394 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
396 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
398 case LDKNetwork_Bitcoin:
399 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
400 case LDKNetwork_Testnet:
401 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
402 case LDKNetwork_Regtest:
403 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
408 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) {
409 switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) {
410 case 0: return LDKSecp256k1Error_IncorrectSignature;
411 case 1: return LDKSecp256k1Error_InvalidMessage;
412 case 2: return LDKSecp256k1Error_InvalidPublicKey;
413 case 3: return LDKSecp256k1Error_InvalidSignature;
414 case 4: return LDKSecp256k1Error_InvalidSecretKey;
415 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
416 case 6: return LDKSecp256k1Error_InvalidTweak;
417 case 7: return LDKSecp256k1Error_TweakCheckFailed;
418 case 8: return LDKSecp256k1Error_NotEnoughMemory;
422 static jclass LDKSecp256k1Error_class = NULL;
423 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
424 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
425 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
426 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
427 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
428 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
429 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
430 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = NULL;
431 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
432 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv *env, jclass clz) {
433 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
434 CHECK(LDKSecp256k1Error_class != NULL);
435 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
436 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
437 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
438 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
439 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
440 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
441 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
442 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
443 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
444 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
445 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
446 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
447 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
448 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
449 LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_TweakCheckFailed", "Lorg/ldk/enums/LDKSecp256k1Error;");
450 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed != NULL);
451 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
452 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
454 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
456 case LDKSecp256k1Error_IncorrectSignature:
457 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
458 case LDKSecp256k1Error_InvalidMessage:
459 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
460 case LDKSecp256k1Error_InvalidPublicKey:
461 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
462 case LDKSecp256k1Error_InvalidSignature:
463 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
464 case LDKSecp256k1Error_InvalidSecretKey:
465 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
466 case LDKSecp256k1Error_InvalidRecoveryId:
467 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
468 case LDKSecp256k1Error_InvalidTweak:
469 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
470 case LDKSecp256k1Error_TweakCheckFailed:
471 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_TweakCheckFailed);
472 case LDKSecp256k1Error_NotEnoughMemory:
473 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass clz, int8_tArray elems) {
479 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
480 ret->datalen = (*env)->GetArrayLength(env, elems);
481 if (ret->datalen == 0) {
484 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
485 int8_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
486 for (size_t i = 0; i < ret->datalen; i++) {
487 ret->data[i] = java_elems[i];
489 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
493 static inline LDKCVec_u8Z CVec_u8Z_clone(const LDKCVec_u8Z *orig) {
494 LDKCVec_u8Z ret = { .data = MALLOC(sizeof(int8_t) * orig->datalen, "LDKCVec_u8Z clone bytes"), .datalen = orig->datalen };
495 memcpy(ret.data, orig->data, sizeof(int8_t) * ret.datalen);
498 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
499 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
504 static inline LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const LDKC2Tuple_u64u64Z *orig) {
505 LDKC2Tuple_u64u64Z ret = {
511 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
512 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
516 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
519 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
520 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
521 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
522 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
523 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
524 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) {
526 LDKSpendableOutputDescriptor_StaticOutput_class =
527 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
528 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
529 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
530 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
531 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
532 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
533 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
534 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
535 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
536 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
537 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
538 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
539 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
540 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
542 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
543 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
545 case LDKSpendableOutputDescriptor_StaticOutput: {
546 LDKOutPoint outpoint_var = obj->static_output.outpoint;
547 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
548 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
549 long outpoint_ref = (long)outpoint_var.inner & ~1;
550 long output_ref = (long)&obj->static_output.output;
551 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
553 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
554 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
555 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
556 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
557 long outpoint_ref = (long)outpoint_var.inner & ~1;
558 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
559 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
560 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
561 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
562 int8_tArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
563 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
564 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, (long)output_ref, key_derivation_params_ref, revocation_pubkey_arr);
566 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
567 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
568 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
569 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
570 long outpoint_ref = (long)outpoint_var.inner & ~1;
571 long output_ref = (long)&obj->static_output_counterparty_payment.output;
572 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
573 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, (long)output_ref, key_derivation_params_ref);
578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
579 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
580 ret->datalen = (*env)->GetArrayLength(env, elems);
581 if (ret->datalen == 0) {
584 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
585 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
586 for (size_t i = 0; i < ret->datalen; i++) {
587 int64_t arr_elem = java_elems[i];
588 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
589 FREE((void*)arr_elem);
590 ret->data[i] = arr_elem_conv;
592 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
596 static inline LDKCVec_SpendableOutputDescriptorZ CVec_SpendableOutputDescriptorZ_clone(const LDKCVec_SpendableOutputDescriptorZ *orig) {
597 LDKCVec_SpendableOutputDescriptorZ ret = { .data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * orig->datalen, "LDKCVec_SpendableOutputDescriptorZ clone bytes"), .datalen = orig->datalen };
598 for (size_t i = 0; i < ret.datalen; i++) {
599 ret.data[i] = SpendableOutputDescriptor_clone(&orig->data[i]);
603 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
604 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
605 static jclass LDKErrorAction_IgnoreError_class = NULL;
606 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
607 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
608 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) {
610 LDKErrorAction_DisconnectPeer_class =
611 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
612 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
613 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
614 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
615 LDKErrorAction_IgnoreError_class =
616 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
617 CHECK(LDKErrorAction_IgnoreError_class != NULL);
618 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
619 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
620 LDKErrorAction_SendErrorMessage_class =
621 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
622 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
623 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
624 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
626 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
627 LDKErrorAction *obj = (LDKErrorAction*)ptr;
629 case LDKErrorAction_DisconnectPeer: {
630 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
631 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
632 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
633 long msg_ref = (long)msg_var.inner & ~1;
634 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
636 case LDKErrorAction_IgnoreError: {
637 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
639 case LDKErrorAction_SendErrorMessage: {
640 LDKErrorMessage msg_var = obj->send_error_message.msg;
641 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
642 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
643 long msg_ref = (long)msg_var.inner & ~1;
644 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
649 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
650 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
651 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
652 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
653 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
654 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
656 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
657 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
658 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
659 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
660 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
661 LDKHTLCFailChannelUpdate_ChannelClosed_class =
662 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
663 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
664 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
665 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
666 LDKHTLCFailChannelUpdate_NodeFailure_class =
667 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
668 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
669 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
670 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
672 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
673 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
675 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
676 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
677 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
678 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
679 long msg_ref = (long)msg_var.inner & ~1;
680 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
682 case LDKHTLCFailChannelUpdate_ChannelClosed: {
683 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
685 case LDKHTLCFailChannelUpdate_NodeFailure: {
686 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
687 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
688 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
693 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
694 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
695 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
696 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
697 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
698 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
699 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
700 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
701 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
702 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
703 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
704 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
705 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
706 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
707 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
708 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
709 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
710 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
711 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
712 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
713 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
714 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
715 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
716 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
717 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
718 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
719 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
720 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
721 static jclass LDKMessageSendEvent_HandleError_class = NULL;
722 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
723 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
724 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
725 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
726 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
727 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
728 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) {
730 LDKMessageSendEvent_SendAcceptChannel_class =
731 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
732 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
733 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
734 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
735 LDKMessageSendEvent_SendOpenChannel_class =
736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
737 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
738 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
739 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
740 LDKMessageSendEvent_SendFundingCreated_class =
741 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
742 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
743 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
744 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
745 LDKMessageSendEvent_SendFundingSigned_class =
746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
747 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
748 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
749 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
750 LDKMessageSendEvent_SendFundingLocked_class =
751 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
752 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
753 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
754 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
755 LDKMessageSendEvent_SendAnnouncementSignatures_class =
756 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
757 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
758 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
759 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
760 LDKMessageSendEvent_UpdateHTLCs_class =
761 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
762 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
763 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
764 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
765 LDKMessageSendEvent_SendRevokeAndACK_class =
766 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
767 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
768 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
769 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
770 LDKMessageSendEvent_SendClosingSigned_class =
771 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
772 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
773 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
774 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
775 LDKMessageSendEvent_SendShutdown_class =
776 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
777 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
778 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
779 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
780 LDKMessageSendEvent_SendChannelReestablish_class =
781 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
782 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
783 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
784 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
785 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
786 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
787 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
788 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
789 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
790 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
791 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
792 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
793 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
794 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
795 LDKMessageSendEvent_BroadcastChannelUpdate_class =
796 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
797 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
798 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
799 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
800 LDKMessageSendEvent_HandleError_class =
801 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
802 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
803 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
804 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
805 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
806 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
807 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
808 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
809 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
810 LDKMessageSendEvent_SendChannelRangeQuery_class =
811 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
812 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
813 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
814 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
815 LDKMessageSendEvent_SendShortIdsQuery_class =
816 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
817 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
818 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
819 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
821 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
822 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
824 case LDKMessageSendEvent_SendAcceptChannel: {
825 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
826 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
827 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
828 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
829 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
830 long msg_ref = (long)msg_var.inner & ~1;
831 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
833 case LDKMessageSendEvent_SendOpenChannel: {
834 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
835 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
836 LDKOpenChannel msg_var = obj->send_open_channel.msg;
837 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
838 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
839 long msg_ref = (long)msg_var.inner & ~1;
840 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
842 case LDKMessageSendEvent_SendFundingCreated: {
843 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
844 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
845 LDKFundingCreated msg_var = obj->send_funding_created.msg;
846 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
847 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
848 long msg_ref = (long)msg_var.inner & ~1;
849 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
851 case LDKMessageSendEvent_SendFundingSigned: {
852 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
853 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
854 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
855 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
856 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
857 long msg_ref = (long)msg_var.inner & ~1;
858 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
860 case LDKMessageSendEvent_SendFundingLocked: {
861 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
862 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
863 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
864 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
865 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
866 long msg_ref = (long)msg_var.inner & ~1;
867 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
869 case LDKMessageSendEvent_SendAnnouncementSignatures: {
870 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
871 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
872 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
873 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
874 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
875 long msg_ref = (long)msg_var.inner & ~1;
876 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
878 case LDKMessageSendEvent_UpdateHTLCs: {
879 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
880 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
881 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
882 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
883 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
884 long updates_ref = (long)updates_var.inner & ~1;
885 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
887 case LDKMessageSendEvent_SendRevokeAndACK: {
888 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
889 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
890 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
891 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
892 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
893 long msg_ref = (long)msg_var.inner & ~1;
894 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
896 case LDKMessageSendEvent_SendClosingSigned: {
897 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
898 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
899 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
900 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
901 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
902 long msg_ref = (long)msg_var.inner & ~1;
903 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
905 case LDKMessageSendEvent_SendShutdown: {
906 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
907 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
908 LDKShutdown msg_var = obj->send_shutdown.msg;
909 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
910 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
911 long msg_ref = (long)msg_var.inner & ~1;
912 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
914 case LDKMessageSendEvent_SendChannelReestablish: {
915 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
916 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
917 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
918 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
919 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
920 long msg_ref = (long)msg_var.inner & ~1;
921 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
923 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
924 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
925 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
926 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
927 long msg_ref = (long)msg_var.inner & ~1;
928 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
929 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
930 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
931 long update_msg_ref = (long)update_msg_var.inner & ~1;
932 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
934 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
935 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
936 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
937 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
938 long msg_ref = (long)msg_var.inner & ~1;
939 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
941 case LDKMessageSendEvent_BroadcastChannelUpdate: {
942 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
943 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
944 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
945 long msg_ref = (long)msg_var.inner & ~1;
946 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
948 case LDKMessageSendEvent_HandleError: {
949 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
950 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
951 long action_ref = (long)&obj->handle_error.action;
952 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
954 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
955 long update_ref = (long)&obj->payment_failure_network_update.update;
956 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
958 case LDKMessageSendEvent_SendChannelRangeQuery: {
959 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
960 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
961 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
962 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
963 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
964 long msg_ref = (long)msg_var.inner & ~1;
965 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
967 case LDKMessageSendEvent_SendShortIdsQuery: {
968 int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
969 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
970 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
971 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
972 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
973 long msg_ref = (long)msg_var.inner & ~1;
974 return (*env)->NewObject(env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
980 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
981 ret->datalen = (*env)->GetArrayLength(env, elems);
982 if (ret->datalen == 0) {
985 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
986 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
987 for (size_t i = 0; i < ret->datalen; i++) {
988 int64_t arr_elem = java_elems[i];
989 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
990 FREE((void*)arr_elem);
991 ret->data[i] = arr_elem_conv;
993 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
997 static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCVec_MessageSendEventZ *orig) {
998 LDKCVec_MessageSendEventZ ret = { .data = MALLOC(sizeof(LDKMessageSendEvent) * orig->datalen, "LDKCVec_MessageSendEventZ clone bytes"), .datalen = orig->datalen };
999 for (size_t i = 0; i < ret.datalen; i++) {
1000 ret.data[i] = MessageSendEvent_clone(&orig->data[i]);
1004 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1005 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1006 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1007 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1008 static jclass LDKEvent_PaymentReceived_class = NULL;
1009 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1010 static jclass LDKEvent_PaymentSent_class = NULL;
1011 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1012 static jclass LDKEvent_PaymentFailed_class = NULL;
1013 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1014 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1015 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1016 static jclass LDKEvent_SpendableOutputs_class = NULL;
1017 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
1019 LDKEvent_FundingGenerationReady_class =
1020 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1021 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1022 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1023 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1024 LDKEvent_FundingBroadcastSafe_class =
1025 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1026 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1027 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1028 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1029 LDKEvent_PaymentReceived_class =
1030 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1031 CHECK(LDKEvent_PaymentReceived_class != NULL);
1032 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1033 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1034 LDKEvent_PaymentSent_class =
1035 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1036 CHECK(LDKEvent_PaymentSent_class != NULL);
1037 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1038 CHECK(LDKEvent_PaymentSent_meth != NULL);
1039 LDKEvent_PaymentFailed_class =
1040 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1041 CHECK(LDKEvent_PaymentFailed_class != NULL);
1042 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1043 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1044 LDKEvent_PendingHTLCsForwardable_class =
1045 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1046 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1047 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1048 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1049 LDKEvent_SpendableOutputs_class =
1050 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1051 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1052 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1053 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1055 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
1056 LDKEvent *obj = (LDKEvent*)ptr;
1058 case LDKEvent_FundingGenerationReady: {
1059 int8_tArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
1060 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1061 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1062 int8_tArray output_script_arr = (*env)->NewByteArray(env, output_script_var.datalen);
1063 (*env)->SetByteArrayRegion(env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1064 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
1066 case LDKEvent_FundingBroadcastSafe: {
1067 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1068 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1069 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1070 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1071 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1073 case LDKEvent_PaymentReceived: {
1074 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1075 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1076 int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32);
1077 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1078 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1080 case LDKEvent_PaymentSent: {
1081 int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
1082 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1083 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1085 case LDKEvent_PaymentFailed: {
1086 int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
1087 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1088 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1090 case LDKEvent_PendingHTLCsForwardable: {
1091 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1093 case LDKEvent_SpendableOutputs: {
1094 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1095 int64_tArray outputs_arr = (*env)->NewLongArray(env, outputs_var.datalen);
1096 int64_t *outputs_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, outputs_arr, NULL);
1097 for (size_t b = 0; b < outputs_var.datalen; b++) {
1098 long arr_conv_27_ref = (long)&outputs_var.data[b];
1099 outputs_arr_ptr[b] = arr_conv_27_ref;
1101 (*env)->ReleasePrimitiveArrayCritical(env, outputs_arr, outputs_arr_ptr, 0);
1102 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1107 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1108 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1109 ret->datalen = (*env)->GetArrayLength(env, elems);
1110 if (ret->datalen == 0) {
1113 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1114 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1115 for (size_t i = 0; i < ret->datalen; i++) {
1116 int64_t arr_elem = java_elems[i];
1117 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1118 FREE((void*)arr_elem);
1119 ret->data[i] = arr_elem_conv;
1121 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1125 static inline LDKCVec_EventZ CVec_EventZ_clone(const LDKCVec_EventZ *orig) {
1126 LDKCVec_EventZ ret = { .data = MALLOC(sizeof(LDKEvent) * orig->datalen, "LDKCVec_EventZ clone bytes"), .datalen = orig->datalen };
1127 for (size_t i = 0; i < ret.datalen; i++) {
1128 ret.data[i] = Event_clone(&orig->data[i]);
1132 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, intptr_t a, int8_tArray b) {
1133 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1135 LDKTransaction b_ref;
1136 b_ref.datalen = (*env)->GetArrayLength(env, b);
1137 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1138 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1139 b_ref.data_is_owned = false;
1143 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1144 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
1147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1148 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
1149 LDKTransaction b_var = tuple->b;
1150 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1151 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1154 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1155 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1156 ret->datalen = (*env)->GetArrayLength(env, elems);
1157 if (ret->datalen == 0) {
1160 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1161 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1162 for (size_t i = 0; i < ret->datalen; i++) {
1163 int64_t arr_elem = java_elems[i];
1164 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_elem;
1165 FREE((void*)arr_elem);
1166 ret->data[i] = arr_elem_conv;
1168 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1172 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1173 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1176 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
1177 CHECK(val->result_ok);
1178 return *val->contents.result;
1180 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1181 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
1182 CHECK(!val->result_ok);
1183 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(env, (*val->contents.err));
1186 static inline LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const LDKCResult_NoneChannelMonitorUpdateErrZ *orig) {
1187 LDKCResult_NoneChannelMonitorUpdateErrZ res = { .result_ok = orig->result_ok };
1188 if (orig->result_ok) {
1189 res.contents.result = NULL;
1191 LDKChannelMonitorUpdateErr* contents = MALLOC(sizeof(LDKChannelMonitorUpdateErr), "LDKChannelMonitorUpdateErr result Err clone");
1192 *contents = ChannelMonitorUpdateErr_clone(orig->contents.err);
1193 res.contents.err = contents;
1197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1198 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1199 ret->datalen = (*env)->GetArrayLength(env, elems);
1200 if (ret->datalen == 0) {
1203 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1204 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1205 for (size_t i = 0; i < ret->datalen; i++) {
1206 int64_t arr_elem = java_elems[i];
1207 LDKMonitorEvent arr_elem_conv;
1208 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1209 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1210 if (arr_elem_conv.inner != NULL)
1211 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
1212 ret->data[i] = arr_elem_conv;
1214 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1218 static inline LDKCVec_MonitorEventZ CVec_MonitorEventZ_clone(const LDKCVec_MonitorEventZ *orig) {
1219 LDKCVec_MonitorEventZ ret = { .data = MALLOC(sizeof(LDKMonitorEvent) * orig->datalen, "LDKCVec_MonitorEventZ clone bytes"), .datalen = orig->datalen };
1220 for (size_t i = 0; i < ret.datalen; i++) {
1221 ret.data[i] = MonitorEvent_clone(&orig->data[i]);
1225 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1226 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1229 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
1230 CHECK(val->result_ok);
1231 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1232 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1233 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1234 long res_ref = (long)res_var.inner & ~1;
1237 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1238 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
1239 CHECK(!val->result_ok);
1240 LDKDecodeError err_var = (*val->contents.err);
1241 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1242 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1243 long err_ref = (long)err_var.inner & ~1;
1246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1247 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1250 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
1251 CHECK(val->result_ok);
1252 return *val->contents.result;
1254 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1255 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
1256 CHECK(!val->result_ok);
1257 LDKMonitorUpdateError err_var = (*val->contents.err);
1258 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1259 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1260 long err_ref = (long)err_var.inner & ~1;
1263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
1264 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1266 a_conv.inner = (void*)(a & (~1));
1267 a_conv.is_owned = (a & 1) || (a == 0);
1268 if (a_conv.inner != NULL)
1269 a_conv = OutPoint_clone(&a_conv);
1272 b_ref.datalen = (*env)->GetArrayLength(env, b);
1273 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1274 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
1278 static inline LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const LDKC2Tuple_OutPointScriptZ *orig) {
1279 LDKC2Tuple_OutPointScriptZ ret = {
1280 .a = OutPoint_clone(&orig->a),
1281 .b = CVec_u8Z_clone(&orig->b),
1285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1286 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
1287 LDKOutPoint a_var = tuple->a;
1288 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1290 long a_ref = (long)a_var.inner & ~1;
1293 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1294 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
1295 LDKCVec_u8Z b_var = tuple->b;
1296 int8_tArray b_arr = (*env)->NewByteArray(env, b_var.datalen);
1297 (*env)->SetByteArrayRegion(env, b_arr, 0, b_var.datalen, b_var.data);
1300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
1301 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1303 LDKTxOut b_conv = *(LDKTxOut*)b;
1308 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1309 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
1312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1313 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
1314 long b_ref = (long)&tuple->b;
1317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1318 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1319 ret->datalen = (*env)->GetArrayLength(env, elems);
1320 if (ret->datalen == 0) {
1323 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1324 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1325 for (size_t i = 0; i < ret->datalen; i++) {
1326 int64_t arr_elem = java_elems[i];
1327 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)arr_elem;
1328 FREE((void*)arr_elem);
1329 ret->data[i] = arr_elem_conv;
1331 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1335 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
1336 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1337 LDKThirtyTwoBytes a_ref;
1338 CHECK((*env)->GetArrayLength(env, a) == 32);
1339 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1341 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1342 b_constr.datalen = (*env)->GetArrayLength(env, b);
1343 if (b_constr.datalen > 0)
1344 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1346 b_constr.data = NULL;
1347 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
1348 for (size_t a = 0; a < b_constr.datalen; a++) {
1349 int64_t arr_conv_26 = b_vals[a];
1350 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
1351 FREE((void*)arr_conv_26);
1352 b_constr.data[a] = arr_conv_26_conv;
1354 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
1358 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1359 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
1360 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1361 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1364 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1365 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
1366 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1367 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
1368 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
1369 for (size_t a = 0; a < b_var.datalen; a++) {
1370 long arr_conv_26_ref = (long)&b_var.data[a];
1371 b_arr_ptr[a] = arr_conv_26_ref;
1373 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
1376 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1377 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1378 ret->datalen = (*env)->GetArrayLength(env, elems);
1379 if (ret->datalen == 0) {
1382 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1383 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1384 for (size_t i = 0; i < ret->datalen; i++) {
1385 int64_t arr_elem = java_elems[i];
1386 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_elem;
1387 FREE((void*)arr_elem);
1388 ret->data[i] = arr_elem_conv;
1390 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1394 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
1395 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1397 CHECK((*env)->GetArrayLength(env, a) == 64);
1398 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
1400 LDKCVec_SignatureZ b_constr;
1401 b_constr.datalen = (*env)->GetArrayLength(env, b);
1402 if (b_constr.datalen > 0)
1403 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1405 b_constr.data = NULL;
1406 for (size_t i = 0; i < b_constr.datalen; i++) {
1407 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
1408 LDKSignature arr_conv_8_ref;
1409 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
1410 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
1411 b_constr.data[i] = arr_conv_8_ref;
1416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1417 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
1418 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
1419 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
1422 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1423 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
1424 LDKCVec_SignatureZ b_var = tuple->b;
1425 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
1427 for (size_t i = 0; i < b_var.datalen; i++) {
1428 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
1429 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
1430 (*env)->SetObjectArrayElement(env, b_arr, i, arr_conv_8_arr);
1434 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1435 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1438 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
1439 CHECK(val->result_ok);
1440 long res_ref = (long)&(*val->contents.result);
1443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1444 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
1445 CHECK(!val->result_ok);
1446 return *val->contents.err;
1448 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1449 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1451 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1452 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
1453 CHECK(val->result_ok);
1454 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
1455 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
1458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1459 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
1460 CHECK(!val->result_ok);
1461 return *val->contents.err;
1463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1464 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1466 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1467 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
1468 CHECK(val->result_ok);
1469 LDKCVec_SignatureZ res_var = (*val->contents.result);
1470 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1472 for (size_t i = 0; i < res_var.datalen; i++) {
1473 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
1474 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1475 (*env)->SetObjectArrayElement(env, res_arr, i, arr_conv_8_arr);
1479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1480 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
1481 CHECK(!val->result_ok);
1482 return *val->contents.err;
1484 typedef struct LDKChannelKeys_JCalls {
1485 atomic_size_t refcnt;
1488 jmethodID get_per_commitment_point_meth;
1489 jmethodID release_commitment_secret_meth;
1490 jmethodID key_derivation_params_meth;
1491 jmethodID sign_counterparty_commitment_meth;
1492 jmethodID sign_holder_commitment_meth;
1493 jmethodID sign_holder_commitment_htlc_transactions_meth;
1494 jmethodID sign_justice_transaction_meth;
1495 jmethodID sign_counterparty_htlc_transaction_meth;
1496 jmethodID sign_closing_transaction_meth;
1497 jmethodID sign_channel_announcement_meth;
1498 jmethodID ready_channel_meth;
1499 jmethodID write_meth;
1500 } LDKChannelKeys_JCalls;
1501 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1502 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1503 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1505 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1506 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1510 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1511 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1513 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1514 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1516 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1517 LDKPublicKey arg_ref;
1518 CHECK((*env)->GetArrayLength(env, arg) == 33);
1519 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
1522 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1523 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1525 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1526 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1528 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1529 LDKThirtyTwoBytes arg_ref;
1530 CHECK((*env)->GetArrayLength(env, arg) == 32);
1531 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
1534 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1535 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1537 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1538 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1540 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1541 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1545 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1546 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1548 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1549 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1550 if (commitment_tx->inner != NULL)
1551 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1552 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1553 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1554 long commitment_tx_ref = (long)commitment_tx_var.inner;
1555 if (commitment_tx_var.is_owned) {
1556 commitment_tx_ref |= 1;
1558 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1560 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1561 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1565 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1566 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1568 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1569 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1570 if (commitment_tx->inner != NULL)
1571 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1572 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1573 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1574 long commitment_tx_ref = (long)commitment_tx_var.inner;
1575 if (commitment_tx_var.is_owned) {
1576 commitment_tx_ref |= 1;
1578 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1580 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
1581 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1585 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1586 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1588 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1589 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1590 if (commitment_tx->inner != NULL)
1591 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1592 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1593 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1594 long commitment_tx_ref = (long)commitment_tx_var.inner;
1595 if (commitment_tx_var.is_owned) {
1596 commitment_tx_ref |= 1;
1598 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1600 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, commitment_tx_ref);
1601 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1605 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (* per_commitment_key)[32], const LDKHTLCOutputInCommitment * htlc) {
1606 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1608 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1609 LDKTransaction justice_tx_var = justice_tx;
1610 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
1611 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1612 Transaction_free(justice_tx_var);
1613 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1614 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1615 LDKHTLCOutputInCommitment htlc_var = *htlc;
1616 if (htlc->inner != NULL)
1617 htlc_var = HTLCOutputInCommitment_clone(htlc);
1618 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1619 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1620 long htlc_ref = (long)htlc_var.inner;
1621 if (htlc_var.is_owned) {
1624 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1626 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_justice_transaction_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref);
1627 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1631 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment * htlc) {
1632 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1634 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1635 LDKTransaction htlc_tx_var = htlc_tx;
1636 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
1637 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
1638 Transaction_free(htlc_tx_var);
1639 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1640 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1641 LDKHTLCOutputInCommitment htlc_var = *htlc;
1642 if (htlc->inner != NULL)
1643 htlc_var = HTLCOutputInCommitment_clone(htlc);
1644 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1645 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1646 long htlc_ref = (long)htlc_var.inner;
1647 if (htlc_var.is_owned) {
1650 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1652 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);
1653 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1657 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1658 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1660 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1661 LDKTransaction closing_tx_var = closing_tx;
1662 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
1663 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
1664 Transaction_free(closing_tx_var);
1665 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1667 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
1668 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1672 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1673 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1675 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1676 LDKUnsignedChannelAnnouncement msg_var = *msg;
1677 if (msg->inner != NULL)
1678 msg_var = UnsignedChannelAnnouncement_clone(msg);
1679 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1680 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1681 long msg_ref = (long)msg_var.inner;
1682 if (msg_var.is_owned) {
1685 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1687 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
1688 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1692 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1693 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1695 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1696 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1697 if (channel_parameters->inner != NULL)
1698 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1699 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1700 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1701 long channel_parameters_ref = (long)channel_parameters_var.inner;
1702 if (channel_parameters_var.is_owned) {
1703 channel_parameters_ref |= 1;
1705 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1707 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
1709 LDKCVec_u8Z write_jcall(const void* this_arg) {
1710 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1712 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1713 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1715 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
1716 LDKCVec_u8Z arg_ref;
1717 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
1718 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1719 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
1722 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1723 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1724 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1725 return (void*) this_arg;
1727 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1728 jclass c = (*env)->GetObjectClass(env, o);
1730 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1731 atomic_init(&calls->refcnt, 1);
1732 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1733 calls->o = (*env)->NewWeakGlobalRef(env, o);
1734 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1735 CHECK(calls->get_per_commitment_point_meth != NULL);
1736 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1737 CHECK(calls->release_commitment_secret_meth != NULL);
1738 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1739 CHECK(calls->key_derivation_params_meth != NULL);
1740 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
1741 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1742 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1743 CHECK(calls->sign_holder_commitment_meth != NULL);
1744 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1745 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1746 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
1747 CHECK(calls->sign_justice_transaction_meth != NULL);
1748 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
1749 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1750 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
1751 CHECK(calls->sign_closing_transaction_meth != NULL);
1752 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1753 CHECK(calls->sign_channel_announcement_meth != NULL);
1754 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
1755 CHECK(calls->ready_channel_meth != NULL);
1756 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
1757 CHECK(calls->write_meth != NULL);
1759 LDKChannelPublicKeys pubkeys_conv;
1760 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1761 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1762 if (pubkeys_conv.inner != NULL)
1763 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1765 LDKChannelKeys ret = {
1766 .this_arg = (void*) calls,
1767 .get_per_commitment_point = get_per_commitment_point_jcall,
1768 .release_commitment_secret = release_commitment_secret_jcall,
1769 .key_derivation_params = key_derivation_params_jcall,
1770 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1771 .sign_holder_commitment = sign_holder_commitment_jcall,
1772 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1773 .sign_justice_transaction = sign_justice_transaction_jcall,
1774 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1775 .sign_closing_transaction = sign_closing_transaction_jcall,
1776 .sign_channel_announcement = sign_channel_announcement_jcall,
1777 .ready_channel = ready_channel_jcall,
1778 .clone = LDKChannelKeys_JCalls_clone,
1779 .write = write_jcall,
1780 .free = LDKChannelKeys_JCalls_free,
1781 .pubkeys = pubkeys_conv,
1782 .set_pubkeys = NULL,
1786 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1787 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1788 *res_ptr = LDKChannelKeys_init(env, clz, o, pubkeys);
1789 return (long)res_ptr;
1791 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
1792 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1793 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
1794 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1798 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
1799 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1800 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
1801 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv *env, jclass clz, int64_t this_arg) {
1806 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1807 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1808 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1809 return (long)ret_ref;
1812 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
1813 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1814 LDKCommitmentTransaction commitment_tx_conv;
1815 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1816 commitment_tx_conv.is_owned = false;
1817 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1818 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1819 return (long)ret_conv;
1822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
1823 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1824 LDKHolderCommitmentTransaction commitment_tx_conv;
1825 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1826 commitment_tx_conv.is_owned = false;
1827 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1828 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1829 return (long)ret_conv;
1832 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
1833 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1834 LDKHolderCommitmentTransaction commitment_tx_conv;
1835 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1836 commitment_tx_conv.is_owned = false;
1837 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1838 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &commitment_tx_conv);
1839 return (long)ret_conv;
1842 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray justice_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_key, int64_t htlc) {
1843 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1844 LDKTransaction justice_tx_ref;
1845 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
1846 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1847 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
1848 justice_tx_ref.data_is_owned = true;
1849 unsigned char per_commitment_key_arr[32];
1850 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
1851 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
1852 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1853 LDKHTLCOutputInCommitment htlc_conv;
1854 htlc_conv.inner = (void*)(htlc & (~1));
1855 htlc_conv.is_owned = false;
1856 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1857 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1858 return (long)ret_conv;
1861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_tx, intptr_t input, int64_t amount, int8_tArray per_commitment_point, int64_t htlc) {
1862 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1863 LDKTransaction htlc_tx_ref;
1864 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
1865 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1866 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
1867 htlc_tx_ref.data_is_owned = true;
1868 LDKPublicKey per_commitment_point_ref;
1869 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
1870 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1871 LDKHTLCOutputInCommitment htlc_conv;
1872 htlc_conv.inner = (void*)(htlc & (~1));
1873 htlc_conv.is_owned = false;
1874 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1875 *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);
1876 return (long)ret_conv;
1879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
1880 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1881 LDKTransaction closing_tx_ref;
1882 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
1883 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1884 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
1885 closing_tx_ref.data_is_owned = true;
1886 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1887 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1888 return (long)ret_conv;
1891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
1892 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1893 LDKUnsignedChannelAnnouncement msg_conv;
1894 msg_conv.inner = (void*)(msg & (~1));
1895 msg_conv.is_owned = false;
1896 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1897 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1898 return (long)ret_conv;
1901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
1902 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1903 LDKChannelTransactionParameters channel_parameters_conv;
1904 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1905 channel_parameters_conv.is_owned = false;
1906 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
1910 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1911 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1912 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
1913 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
1914 CVec_u8Z_free(arg_var);
1918 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1919 if (this_arg->set_pubkeys != NULL)
1920 this_arg->set_pubkeys(this_arg);
1921 return this_arg->pubkeys;
1923 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
1924 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1925 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1926 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 long ret_ref = (long)ret_var.inner;
1929 if (ret_var.is_owned) {
1935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
1936 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1937 LDKThirtyTwoBytes a_ref;
1938 CHECK((*env)->GetArrayLength(env, a) == 32);
1939 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1941 LDKChannelMonitor b_conv;
1942 b_conv.inner = (void*)(b & (~1));
1943 b_conv.is_owned = (b & 1) || (b == 0);
1944 // Warning: we may need a move here but can't clone!
1948 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1949 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1950 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1951 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1955 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1956 LDKChannelMonitor b_var = tuple->b;
1957 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1958 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1959 long b_ref = (long)b_var.inner & ~1;
1962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1963 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1965 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1966 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1967 CHECK(val->result_ok);
1968 long res_ref = (long)&(*val->contents.result);
1971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1972 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1973 CHECK(!val->result_ok);
1974 LDKDecodeError err_var = (*val->contents.err);
1975 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1976 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1977 long err_ref = (long)err_var.inner & ~1;
1980 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1981 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1984 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1985 CHECK(val->result_ok);
1986 long res_ref = (long)&(*val->contents.result);
1989 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1990 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1991 CHECK(!val->result_ok);
1992 LDKDecodeError err_var = (*val->contents.err);
1993 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1994 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1995 long err_ref = (long)err_var.inner & ~1;
1998 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1999 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
2001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2002 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
2003 CHECK(val->result_ok);
2004 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2005 *ret = (*val->contents.result);
2008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2009 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
2010 CHECK(!val->result_ok);
2011 LDKDecodeError err_var = (*val->contents.err);
2012 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2013 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2014 long err_ref = (long)err_var.inner & ~1;
2017 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2018 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
2020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2021 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
2022 CHECK(val->result_ok);
2023 LDKInMemoryChannelKeys res_var = (*val->contents.result);
2024 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2025 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2026 long res_ref = (long)res_var.inner & ~1;
2029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2030 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
2031 CHECK(!val->result_ok);
2032 LDKDecodeError err_var = (*val->contents.err);
2033 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2034 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2035 long err_ref = (long)err_var.inner & ~1;
2038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2039 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2042 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
2043 CHECK(val->result_ok);
2044 long res_ref = (long)&(*val->contents.result);
2045 return (long)res_ref;
2047 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2048 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
2049 CHECK(!val->result_ok);
2050 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
2053 static jclass LDKAPIError_APIMisuseError_class = NULL;
2054 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2055 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2056 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2057 static jclass LDKAPIError_RouteError_class = NULL;
2058 static jmethodID LDKAPIError_RouteError_meth = NULL;
2059 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2060 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2061 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2062 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2064 LDKAPIError_APIMisuseError_class =
2065 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2066 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2067 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2068 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2069 LDKAPIError_FeeRateTooHigh_class =
2070 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2071 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2072 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2073 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2074 LDKAPIError_RouteError_class =
2075 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2076 CHECK(LDKAPIError_RouteError_class != NULL);
2077 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2078 CHECK(LDKAPIError_RouteError_meth != NULL);
2079 LDKAPIError_ChannelUnavailable_class =
2080 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2081 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2082 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2083 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2084 LDKAPIError_MonitorUpdateFailed_class =
2085 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2086 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2087 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2088 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2090 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2091 LDKAPIError *obj = (LDKAPIError*)ptr;
2093 case LDKAPIError_APIMisuseError: {
2094 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2095 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2096 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2097 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2099 case LDKAPIError_FeeRateTooHigh: {
2100 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2101 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2102 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2103 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2105 case LDKAPIError_RouteError: {
2106 LDKStr err_str = obj->route_error.err;
2107 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2108 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2110 case LDKAPIError_ChannelUnavailable: {
2111 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2112 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2113 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2114 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2116 case LDKAPIError_MonitorUpdateFailed: {
2117 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2122 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2123 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2126 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
2127 CHECK(val->result_ok);
2128 return *val->contents.result;
2130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2131 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
2132 CHECK(!val->result_ok);
2133 long err_ref = (long)&(*val->contents.err);
2136 static inline LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const LDKCResult_NoneAPIErrorZ *orig) {
2137 LDKCResult_NoneAPIErrorZ res = { .result_ok = orig->result_ok };
2138 if (orig->result_ok) {
2139 res.contents.result = NULL;
2141 LDKAPIError* contents = MALLOC(sizeof(LDKAPIError), "LDKAPIError result Err clone");
2142 *contents = APIError_clone(orig->contents.err);
2143 res.contents.err = contents;
2147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2148 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2149 ret->datalen = (*env)->GetArrayLength(env, elems);
2150 if (ret->datalen == 0) {
2153 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2154 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2155 for (size_t i = 0; i < ret->datalen; i++) {
2156 int64_t arr_elem = java_elems[i];
2157 LDKChannelDetails arr_elem_conv;
2158 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2159 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2160 if (arr_elem_conv.inner != NULL)
2161 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2162 ret->data[i] = arr_elem_conv;
2164 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2168 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2169 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2170 for (size_t i = 0; i < ret.datalen; i++) {
2171 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2175 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2176 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2179 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
2180 CHECK(val->result_ok);
2181 return *val->contents.result;
2183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2184 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
2185 CHECK(!val->result_ok);
2186 LDKPaymentSendFailure err_var = (*val->contents.err);
2187 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2188 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2189 long err_ref = (long)err_var.inner & ~1;
2192 static jclass LDKNetAddress_IPv4_class = NULL;
2193 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2194 static jclass LDKNetAddress_IPv6_class = NULL;
2195 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2196 static jclass LDKNetAddress_OnionV2_class = NULL;
2197 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2198 static jclass LDKNetAddress_OnionV3_class = NULL;
2199 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
2201 LDKNetAddress_IPv4_class =
2202 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2203 CHECK(LDKNetAddress_IPv4_class != NULL);
2204 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2205 CHECK(LDKNetAddress_IPv4_meth != NULL);
2206 LDKNetAddress_IPv6_class =
2207 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2208 CHECK(LDKNetAddress_IPv6_class != NULL);
2209 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2210 CHECK(LDKNetAddress_IPv6_meth != NULL);
2211 LDKNetAddress_OnionV2_class =
2212 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2213 CHECK(LDKNetAddress_OnionV2_class != NULL);
2214 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2215 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2216 LDKNetAddress_OnionV3_class =
2217 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2218 CHECK(LDKNetAddress_OnionV3_class != NULL);
2219 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2220 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2222 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2223 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2225 case LDKNetAddress_IPv4: {
2226 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
2227 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2228 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2230 case LDKNetAddress_IPv6: {
2231 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
2232 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2233 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2235 case LDKNetAddress_OnionV2: {
2236 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
2237 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2238 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2240 case LDKNetAddress_OnionV3: {
2241 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2242 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2243 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);
2248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2249 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2250 ret->datalen = (*env)->GetArrayLength(env, elems);
2251 if (ret->datalen == 0) {
2254 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2255 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2256 for (size_t i = 0; i < ret->datalen; i++) {
2257 int64_t arr_elem = java_elems[i];
2258 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2259 FREE((void*)arr_elem);
2260 ret->data[i] = arr_elem_conv;
2262 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2266 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2267 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2268 for (size_t i = 0; i < ret.datalen; i++) {
2269 ret.data[i] = NetAddress_clone(&orig->data[i]);
2273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2274 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2275 ret->datalen = (*env)->GetArrayLength(env, elems);
2276 if (ret->datalen == 0) {
2279 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2280 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2281 for (size_t i = 0; i < ret->datalen; i++) {
2282 int64_t arr_elem = java_elems[i];
2283 LDKChannelMonitor arr_elem_conv;
2284 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2285 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2286 // Warning: we may need a move here but can't clone!
2287 ret->data[i] = arr_elem_conv;
2289 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2293 typedef struct LDKWatch_JCalls {
2294 atomic_size_t refcnt;
2297 jmethodID watch_channel_meth;
2298 jmethodID update_channel_meth;
2299 jmethodID release_pending_monitor_events_meth;
2301 static void LDKWatch_JCalls_free(void* this_arg) {
2302 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2303 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2305 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2306 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2310 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2311 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2313 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2314 LDKOutPoint funding_txo_var = funding_txo;
2315 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2316 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2317 long funding_txo_ref = (long)funding_txo_var.inner;
2318 if (funding_txo_var.is_owned) {
2319 funding_txo_ref |= 1;
2321 LDKChannelMonitor monitor_var = monitor;
2322 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2323 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2324 long monitor_ref = (long)monitor_var.inner;
2325 if (monitor_var.is_owned) {
2328 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2330 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2331 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2335 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2336 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2338 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2339 LDKOutPoint funding_txo_var = funding_txo;
2340 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2341 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2342 long funding_txo_ref = (long)funding_txo_var.inner;
2343 if (funding_txo_var.is_owned) {
2344 funding_txo_ref |= 1;
2346 LDKChannelMonitorUpdate update_var = update;
2347 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2348 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2349 long update_ref = (long)update_var.inner;
2350 if (update_var.is_owned) {
2353 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2355 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2356 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2360 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2361 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2363 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2366 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2367 LDKCVec_MonitorEventZ arg_constr;
2368 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
2369 if (arg_constr.datalen > 0)
2370 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2372 arg_constr.data = NULL;
2373 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
2374 for (size_t o = 0; o < arg_constr.datalen; o++) {
2375 int64_t arr_conv_14 = arg_vals[o];
2376 LDKMonitorEvent arr_conv_14_conv;
2377 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2378 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2379 if (arr_conv_14_conv.inner != NULL)
2380 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2381 arg_constr.data[o] = arr_conv_14_conv;
2383 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
2386 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2387 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2388 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2389 return (void*) this_arg;
2391 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
2392 jclass c = (*env)->GetObjectClass(env, o);
2394 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2395 atomic_init(&calls->refcnt, 1);
2396 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2397 calls->o = (*env)->NewWeakGlobalRef(env, o);
2398 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2399 CHECK(calls->watch_channel_meth != NULL);
2400 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2401 CHECK(calls->update_channel_meth != NULL);
2402 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2403 CHECK(calls->release_pending_monitor_events_meth != NULL);
2406 .this_arg = (void*) calls,
2407 .watch_channel = watch_channel_jcall,
2408 .update_channel = update_channel_jcall,
2409 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2410 .free = LDKWatch_JCalls_free,
2414 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
2415 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2416 *res_ptr = LDKWatch_init(env, clz, o);
2417 return (long)res_ptr;
2419 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) {
2420 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2421 LDKOutPoint funding_txo_conv;
2422 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2423 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2424 if (funding_txo_conv.inner != NULL)
2425 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2426 LDKChannelMonitor monitor_conv;
2427 monitor_conv.inner = (void*)(monitor & (~1));
2428 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2429 // Warning: we may need a move here but can't clone!
2430 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2431 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2432 return (long)ret_conv;
2435 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) {
2436 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2437 LDKOutPoint funding_txo_conv;
2438 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2439 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2440 if (funding_txo_conv.inner != NULL)
2441 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2442 LDKChannelMonitorUpdate update_conv;
2443 update_conv.inner = (void*)(update & (~1));
2444 update_conv.is_owned = (update & 1) || (update == 0);
2445 if (update_conv.inner != NULL)
2446 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2447 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2448 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2449 return (long)ret_conv;
2452 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
2453 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2454 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2455 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
2456 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
2457 for (size_t o = 0; o < ret_var.datalen; o++) {
2458 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2459 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2460 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2461 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2462 if (arr_conv_14_var.is_owned) {
2463 arr_conv_14_ref |= 1;
2465 ret_arr_ptr[o] = arr_conv_14_ref;
2467 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
2472 typedef struct LDKBroadcasterInterface_JCalls {
2473 atomic_size_t refcnt;
2476 jmethodID broadcast_transaction_meth;
2477 } LDKBroadcasterInterface_JCalls;
2478 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2479 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2480 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2482 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2483 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2487 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2488 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2490 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2491 LDKTransaction tx_var = tx;
2492 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
2493 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
2494 Transaction_free(tx_var);
2495 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2497 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2499 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2500 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2501 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2502 return (void*) this_arg;
2504 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
2505 jclass c = (*env)->GetObjectClass(env, o);
2507 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2508 atomic_init(&calls->refcnt, 1);
2509 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2510 calls->o = (*env)->NewWeakGlobalRef(env, o);
2511 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2512 CHECK(calls->broadcast_transaction_meth != NULL);
2514 LDKBroadcasterInterface ret = {
2515 .this_arg = (void*) calls,
2516 .broadcast_transaction = broadcast_transaction_jcall,
2517 .free = LDKBroadcasterInterface_JCalls_free,
2521 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2522 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2523 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
2524 return (long)res_ptr;
2526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
2527 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2528 LDKTransaction tx_ref;
2529 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
2530 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2531 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
2532 tx_ref.data_is_owned = true;
2533 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2536 typedef struct LDKKeysInterface_JCalls {
2537 atomic_size_t refcnt;
2540 jmethodID get_node_secret_meth;
2541 jmethodID get_destination_script_meth;
2542 jmethodID get_shutdown_pubkey_meth;
2543 jmethodID get_channel_keys_meth;
2544 jmethodID get_secure_random_bytes_meth;
2545 jmethodID read_chan_signer_meth;
2546 } LDKKeysInterface_JCalls;
2547 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2548 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2549 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2551 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2552 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2556 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2557 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2559 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2560 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2562 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2563 LDKSecretKey arg_ref;
2564 CHECK((*env)->GetArrayLength(env, arg) == 32);
2565 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
2568 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2569 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2571 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2572 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2574 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
2575 LDKCVec_u8Z arg_ref;
2576 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
2577 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2578 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
2581 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2582 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2584 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2585 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2587 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2588 LDKPublicKey arg_ref;
2589 CHECK((*env)->GetArrayLength(env, arg) == 33);
2590 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
2593 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2594 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2596 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2597 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2599 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2600 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2601 ret_conv = ChannelKeys_clone(ret);
2604 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2605 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2607 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2608 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2610 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2611 LDKThirtyTwoBytes arg_ref;
2612 CHECK((*env)->GetArrayLength(env, arg) == 32);
2613 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
2616 LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
2617 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2619 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2620 LDKu8slice reader_var = reader;
2621 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
2622 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
2623 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2625 LDKCResult_ChanKeySignerDecodeErrorZ* ret = (LDKCResult_ChanKeySignerDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
2626 LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)ret;
2630 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2631 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2632 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2633 return (void*) this_arg;
2635 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
2636 jclass c = (*env)->GetObjectClass(env, o);
2638 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2639 atomic_init(&calls->refcnt, 1);
2640 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2641 calls->o = (*env)->NewWeakGlobalRef(env, o);
2642 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2643 CHECK(calls->get_node_secret_meth != NULL);
2644 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2645 CHECK(calls->get_destination_script_meth != NULL);
2646 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2647 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2648 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2649 CHECK(calls->get_channel_keys_meth != NULL);
2650 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2651 CHECK(calls->get_secure_random_bytes_meth != NULL);
2652 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
2653 CHECK(calls->read_chan_signer_meth != NULL);
2655 LDKKeysInterface ret = {
2656 .this_arg = (void*) calls,
2657 .get_node_secret = get_node_secret_jcall,
2658 .get_destination_script = get_destination_script_jcall,
2659 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2660 .get_channel_keys = get_channel_keys_jcall,
2661 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2662 .read_chan_signer = read_chan_signer_jcall,
2663 .free = LDKKeysInterface_JCalls_free,
2667 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2668 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2669 *res_ptr = LDKKeysInterface_init(env, clz, o);
2670 return (long)res_ptr;
2672 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
2673 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2674 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2675 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2679 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
2680 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2681 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2682 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
2683 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
2684 CVec_u8Z_free(arg_var);
2688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
2689 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2690 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
2691 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
2696 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2697 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2698 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2702 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
2703 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2704 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2705 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2709 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
2710 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2711 LDKu8slice reader_ref;
2712 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
2713 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
2714 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
2715 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2716 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
2717 return (long)ret_conv;
2720 typedef struct LDKFeeEstimator_JCalls {
2721 atomic_size_t refcnt;
2724 jmethodID get_est_sat_per_1000_weight_meth;
2725 } LDKFeeEstimator_JCalls;
2726 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2727 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2728 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2730 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2731 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2735 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2736 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2738 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2739 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2740 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2742 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2744 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2745 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2746 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2747 return (void*) this_arg;
2749 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
2750 jclass c = (*env)->GetObjectClass(env, o);
2752 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2753 atomic_init(&calls->refcnt, 1);
2754 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2755 calls->o = (*env)->NewWeakGlobalRef(env, o);
2756 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2757 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2759 LDKFeeEstimator ret = {
2760 .this_arg = (void*) calls,
2761 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2762 .free = LDKFeeEstimator_JCalls_free,
2766 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
2767 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2768 *res_ptr = LDKFeeEstimator_init(env, clz, o);
2769 return (long)res_ptr;
2771 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) {
2772 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2773 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
2774 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2778 typedef struct LDKLogger_JCalls {
2779 atomic_size_t refcnt;
2784 static void LDKLogger_JCalls_free(void* this_arg) {
2785 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2786 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2788 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2789 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2793 void log_jcall(const void* this_arg, const char* record) {
2794 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2796 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2797 const char* record_str = record;
2798 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
2799 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2801 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
2803 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2804 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2805 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2806 return (void*) this_arg;
2808 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
2809 jclass c = (*env)->GetObjectClass(env, o);
2811 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2812 atomic_init(&calls->refcnt, 1);
2813 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2814 calls->o = (*env)->NewWeakGlobalRef(env, o);
2815 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
2816 CHECK(calls->log_meth != NULL);
2819 .this_arg = (void*) calls,
2821 .free = LDKLogger_JCalls_free,
2825 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
2826 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2827 *res_ptr = LDKLogger_init(env, clz, o);
2828 return (long)res_ptr;
2830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2831 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2832 LDKThirtyTwoBytes a_ref;
2833 CHECK((*env)->GetArrayLength(env, a) == 32);
2834 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2836 LDKChannelManager b_conv;
2837 b_conv.inner = (void*)(b & (~1));
2838 b_conv.is_owned = (b & 1) || (b == 0);
2839 // Warning: we may need a move here but can't clone!
2843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2844 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2845 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2846 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2850 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2851 LDKChannelManager b_var = tuple->b;
2852 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2853 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2854 long b_ref = (long)b_var.inner & ~1;
2857 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2858 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2861 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2862 CHECK(val->result_ok);
2863 long res_ref = (long)&(*val->contents.result);
2866 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2867 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2868 CHECK(!val->result_ok);
2869 LDKDecodeError err_var = (*val->contents.err);
2870 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2871 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2872 long err_ref = (long)err_var.inner & ~1;
2875 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2876 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2879 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2880 CHECK(val->result_ok);
2881 long res_ref = (long)&(*val->contents.result);
2884 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2885 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2886 CHECK(!val->result_ok);
2887 return *val->contents.err;
2889 static inline LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const LDKCResult_NetAddressu8Z *orig) {
2890 LDKCResult_NetAddressu8Z res = { .result_ok = orig->result_ok };
2891 if (orig->result_ok) {
2892 LDKNetAddress* contents = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress result OK clone");
2893 *contents = NetAddress_clone(orig->contents.result);
2894 res.contents.result = contents;
2896 int8_t* contents = MALLOC(sizeof(int8_t), "int8_t result Err clone");
2897 *contents = *orig->contents.err;
2898 res.contents.err = contents;
2902 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2903 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2906 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2907 CHECK(val->result_ok);
2908 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2909 *res_conv = (*val->contents.result);
2910 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2911 return (long)res_conv;
2913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2914 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2915 CHECK(!val->result_ok);
2916 LDKDecodeError err_var = (*val->contents.err);
2917 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2918 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2919 long err_ref = (long)err_var.inner & ~1;
2922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2923 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2924 ret->datalen = (*env)->GetArrayLength(env, elems);
2925 if (ret->datalen == 0) {
2928 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2929 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2930 for (size_t i = 0; i < ret->datalen; i++) {
2931 ret->data[i] = java_elems[i];
2933 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2937 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2938 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2939 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2942 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2943 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2944 ret->datalen = (*env)->GetArrayLength(env, elems);
2945 if (ret->datalen == 0) {
2948 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2949 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2950 for (size_t i = 0; i < ret->datalen; i++) {
2951 int64_t arr_elem = java_elems[i];
2952 LDKUpdateAddHTLC arr_elem_conv;
2953 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2954 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2955 if (arr_elem_conv.inner != NULL)
2956 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2957 ret->data[i] = arr_elem_conv;
2959 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2963 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
2964 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
2965 for (size_t i = 0; i < ret.datalen; i++) {
2966 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
2970 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2971 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2972 ret->datalen = (*env)->GetArrayLength(env, elems);
2973 if (ret->datalen == 0) {
2976 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2977 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2978 for (size_t i = 0; i < ret->datalen; i++) {
2979 int64_t arr_elem = java_elems[i];
2980 LDKUpdateFulfillHTLC arr_elem_conv;
2981 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2982 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2983 if (arr_elem_conv.inner != NULL)
2984 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2985 ret->data[i] = arr_elem_conv;
2987 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2991 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
2992 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
2993 for (size_t i = 0; i < ret.datalen; i++) {
2994 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
2998 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2999 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3000 ret->datalen = (*env)->GetArrayLength(env, elems);
3001 if (ret->datalen == 0) {
3004 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3005 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3006 for (size_t i = 0; i < ret->datalen; i++) {
3007 int64_t arr_elem = java_elems[i];
3008 LDKUpdateFailHTLC arr_elem_conv;
3009 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3010 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3011 if (arr_elem_conv.inner != NULL)
3012 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3013 ret->data[i] = arr_elem_conv;
3015 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3019 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3020 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3021 for (size_t i = 0; i < ret.datalen; i++) {
3022 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3027 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3028 ret->datalen = (*env)->GetArrayLength(env, elems);
3029 if (ret->datalen == 0) {
3032 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3033 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3034 for (size_t i = 0; i < ret->datalen; i++) {
3035 int64_t arr_elem = java_elems[i];
3036 LDKUpdateFailMalformedHTLC arr_elem_conv;
3037 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3038 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3039 if (arr_elem_conv.inner != NULL)
3040 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3041 ret->data[i] = arr_elem_conv;
3043 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3047 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3048 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3049 for (size_t i = 0; i < ret.datalen; i++) {
3050 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3054 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3055 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3057 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3058 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3059 CHECK(val->result_ok);
3060 return *val->contents.result;
3062 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3063 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3064 CHECK(!val->result_ok);
3065 LDKLightningError err_var = (*val->contents.err);
3066 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3067 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3068 long err_ref = (long)err_var.inner & ~1;
3071 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) {
3072 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3073 LDKChannelAnnouncement a_conv;
3074 a_conv.inner = (void*)(a & (~1));
3075 a_conv.is_owned = (a & 1) || (a == 0);
3076 if (a_conv.inner != NULL)
3077 a_conv = ChannelAnnouncement_clone(&a_conv);
3079 LDKChannelUpdate b_conv;
3080 b_conv.inner = (void*)(b & (~1));
3081 b_conv.is_owned = (b & 1) || (b == 0);
3082 if (b_conv.inner != NULL)
3083 b_conv = ChannelUpdate_clone(&b_conv);
3085 LDKChannelUpdate c_conv;
3086 c_conv.inner = (void*)(c & (~1));
3087 c_conv.is_owned = (c & 1) || (c == 0);
3088 if (c_conv.inner != NULL)
3089 c_conv = ChannelUpdate_clone(&c_conv);
3093 static inline LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *orig) {
3094 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret = {
3095 .a = ChannelAnnouncement_clone(&orig->a),
3096 .b = ChannelUpdate_clone(&orig->b),
3097 .c = ChannelUpdate_clone(&orig->c),
3101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3102 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3103 LDKChannelAnnouncement a_var = tuple->a;
3104 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3105 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3106 long a_ref = (long)a_var.inner & ~1;
3109 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3110 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3111 LDKChannelUpdate b_var = tuple->b;
3112 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3113 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3114 long b_ref = (long)b_var.inner & ~1;
3117 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
3118 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3119 LDKChannelUpdate c_var = tuple->c;
3120 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3121 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3122 long c_ref = (long)c_var.inner & ~1;
3125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3126 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3127 ret->datalen = (*env)->GetArrayLength(env, elems);
3128 if (ret->datalen == 0) {
3131 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
3132 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3133 for (size_t i = 0; i < ret->datalen; i++) {
3134 int64_t arr_elem = java_elems[i];
3135 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_elem;
3136 FREE((void*)arr_elem);
3137 ret->data[i] = arr_elem_conv;
3139 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3143 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3144 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3145 for (size_t i = 0; i < ret.datalen; i++) {
3146 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3151 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3152 ret->datalen = (*env)->GetArrayLength(env, elems);
3153 if (ret->datalen == 0) {
3156 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
3157 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3158 for (size_t i = 0; i < ret->datalen; i++) {
3159 int64_t arr_elem = java_elems[i];
3160 LDKNodeAnnouncement arr_elem_conv;
3161 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3162 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3163 if (arr_elem_conv.inner != NULL)
3164 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3165 ret->data[i] = arr_elem_conv;
3167 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3171 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3172 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3173 for (size_t i = 0; i < ret.datalen; i++) {
3174 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3178 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3179 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3182 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
3183 CHECK(val->result_ok);
3184 return *val->contents.result;
3186 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3187 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
3188 CHECK(!val->result_ok);
3189 LDKLightningError err_var = (*val->contents.err);
3190 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3191 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3192 long err_ref = (long)err_var.inner & ~1;
3195 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3196 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3198 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3199 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
3200 CHECK(val->result_ok);
3201 LDKChannelReestablish res_var = (*val->contents.result);
3202 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3203 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3204 long res_ref = (long)res_var.inner & ~1;
3207 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3208 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
3209 CHECK(!val->result_ok);
3210 LDKDecodeError err_var = (*val->contents.err);
3211 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3212 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3213 long err_ref = (long)err_var.inner & ~1;
3216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3217 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3220 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
3221 CHECK(val->result_ok);
3222 LDKInit res_var = (*val->contents.result);
3223 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3224 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3225 long res_ref = (long)res_var.inner & ~1;
3228 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3229 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
3230 CHECK(!val->result_ok);
3231 LDKDecodeError err_var = (*val->contents.err);
3232 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3233 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3234 long err_ref = (long)err_var.inner & ~1;
3237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3238 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3240 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3241 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
3242 CHECK(val->result_ok);
3243 LDKPing res_var = (*val->contents.result);
3244 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3245 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3246 long res_ref = (long)res_var.inner & ~1;
3249 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3250 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
3251 CHECK(!val->result_ok);
3252 LDKDecodeError err_var = (*val->contents.err);
3253 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3254 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3255 long err_ref = (long)err_var.inner & ~1;
3258 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3259 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3261 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3262 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
3263 CHECK(val->result_ok);
3264 LDKPong res_var = (*val->contents.result);
3265 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3266 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3267 long res_ref = (long)res_var.inner & ~1;
3270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3271 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
3272 CHECK(!val->result_ok);
3273 LDKDecodeError err_var = (*val->contents.err);
3274 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3275 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3276 long err_ref = (long)err_var.inner & ~1;
3279 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3280 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3283 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
3284 CHECK(val->result_ok);
3285 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3286 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3287 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3288 long res_ref = (long)res_var.inner & ~1;
3291 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3292 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
3293 CHECK(!val->result_ok);
3294 LDKDecodeError err_var = (*val->contents.err);
3295 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3296 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3297 long err_ref = (long)err_var.inner & ~1;
3300 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3301 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3303 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3304 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
3305 CHECK(val->result_ok);
3306 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3307 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3308 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3309 long res_ref = (long)res_var.inner & ~1;
3312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3313 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
3314 CHECK(!val->result_ok);
3315 LDKDecodeError err_var = (*val->contents.err);
3316 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3317 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3318 long err_ref = (long)err_var.inner & ~1;
3321 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3322 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3325 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
3326 CHECK(val->result_ok);
3327 LDKErrorMessage res_var = (*val->contents.result);
3328 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3329 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3330 long res_ref = (long)res_var.inner & ~1;
3333 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3334 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
3335 CHECK(!val->result_ok);
3336 LDKDecodeError err_var = (*val->contents.err);
3337 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3338 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3339 long err_ref = (long)err_var.inner & ~1;
3342 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3343 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3346 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
3347 CHECK(val->result_ok);
3348 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3349 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3350 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3351 long res_ref = (long)res_var.inner & ~1;
3354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3355 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
3356 CHECK(!val->result_ok);
3357 LDKDecodeError err_var = (*val->contents.err);
3358 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3359 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3360 long err_ref = (long)err_var.inner & ~1;
3363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3364 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3367 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
3368 CHECK(val->result_ok);
3369 LDKQueryShortChannelIds res_var = (*val->contents.result);
3370 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3371 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3372 long res_ref = (long)res_var.inner & ~1;
3375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3376 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
3377 CHECK(!val->result_ok);
3378 LDKDecodeError err_var = (*val->contents.err);
3379 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3380 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3381 long err_ref = (long)err_var.inner & ~1;
3384 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3385 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3387 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3388 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
3389 CHECK(val->result_ok);
3390 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3391 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3392 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3393 long res_ref = (long)res_var.inner & ~1;
3396 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3397 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
3398 CHECK(!val->result_ok);
3399 LDKDecodeError err_var = (*val->contents.err);
3400 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3401 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3402 long err_ref = (long)err_var.inner & ~1;
3405 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3406 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3408 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3409 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
3410 CHECK(val->result_ok);
3411 LDKQueryChannelRange res_var = (*val->contents.result);
3412 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3413 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3414 long res_ref = (long)res_var.inner & ~1;
3417 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3418 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
3419 CHECK(!val->result_ok);
3420 LDKDecodeError err_var = (*val->contents.err);
3421 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3422 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3423 long err_ref = (long)err_var.inner & ~1;
3426 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3427 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3429 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3430 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
3431 CHECK(val->result_ok);
3432 LDKReplyChannelRange res_var = (*val->contents.result);
3433 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3434 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3435 long res_ref = (long)res_var.inner & ~1;
3438 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3439 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
3440 CHECK(!val->result_ok);
3441 LDKDecodeError err_var = (*val->contents.err);
3442 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3443 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3444 long err_ref = (long)err_var.inner & ~1;
3447 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3448 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3451 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
3452 CHECK(val->result_ok);
3453 LDKGossipTimestampFilter res_var = (*val->contents.result);
3454 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3455 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3456 long res_ref = (long)res_var.inner & ~1;
3459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3460 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
3461 CHECK(!val->result_ok);
3462 LDKDecodeError err_var = (*val->contents.err);
3463 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3464 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3465 long err_ref = (long)err_var.inner & ~1;
3468 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3469 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3472 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3473 CHECK(val->result_ok);
3474 LDKCVec_u8Z res_var = (*val->contents.result);
3475 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3476 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3480 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3481 CHECK(!val->result_ok);
3482 LDKPeerHandleError err_var = (*val->contents.err);
3483 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3484 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3485 long err_ref = (long)err_var.inner & ~1;
3488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3489 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3492 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
3493 CHECK(val->result_ok);
3494 return *val->contents.result;
3496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3497 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
3498 CHECK(!val->result_ok);
3499 LDKPeerHandleError err_var = (*val->contents.err);
3500 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3501 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3502 long err_ref = (long)err_var.inner & ~1;
3505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3506 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3508 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3509 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3510 CHECK(val->result_ok);
3511 return *val->contents.result;
3513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3514 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3515 CHECK(!val->result_ok);
3516 LDKPeerHandleError err_var = (*val->contents.err);
3517 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3518 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3519 long err_ref = (long)err_var.inner & ~1;
3522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3523 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3525 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3526 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3527 CHECK(val->result_ok);
3528 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3529 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
3532 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3533 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3534 CHECK(!val->result_ok);
3535 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3538 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3539 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3542 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3543 CHECK(val->result_ok);
3544 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
3545 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
3548 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3549 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3550 CHECK(!val->result_ok);
3551 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3555 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3558 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3559 CHECK(val->result_ok);
3560 LDKTxCreationKeys res_var = (*val->contents.result);
3561 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3562 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3563 long res_ref = (long)res_var.inner & ~1;
3566 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3567 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3568 CHECK(!val->result_ok);
3569 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3572 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3573 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
3575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3576 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
3577 CHECK(val->result_ok);
3578 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
3579 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3580 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3581 long res_ref = (long)res_var.inner & ~1;
3584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3585 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
3586 CHECK(!val->result_ok);
3587 return *val->contents.err;
3589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3590 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3591 ret->datalen = (*env)->GetArrayLength(env, elems);
3592 if (ret->datalen == 0) {
3595 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3596 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3597 for (size_t i = 0; i < ret->datalen; i++) {
3598 int64_t arr_elem = java_elems[i];
3599 LDKRouteHop arr_elem_conv;
3600 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3601 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3602 if (arr_elem_conv.inner != NULL)
3603 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3604 ret->data[i] = arr_elem_conv;
3606 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3610 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3611 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3612 for (size_t i = 0; i < ret.datalen; i++) {
3613 ret.data[i] = RouteHop_clone(&orig->data[i]);
3617 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3618 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3619 for (size_t i = 0; i < ret.datalen; i++) {
3620 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3624 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3625 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3627 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3628 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
3629 CHECK(val->result_ok);
3630 LDKRoute res_var = (*val->contents.result);
3631 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3632 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3633 long res_ref = (long)res_var.inner & ~1;
3636 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3637 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
3638 CHECK(!val->result_ok);
3639 LDKDecodeError err_var = (*val->contents.err);
3640 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3641 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3642 long err_ref = (long)err_var.inner & ~1;
3645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3646 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3647 ret->datalen = (*env)->GetArrayLength(env, elems);
3648 if (ret->datalen == 0) {
3651 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3652 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3653 for (size_t i = 0; i < ret->datalen; i++) {
3654 int64_t arr_elem = java_elems[i];
3655 LDKRouteHint arr_elem_conv;
3656 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3657 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3658 if (arr_elem_conv.inner != NULL)
3659 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3660 ret->data[i] = arr_elem_conv;
3662 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3666 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3667 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3668 for (size_t i = 0; i < ret.datalen; i++) {
3669 ret.data[i] = RouteHint_clone(&orig->data[i]);
3673 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3674 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3677 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3678 CHECK(val->result_ok);
3679 LDKRoute res_var = (*val->contents.result);
3680 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3681 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3682 long res_ref = (long)res_var.inner & ~1;
3685 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3686 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3687 CHECK(!val->result_ok);
3688 LDKLightningError err_var = (*val->contents.err);
3689 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3690 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3691 long err_ref = (long)err_var.inner & ~1;
3694 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3695 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3697 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3698 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
3699 CHECK(val->result_ok);
3700 LDKRoutingFees res_var = (*val->contents.result);
3701 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3702 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3703 long res_ref = (long)res_var.inner & ~1;
3706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3707 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
3708 CHECK(!val->result_ok);
3709 LDKDecodeError err_var = (*val->contents.err);
3710 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3711 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3712 long err_ref = (long)err_var.inner & ~1;
3715 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3716 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3719 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
3720 CHECK(val->result_ok);
3721 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3722 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3723 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3724 long res_ref = (long)res_var.inner & ~1;
3727 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3728 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
3729 CHECK(!val->result_ok);
3730 LDKDecodeError err_var = (*val->contents.err);
3731 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3732 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3733 long err_ref = (long)err_var.inner & ~1;
3736 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3737 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3740 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3741 CHECK(val->result_ok);
3742 LDKNodeInfo res_var = (*val->contents.result);
3743 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3744 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3745 long res_ref = (long)res_var.inner & ~1;
3748 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3749 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3750 CHECK(!val->result_ok);
3751 LDKDecodeError err_var = (*val->contents.err);
3752 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3753 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3754 long err_ref = (long)err_var.inner & ~1;
3757 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3758 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3761 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3762 CHECK(val->result_ok);
3763 LDKNetworkGraph res_var = (*val->contents.result);
3764 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3765 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3766 long res_ref = (long)res_var.inner & ~1;
3769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3770 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3771 CHECK(!val->result_ok);
3772 LDKDecodeError err_var = (*val->contents.err);
3773 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3774 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3775 long err_ref = (long)err_var.inner & ~1;
3778 typedef struct LDKMessageSendEventsProvider_JCalls {
3779 atomic_size_t refcnt;
3782 jmethodID get_and_clear_pending_msg_events_meth;
3783 } LDKMessageSendEventsProvider_JCalls;
3784 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3785 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3786 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3788 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3789 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3793 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3794 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3796 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3797 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3799 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
3800 LDKCVec_MessageSendEventZ arg_constr;
3801 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3802 if (arg_constr.datalen > 0)
3803 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3805 arg_constr.data = NULL;
3806 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3807 for (size_t s = 0; s < arg_constr.datalen; s++) {
3808 int64_t arr_conv_18 = arg_vals[s];
3809 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
3810 FREE((void*)arr_conv_18);
3811 arg_constr.data[s] = arr_conv_18_conv;
3813 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3816 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3817 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3818 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3819 return (void*) this_arg;
3821 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3822 jclass c = (*env)->GetObjectClass(env, o);
3824 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3825 atomic_init(&calls->refcnt, 1);
3826 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3827 calls->o = (*env)->NewWeakGlobalRef(env, o);
3828 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
3829 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
3831 LDKMessageSendEventsProvider ret = {
3832 .this_arg = (void*) calls,
3833 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3834 .free = LDKMessageSendEventsProvider_JCalls_free,
3838 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3839 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3840 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
3841 return (long)res_ptr;
3843 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3844 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3845 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3846 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3847 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3848 for (size_t s = 0; s < ret_var.datalen; s++) {
3849 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3850 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3851 long arr_conv_18_ref = (long)arr_conv_18_copy;
3852 ret_arr_ptr[s] = arr_conv_18_ref;
3854 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3859 typedef struct LDKEventsProvider_JCalls {
3860 atomic_size_t refcnt;
3863 jmethodID get_and_clear_pending_events_meth;
3864 } LDKEventsProvider_JCalls;
3865 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3866 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3867 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3869 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3870 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3874 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3875 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3877 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3878 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3880 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
3881 LDKCVec_EventZ arg_constr;
3882 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3883 if (arg_constr.datalen > 0)
3884 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3886 arg_constr.data = NULL;
3887 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3888 for (size_t h = 0; h < arg_constr.datalen; h++) {
3889 int64_t arr_conv_7 = arg_vals[h];
3890 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
3891 FREE((void*)arr_conv_7);
3892 arg_constr.data[h] = arr_conv_7_conv;
3894 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3897 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3898 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3899 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3900 return (void*) this_arg;
3902 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3903 jclass c = (*env)->GetObjectClass(env, o);
3905 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3906 atomic_init(&calls->refcnt, 1);
3907 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3908 calls->o = (*env)->NewWeakGlobalRef(env, o);
3909 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
3910 CHECK(calls->get_and_clear_pending_events_meth != NULL);
3912 LDKEventsProvider ret = {
3913 .this_arg = (void*) calls,
3914 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3915 .free = LDKEventsProvider_JCalls_free,
3919 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3920 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3921 *res_ptr = LDKEventsProvider_init(env, clz, o);
3922 return (long)res_ptr;
3924 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3925 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3926 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3927 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3928 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3929 for (size_t h = 0; h < ret_var.datalen; h++) {
3930 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3931 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
3932 long arr_conv_7_ref = (long)arr_conv_7_copy;
3933 ret_arr_ptr[h] = arr_conv_7_ref;
3935 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3940 typedef struct LDKAccess_JCalls {
3941 atomic_size_t refcnt;
3944 jmethodID get_utxo_meth;
3946 static void LDKAccess_JCalls_free(void* this_arg) {
3947 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3948 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3950 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3951 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3955 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3956 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3958 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3959 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
3960 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
3961 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3963 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3964 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
3968 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3969 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3970 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3971 return (void*) this_arg;
3973 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
3974 jclass c = (*env)->GetObjectClass(env, o);
3976 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3977 atomic_init(&calls->refcnt, 1);
3978 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3979 calls->o = (*env)->NewWeakGlobalRef(env, o);
3980 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3981 CHECK(calls->get_utxo_meth != NULL);
3984 .this_arg = (void*) calls,
3985 .get_utxo = get_utxo_jcall,
3986 .free = LDKAccess_JCalls_free,
3990 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
3991 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
3992 *res_ptr = LDKAccess_init(env, clz, o);
3993 return (long)res_ptr;
3995 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) {
3996 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
3997 unsigned char genesis_hash_arr[32];
3998 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
3999 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4000 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4001 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4002 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4003 return (long)ret_conv;
4006 typedef struct LDKFilter_JCalls {
4007 atomic_size_t refcnt;
4010 jmethodID register_tx_meth;
4011 jmethodID register_output_meth;
4013 static void LDKFilter_JCalls_free(void* this_arg) {
4014 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4015 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4017 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4018 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4022 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4023 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4025 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4026 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
4027 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
4028 LDKu8slice script_pubkey_var = script_pubkey;
4029 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4030 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4031 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4033 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4035 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4036 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4038 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4039 LDKOutPoint outpoint_var = *outpoint;
4040 if (outpoint->inner != NULL)
4041 outpoint_var = OutPoint_clone(outpoint);
4042 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4043 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4044 long outpoint_ref = (long)outpoint_var.inner;
4045 if (outpoint_var.is_owned) {
4048 LDKu8slice script_pubkey_var = script_pubkey;
4049 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4050 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4051 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4053 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4055 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4056 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4057 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4058 return (void*) this_arg;
4060 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
4061 jclass c = (*env)->GetObjectClass(env, o);
4063 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4064 atomic_init(&calls->refcnt, 1);
4065 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4066 calls->o = (*env)->NewWeakGlobalRef(env, o);
4067 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
4068 CHECK(calls->register_tx_meth != NULL);
4069 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
4070 CHECK(calls->register_output_meth != NULL);
4073 .this_arg = (void*) calls,
4074 .register_tx = register_tx_jcall,
4075 .register_output = register_output_jcall,
4076 .free = LDKFilter_JCalls_free,
4080 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
4081 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4082 *res_ptr = LDKFilter_init(env, clz, o);
4083 return (long)res_ptr;
4085 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) {
4086 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4087 unsigned char txid_arr[32];
4088 CHECK((*env)->GetArrayLength(env, txid) == 32);
4089 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
4090 unsigned char (*txid_ref)[32] = &txid_arr;
4091 LDKu8slice script_pubkey_ref;
4092 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4093 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4094 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4095 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t outpoint, int8_tArray script_pubkey) {
4099 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4100 LDKOutPoint outpoint_conv;
4101 outpoint_conv.inner = (void*)(outpoint & (~1));
4102 outpoint_conv.is_owned = false;
4103 LDKu8slice script_pubkey_ref;
4104 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4105 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4106 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4107 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4110 typedef struct LDKPersist_JCalls {
4111 atomic_size_t refcnt;
4114 jmethodID persist_new_channel_meth;
4115 jmethodID update_persisted_channel_meth;
4116 } LDKPersist_JCalls;
4117 static void LDKPersist_JCalls_free(void* this_arg) {
4118 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4119 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4121 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4122 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4126 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4127 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4129 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4130 LDKOutPoint id_var = id;
4131 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4132 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4133 long id_ref = (long)id_var.inner;
4134 if (id_var.is_owned) {
4137 LDKChannelMonitor data_var = *data;
4138 // Warning: we may need a move here but can't clone!
4139 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4140 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4141 long data_ref = (long)data_var.inner;
4142 if (data_var.is_owned) {
4145 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4147 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
4148 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
4152 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4153 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4155 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4156 LDKOutPoint id_var = id;
4157 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4158 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4159 long id_ref = (long)id_var.inner;
4160 if (id_var.is_owned) {
4163 LDKChannelMonitorUpdate update_var = *update;
4164 if (update->inner != NULL)
4165 update_var = ChannelMonitorUpdate_clone(update);
4166 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4167 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4168 long update_ref = (long)update_var.inner;
4169 if (update_var.is_owned) {
4172 LDKChannelMonitor data_var = *data;
4173 // Warning: we may need a move here but can't clone!
4174 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4175 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4176 long data_ref = (long)data_var.inner;
4177 if (data_var.is_owned) {
4180 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4182 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4183 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
4187 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4188 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4189 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4190 return (void*) this_arg;
4192 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
4193 jclass c = (*env)->GetObjectClass(env, o);
4195 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4196 atomic_init(&calls->refcnt, 1);
4197 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4198 calls->o = (*env)->NewWeakGlobalRef(env, o);
4199 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
4200 CHECK(calls->persist_new_channel_meth != NULL);
4201 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
4202 CHECK(calls->update_persisted_channel_meth != NULL);
4205 .this_arg = (void*) calls,
4206 .persist_new_channel = persist_new_channel_jcall,
4207 .update_persisted_channel = update_persisted_channel_jcall,
4208 .free = LDKPersist_JCalls_free,
4212 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
4213 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4214 *res_ptr = LDKPersist_init(env, clz, o);
4215 return (long)res_ptr;
4217 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) {
4218 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4219 LDKOutPoint id_conv;
4220 id_conv.inner = (void*)(id & (~1));
4221 id_conv.is_owned = (id & 1) || (id == 0);
4222 if (id_conv.inner != NULL)
4223 id_conv = OutPoint_clone(&id_conv);
4224 LDKChannelMonitor data_conv;
4225 data_conv.inner = (void*)(data & (~1));
4226 data_conv.is_owned = false;
4227 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4228 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4229 return (long)ret_conv;
4232 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) {
4233 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4234 LDKOutPoint id_conv;
4235 id_conv.inner = (void*)(id & (~1));
4236 id_conv.is_owned = (id & 1) || (id == 0);
4237 if (id_conv.inner != NULL)
4238 id_conv = OutPoint_clone(&id_conv);
4239 LDKChannelMonitorUpdate update_conv;
4240 update_conv.inner = (void*)(update & (~1));
4241 update_conv.is_owned = false;
4242 LDKChannelMonitor data_conv;
4243 data_conv.inner = (void*)(data & (~1));
4244 data_conv.is_owned = false;
4245 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4246 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4247 return (long)ret_conv;
4250 typedef struct LDKChannelMessageHandler_JCalls {
4251 atomic_size_t refcnt;
4254 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4255 jmethodID handle_open_channel_meth;
4256 jmethodID handle_accept_channel_meth;
4257 jmethodID handle_funding_created_meth;
4258 jmethodID handle_funding_signed_meth;
4259 jmethodID handle_funding_locked_meth;
4260 jmethodID handle_shutdown_meth;
4261 jmethodID handle_closing_signed_meth;
4262 jmethodID handle_update_add_htlc_meth;
4263 jmethodID handle_update_fulfill_htlc_meth;
4264 jmethodID handle_update_fail_htlc_meth;
4265 jmethodID handle_update_fail_malformed_htlc_meth;
4266 jmethodID handle_commitment_signed_meth;
4267 jmethodID handle_revoke_and_ack_meth;
4268 jmethodID handle_update_fee_meth;
4269 jmethodID handle_announcement_signatures_meth;
4270 jmethodID peer_disconnected_meth;
4271 jmethodID peer_connected_meth;
4272 jmethodID handle_channel_reestablish_meth;
4273 jmethodID handle_error_meth;
4274 } LDKChannelMessageHandler_JCalls;
4275 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4276 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4277 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4279 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4280 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4284 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4285 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4287 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4288 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4289 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4290 LDKInitFeatures their_features_var = their_features;
4291 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4292 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4293 long their_features_ref = (long)their_features_var.inner;
4294 if (their_features_var.is_owned) {
4295 their_features_ref |= 1;
4297 LDKOpenChannel msg_var = *msg;
4298 if (msg->inner != NULL)
4299 msg_var = OpenChannel_clone(msg);
4300 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4301 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4302 long msg_ref = (long)msg_var.inner;
4303 if (msg_var.is_owned) {
4306 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4308 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4310 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4311 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4313 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4314 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4315 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4316 LDKInitFeatures their_features_var = their_features;
4317 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4318 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4319 long their_features_ref = (long)their_features_var.inner;
4320 if (their_features_var.is_owned) {
4321 their_features_ref |= 1;
4323 LDKAcceptChannel msg_var = *msg;
4324 if (msg->inner != NULL)
4325 msg_var = AcceptChannel_clone(msg);
4326 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4327 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4328 long msg_ref = (long)msg_var.inner;
4329 if (msg_var.is_owned) {
4332 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4334 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4336 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4337 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4339 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4340 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4341 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4342 LDKFundingCreated msg_var = *msg;
4343 if (msg->inner != NULL)
4344 msg_var = FundingCreated_clone(msg);
4345 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4346 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4347 long msg_ref = (long)msg_var.inner;
4348 if (msg_var.is_owned) {
4351 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4353 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4355 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4356 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4358 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4359 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4360 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4361 LDKFundingSigned msg_var = *msg;
4362 if (msg->inner != NULL)
4363 msg_var = FundingSigned_clone(msg);
4364 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4365 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4366 long msg_ref = (long)msg_var.inner;
4367 if (msg_var.is_owned) {
4370 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4372 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4374 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4375 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4377 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4378 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4379 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4380 LDKFundingLocked msg_var = *msg;
4381 if (msg->inner != NULL)
4382 msg_var = FundingLocked_clone(msg);
4383 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4384 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4385 long msg_ref = (long)msg_var.inner;
4386 if (msg_var.is_owned) {
4389 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4391 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4393 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
4394 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4396 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4397 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4398 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4399 LDKShutdown msg_var = *msg;
4400 if (msg->inner != NULL)
4401 msg_var = Shutdown_clone(msg);
4402 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4403 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4404 long msg_ref = (long)msg_var.inner;
4405 if (msg_var.is_owned) {
4408 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4410 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
4412 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4413 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4415 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4416 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4417 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4418 LDKClosingSigned msg_var = *msg;
4419 if (msg->inner != NULL)
4420 msg_var = ClosingSigned_clone(msg);
4421 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4422 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4423 long msg_ref = (long)msg_var.inner;
4424 if (msg_var.is_owned) {
4427 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4429 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4431 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4432 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4434 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4435 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4436 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4437 LDKUpdateAddHTLC msg_var = *msg;
4438 if (msg->inner != NULL)
4439 msg_var = UpdateAddHTLC_clone(msg);
4440 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4441 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4442 long msg_ref = (long)msg_var.inner;
4443 if (msg_var.is_owned) {
4446 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4448 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4450 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4451 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4453 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4454 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4455 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4456 LDKUpdateFulfillHTLC msg_var = *msg;
4457 if (msg->inner != NULL)
4458 msg_var = UpdateFulfillHTLC_clone(msg);
4459 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4460 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4461 long msg_ref = (long)msg_var.inner;
4462 if (msg_var.is_owned) {
4465 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4467 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4469 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4470 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4472 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4473 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4474 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4475 LDKUpdateFailHTLC msg_var = *msg;
4476 if (msg->inner != NULL)
4477 msg_var = UpdateFailHTLC_clone(msg);
4478 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4479 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4480 long msg_ref = (long)msg_var.inner;
4481 if (msg_var.is_owned) {
4484 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4486 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4488 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4489 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4491 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4492 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4493 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4494 LDKUpdateFailMalformedHTLC msg_var = *msg;
4495 if (msg->inner != NULL)
4496 msg_var = UpdateFailMalformedHTLC_clone(msg);
4497 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4498 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4499 long msg_ref = (long)msg_var.inner;
4500 if (msg_var.is_owned) {
4503 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4505 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4507 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4508 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4510 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4511 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4512 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4513 LDKCommitmentSigned msg_var = *msg;
4514 if (msg->inner != NULL)
4515 msg_var = CommitmentSigned_clone(msg);
4516 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4517 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4518 long msg_ref = (long)msg_var.inner;
4519 if (msg_var.is_owned) {
4522 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4524 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4526 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4527 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4529 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4530 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4531 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4532 LDKRevokeAndACK msg_var = *msg;
4533 if (msg->inner != NULL)
4534 msg_var = RevokeAndACK_clone(msg);
4535 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4536 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4537 long msg_ref = (long)msg_var.inner;
4538 if (msg_var.is_owned) {
4541 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4543 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4545 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4546 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4548 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4549 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4550 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4551 LDKUpdateFee msg_var = *msg;
4552 if (msg->inner != NULL)
4553 msg_var = UpdateFee_clone(msg);
4554 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4555 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4556 long msg_ref = (long)msg_var.inner;
4557 if (msg_var.is_owned) {
4560 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4562 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4564 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4565 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4567 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4568 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4569 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4570 LDKAnnouncementSignatures msg_var = *msg;
4571 if (msg->inner != NULL)
4572 msg_var = AnnouncementSignatures_clone(msg);
4573 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4574 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4575 long msg_ref = (long)msg_var.inner;
4576 if (msg_var.is_owned) {
4579 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4581 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4583 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4584 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4586 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4587 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4588 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4589 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4591 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4593 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4594 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4596 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4597 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4598 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4599 LDKInit msg_var = *msg;
4600 if (msg->inner != NULL)
4601 msg_var = Init_clone(msg);
4602 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4603 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4604 long msg_ref = (long)msg_var.inner;
4605 if (msg_var.is_owned) {
4608 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4610 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4612 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4613 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4615 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4616 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4617 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4618 LDKChannelReestablish msg_var = *msg;
4619 if (msg->inner != NULL)
4620 msg_var = ChannelReestablish_clone(msg);
4621 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4622 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4623 long msg_ref = (long)msg_var.inner;
4624 if (msg_var.is_owned) {
4627 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4629 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4631 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4632 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4634 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4635 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4636 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4637 LDKErrorMessage msg_var = *msg;
4638 if (msg->inner != NULL)
4639 msg_var = ErrorMessage_clone(msg);
4640 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4641 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4642 long msg_ref = (long)msg_var.inner;
4643 if (msg_var.is_owned) {
4646 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4648 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4650 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4651 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4652 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4653 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4654 return (void*) this_arg;
4656 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4657 jclass c = (*env)->GetObjectClass(env, o);
4659 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4660 atomic_init(&calls->refcnt, 1);
4661 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4662 calls->o = (*env)->NewWeakGlobalRef(env, o);
4663 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
4664 CHECK(calls->handle_open_channel_meth != NULL);
4665 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
4666 CHECK(calls->handle_accept_channel_meth != NULL);
4667 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
4668 CHECK(calls->handle_funding_created_meth != NULL);
4669 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
4670 CHECK(calls->handle_funding_signed_meth != NULL);
4671 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
4672 CHECK(calls->handle_funding_locked_meth != NULL);
4673 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
4674 CHECK(calls->handle_shutdown_meth != NULL);
4675 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
4676 CHECK(calls->handle_closing_signed_meth != NULL);
4677 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
4678 CHECK(calls->handle_update_add_htlc_meth != NULL);
4679 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
4680 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
4681 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
4682 CHECK(calls->handle_update_fail_htlc_meth != NULL);
4683 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
4684 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
4685 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
4686 CHECK(calls->handle_commitment_signed_meth != NULL);
4687 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
4688 CHECK(calls->handle_revoke_and_ack_meth != NULL);
4689 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
4690 CHECK(calls->handle_update_fee_meth != NULL);
4691 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
4692 CHECK(calls->handle_announcement_signatures_meth != NULL);
4693 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
4694 CHECK(calls->peer_disconnected_meth != NULL);
4695 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
4696 CHECK(calls->peer_connected_meth != NULL);
4697 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
4698 CHECK(calls->handle_channel_reestablish_meth != NULL);
4699 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
4700 CHECK(calls->handle_error_meth != NULL);
4702 LDKChannelMessageHandler ret = {
4703 .this_arg = (void*) calls,
4704 .handle_open_channel = handle_open_channel_jcall,
4705 .handle_accept_channel = handle_accept_channel_jcall,
4706 .handle_funding_created = handle_funding_created_jcall,
4707 .handle_funding_signed = handle_funding_signed_jcall,
4708 .handle_funding_locked = handle_funding_locked_jcall,
4709 .handle_shutdown = handle_shutdown_jcall,
4710 .handle_closing_signed = handle_closing_signed_jcall,
4711 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4712 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4713 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4714 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4715 .handle_commitment_signed = handle_commitment_signed_jcall,
4716 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4717 .handle_update_fee = handle_update_fee_jcall,
4718 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4719 .peer_disconnected = peer_disconnected_jcall,
4720 .peer_connected = peer_connected_jcall,
4721 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4722 .handle_error = handle_error_jcall,
4723 .free = LDKChannelMessageHandler_JCalls_free,
4724 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
4726 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4729 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4730 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4731 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
4732 return (long)res_ptr;
4734 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) {
4735 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4736 LDKPublicKey their_node_id_ref;
4737 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4738 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4739 LDKInitFeatures their_features_conv;
4740 their_features_conv.inner = (void*)(their_features & (~1));
4741 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4742 // Warning: we may need a move here but can't clone!
4743 LDKOpenChannel msg_conv;
4744 msg_conv.inner = (void*)(msg & (~1));
4745 msg_conv.is_owned = false;
4746 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4749 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) {
4750 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4751 LDKPublicKey their_node_id_ref;
4752 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4753 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4754 LDKInitFeatures their_features_conv;
4755 their_features_conv.inner = (void*)(their_features & (~1));
4756 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4757 // Warning: we may need a move here but can't clone!
4758 LDKAcceptChannel msg_conv;
4759 msg_conv.inner = (void*)(msg & (~1));
4760 msg_conv.is_owned = false;
4761 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4764 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) {
4765 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4766 LDKPublicKey their_node_id_ref;
4767 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4768 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4769 LDKFundingCreated msg_conv;
4770 msg_conv.inner = (void*)(msg & (~1));
4771 msg_conv.is_owned = false;
4772 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4775 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) {
4776 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4777 LDKPublicKey their_node_id_ref;
4778 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4779 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4780 LDKFundingSigned msg_conv;
4781 msg_conv.inner = (void*)(msg & (~1));
4782 msg_conv.is_owned = false;
4783 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4786 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) {
4787 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4788 LDKPublicKey their_node_id_ref;
4789 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4790 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4791 LDKFundingLocked msg_conv;
4792 msg_conv.inner = (void*)(msg & (~1));
4793 msg_conv.is_owned = false;
4794 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
4798 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4799 LDKPublicKey their_node_id_ref;
4800 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4801 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4802 LDKShutdown msg_conv;
4803 msg_conv.inner = (void*)(msg & (~1));
4804 msg_conv.is_owned = false;
4805 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4808 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) {
4809 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4810 LDKPublicKey their_node_id_ref;
4811 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4812 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4813 LDKClosingSigned msg_conv;
4814 msg_conv.inner = (void*)(msg & (~1));
4815 msg_conv.is_owned = false;
4816 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4819 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) {
4820 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4821 LDKPublicKey their_node_id_ref;
4822 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4823 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4824 LDKUpdateAddHTLC msg_conv;
4825 msg_conv.inner = (void*)(msg & (~1));
4826 msg_conv.is_owned = false;
4827 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4830 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) {
4831 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4832 LDKPublicKey their_node_id_ref;
4833 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4834 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4835 LDKUpdateFulfillHTLC msg_conv;
4836 msg_conv.inner = (void*)(msg & (~1));
4837 msg_conv.is_owned = false;
4838 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4841 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) {
4842 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4843 LDKPublicKey their_node_id_ref;
4844 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4845 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4846 LDKUpdateFailHTLC msg_conv;
4847 msg_conv.inner = (void*)(msg & (~1));
4848 msg_conv.is_owned = false;
4849 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4852 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) {
4853 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4854 LDKPublicKey their_node_id_ref;
4855 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4856 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4857 LDKUpdateFailMalformedHTLC msg_conv;
4858 msg_conv.inner = (void*)(msg & (~1));
4859 msg_conv.is_owned = false;
4860 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4863 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) {
4864 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4865 LDKPublicKey their_node_id_ref;
4866 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4867 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4868 LDKCommitmentSigned msg_conv;
4869 msg_conv.inner = (void*)(msg & (~1));
4870 msg_conv.is_owned = false;
4871 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4874 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) {
4875 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4876 LDKPublicKey their_node_id_ref;
4877 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4878 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4879 LDKRevokeAndACK msg_conv;
4880 msg_conv.inner = (void*)(msg & (~1));
4881 msg_conv.is_owned = false;
4882 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4885 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) {
4886 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4887 LDKPublicKey their_node_id_ref;
4888 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4889 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4890 LDKUpdateFee msg_conv;
4891 msg_conv.inner = (void*)(msg & (~1));
4892 msg_conv.is_owned = false;
4893 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4896 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) {
4897 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4898 LDKPublicKey their_node_id_ref;
4899 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4900 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4901 LDKAnnouncementSignatures msg_conv;
4902 msg_conv.inner = (void*)(msg & (~1));
4903 msg_conv.is_owned = false;
4904 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4907 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) {
4908 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4909 LDKPublicKey their_node_id_ref;
4910 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4911 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4912 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4915 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) {
4916 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4917 LDKPublicKey their_node_id_ref;
4918 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4919 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4921 msg_conv.inner = (void*)(msg & (~1));
4922 msg_conv.is_owned = false;
4923 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4926 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) {
4927 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4928 LDKPublicKey their_node_id_ref;
4929 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4930 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4931 LDKChannelReestablish msg_conv;
4932 msg_conv.inner = (void*)(msg & (~1));
4933 msg_conv.is_owned = false;
4934 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4937 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) {
4938 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4939 LDKPublicKey their_node_id_ref;
4940 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4941 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4942 LDKErrorMessage msg_conv;
4943 msg_conv.inner = (void*)(msg & (~1));
4944 msg_conv.is_owned = false;
4945 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4948 typedef struct LDKRoutingMessageHandler_JCalls {
4949 atomic_size_t refcnt;
4952 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4953 jmethodID handle_node_announcement_meth;
4954 jmethodID handle_channel_announcement_meth;
4955 jmethodID handle_channel_update_meth;
4956 jmethodID handle_htlc_fail_channel_update_meth;
4957 jmethodID get_next_channel_announcements_meth;
4958 jmethodID get_next_node_announcements_meth;
4959 jmethodID sync_routing_table_meth;
4960 jmethodID handle_reply_channel_range_meth;
4961 jmethodID handle_reply_short_channel_ids_end_meth;
4962 jmethodID handle_query_channel_range_meth;
4963 jmethodID handle_query_short_channel_ids_meth;
4964 } LDKRoutingMessageHandler_JCalls;
4965 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4966 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4967 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4969 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4970 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4974 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
4975 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4977 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4978 LDKNodeAnnouncement msg_var = *msg;
4979 if (msg->inner != NULL)
4980 msg_var = NodeAnnouncement_clone(msg);
4981 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4982 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4983 long msg_ref = (long)msg_var.inner;
4984 if (msg_var.is_owned) {
4987 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4989 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
4990 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4994 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
4995 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4997 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4998 LDKChannelAnnouncement msg_var = *msg;
4999 if (msg->inner != NULL)
5000 msg_var = ChannelAnnouncement_clone(msg);
5001 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5002 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5003 long msg_ref = (long)msg_var.inner;
5004 if (msg_var.is_owned) {
5007 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5009 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
5010 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5014 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5015 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5017 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5018 LDKChannelUpdate msg_var = *msg;
5019 if (msg->inner != NULL)
5020 msg_var = ChannelUpdate_clone(msg);
5021 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5022 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5023 long msg_ref = (long)msg_var.inner;
5024 if (msg_var.is_owned) {
5027 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5029 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
5030 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5034 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5035 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5037 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5038 long ret_update = (long)update;
5039 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5041 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5043 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5044 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5046 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5047 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5049 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5050 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
5051 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
5052 if (arg_constr.datalen > 0)
5053 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5055 arg_constr.data = NULL;
5056 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
5057 for (size_t l = 0; l < arg_constr.datalen; l++) {
5058 int64_t arr_conv_63 = arg_vals[l];
5059 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5060 FREE((void*)arr_conv_63);
5061 arg_constr.data[l] = arr_conv_63_conv;
5063 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
5066 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5067 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5069 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5070 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
5071 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
5072 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5074 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5075 LDKCVec_NodeAnnouncementZ arg_constr;
5076 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
5077 if (arg_constr.datalen > 0)
5078 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5080 arg_constr.data = NULL;
5081 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
5082 for (size_t s = 0; s < arg_constr.datalen; s++) {
5083 int64_t arr_conv_18 = arg_vals[s];
5084 LDKNodeAnnouncement arr_conv_18_conv;
5085 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5086 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5087 if (arr_conv_18_conv.inner != NULL)
5088 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
5089 arg_constr.data[s] = arr_conv_18_conv;
5091 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
5094 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5095 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5097 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5098 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5099 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5100 LDKInit init_var = *init;
5101 if (init->inner != NULL)
5102 init_var = Init_clone(init);
5103 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5104 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5105 long init_ref = (long)init_var.inner;
5106 if (init_var.is_owned) {
5109 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5111 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5113 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5114 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5116 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5117 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5118 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5119 LDKReplyChannelRange msg_var = msg;
5120 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5121 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5122 long msg_ref = (long)msg_var.inner;
5123 if (msg_var.is_owned) {
5126 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5128 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5129 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5133 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5134 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5136 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5137 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5138 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5139 LDKReplyShortChannelIdsEnd msg_var = msg;
5140 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5141 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5142 long msg_ref = (long)msg_var.inner;
5143 if (msg_var.is_owned) {
5146 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5148 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5149 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5153 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5154 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5156 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5157 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5158 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5159 LDKQueryChannelRange msg_var = msg;
5160 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5161 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5162 long msg_ref = (long)msg_var.inner;
5163 if (msg_var.is_owned) {
5166 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5168 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5169 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5173 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5174 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5176 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5177 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5178 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5179 LDKQueryShortChannelIds msg_var = msg;
5180 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5181 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5182 long msg_ref = (long)msg_var.inner;
5183 if (msg_var.is_owned) {
5186 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5188 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5189 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5193 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5194 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5195 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5196 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5197 return (void*) this_arg;
5199 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5200 jclass c = (*env)->GetObjectClass(env, o);
5202 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5203 atomic_init(&calls->refcnt, 1);
5204 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5205 calls->o = (*env)->NewWeakGlobalRef(env, o);
5206 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
5207 CHECK(calls->handle_node_announcement_meth != NULL);
5208 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
5209 CHECK(calls->handle_channel_announcement_meth != NULL);
5210 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
5211 CHECK(calls->handle_channel_update_meth != NULL);
5212 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
5213 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
5214 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
5215 CHECK(calls->get_next_channel_announcements_meth != NULL);
5216 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
5217 CHECK(calls->get_next_node_announcements_meth != NULL);
5218 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
5219 CHECK(calls->sync_routing_table_meth != NULL);
5220 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
5221 CHECK(calls->handle_reply_channel_range_meth != NULL);
5222 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
5223 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
5224 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
5225 CHECK(calls->handle_query_channel_range_meth != NULL);
5226 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
5227 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
5229 LDKRoutingMessageHandler ret = {
5230 .this_arg = (void*) calls,
5231 .handle_node_announcement = handle_node_announcement_jcall,
5232 .handle_channel_announcement = handle_channel_announcement_jcall,
5233 .handle_channel_update = handle_channel_update_jcall,
5234 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
5235 .get_next_channel_announcements = get_next_channel_announcements_jcall,
5236 .get_next_node_announcements = get_next_node_announcements_jcall,
5237 .sync_routing_table = sync_routing_table_jcall,
5238 .handle_reply_channel_range = handle_reply_channel_range_jcall,
5239 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
5240 .handle_query_channel_range = handle_query_channel_range_jcall,
5241 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5242 .free = LDKRoutingMessageHandler_JCalls_free,
5243 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5245 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5248 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5249 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5250 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5251 return (long)res_ptr;
5253 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5254 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5255 LDKNodeAnnouncement msg_conv;
5256 msg_conv.inner = (void*)(msg & (~1));
5257 msg_conv.is_owned = false;
5258 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5259 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5260 return (long)ret_conv;
5263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5264 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5265 LDKChannelAnnouncement msg_conv;
5266 msg_conv.inner = (void*)(msg & (~1));
5267 msg_conv.is_owned = false;
5268 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5269 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5270 return (long)ret_conv;
5273 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5274 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5275 LDKChannelUpdate msg_conv;
5276 msg_conv.inner = (void*)(msg & (~1));
5277 msg_conv.is_owned = false;
5278 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5279 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5280 return (long)ret_conv;
5283 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) {
5284 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5285 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5286 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5289 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) {
5290 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5291 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5292 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5293 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5294 for (size_t l = 0; l < ret_var.datalen; l++) {
5295 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5296 *arr_conv_63_ref = ret_var.data[l];
5297 arr_conv_63_ref->a = ChannelAnnouncement_clone(&arr_conv_63_ref->a);
5298 arr_conv_63_ref->b = ChannelUpdate_clone(&arr_conv_63_ref->b);
5299 arr_conv_63_ref->c = ChannelUpdate_clone(&arr_conv_63_ref->c);
5300 ret_arr_ptr[l] = (long)arr_conv_63_ref;
5302 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5307 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) {
5308 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5309 LDKPublicKey starting_point_ref;
5310 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
5311 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
5312 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5313 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5314 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5315 for (size_t s = 0; s < ret_var.datalen; s++) {
5316 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
5317 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5318 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5319 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
5320 if (arr_conv_18_var.is_owned) {
5321 arr_conv_18_ref |= 1;
5323 ret_arr_ptr[s] = arr_conv_18_ref;
5325 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5330 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) {
5331 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5332 LDKPublicKey their_node_id_ref;
5333 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5334 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5336 init_conv.inner = (void*)(init & (~1));
5337 init_conv.is_owned = false;
5338 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5341 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) {
5342 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5343 LDKPublicKey their_node_id_ref;
5344 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5345 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5346 LDKReplyChannelRange msg_conv;
5347 msg_conv.inner = (void*)(msg & (~1));
5348 msg_conv.is_owned = (msg & 1) || (msg == 0);
5349 if (msg_conv.inner != NULL)
5350 msg_conv = ReplyChannelRange_clone(&msg_conv);
5351 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5352 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5353 return (long)ret_conv;
5356 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) {
5357 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5358 LDKPublicKey their_node_id_ref;
5359 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5360 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5361 LDKReplyShortChannelIdsEnd msg_conv;
5362 msg_conv.inner = (void*)(msg & (~1));
5363 msg_conv.is_owned = (msg & 1) || (msg == 0);
5364 if (msg_conv.inner != NULL)
5365 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5366 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5367 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5368 return (long)ret_conv;
5371 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) {
5372 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5373 LDKPublicKey their_node_id_ref;
5374 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5375 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5376 LDKQueryChannelRange msg_conv;
5377 msg_conv.inner = (void*)(msg & (~1));
5378 msg_conv.is_owned = (msg & 1) || (msg == 0);
5379 if (msg_conv.inner != NULL)
5380 msg_conv = QueryChannelRange_clone(&msg_conv);
5381 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5382 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5383 return (long)ret_conv;
5386 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) {
5387 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5388 LDKPublicKey their_node_id_ref;
5389 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5390 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5391 LDKQueryShortChannelIds msg_conv;
5392 msg_conv.inner = (void*)(msg & (~1));
5393 msg_conv.is_owned = (msg & 1) || (msg == 0);
5394 if (msg_conv.inner != NULL)
5395 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5396 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5397 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5398 return (long)ret_conv;
5401 typedef struct LDKSocketDescriptor_JCalls {
5402 atomic_size_t refcnt;
5405 jmethodID send_data_meth;
5406 jmethodID disconnect_socket_meth;
5408 jmethodID hash_meth;
5409 } LDKSocketDescriptor_JCalls;
5410 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5411 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5412 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5414 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5415 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5419 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5420 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5422 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5423 LDKu8slice data_var = data;
5424 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
5425 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
5426 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5428 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
5430 void disconnect_socket_jcall(void* this_arg) {
5431 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5433 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5434 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5436 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
5438 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5439 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5441 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5442 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5443 *other_arg_clone = SocketDescriptor_clone(other_arg);
5444 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5446 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
5448 uint64_t hash_jcall(const void* this_arg) {
5449 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5451 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5452 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5454 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
5456 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5457 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5458 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5459 return (void*) this_arg;
5461 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
5462 jclass c = (*env)->GetObjectClass(env, o);
5464 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5465 atomic_init(&calls->refcnt, 1);
5466 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5467 calls->o = (*env)->NewWeakGlobalRef(env, o);
5468 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
5469 CHECK(calls->send_data_meth != NULL);
5470 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
5471 CHECK(calls->disconnect_socket_meth != NULL);
5472 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
5473 CHECK(calls->eq_meth != NULL);
5474 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
5475 CHECK(calls->hash_meth != NULL);
5477 LDKSocketDescriptor ret = {
5478 .this_arg = (void*) calls,
5479 .send_data = send_data_jcall,
5480 .disconnect_socket = disconnect_socket_jcall,
5483 .clone = LDKSocketDescriptor_JCalls_clone,
5484 .free = LDKSocketDescriptor_JCalls_free,
5488 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
5489 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5490 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
5491 return (long)res_ptr;
5493 JNIEXPORT intptr_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray data, jboolean resume_read) {
5494 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5495 LDKu8slice data_ref;
5496 data_ref.datalen = (*env)->GetArrayLength(env, data);
5497 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
5498 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5499 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
5503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
5504 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5505 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5508 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
5509 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5510 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
5515 LDKTransaction _res_ref;
5516 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
5517 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5518 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
5519 _res_ref.data_is_owned = true;
5520 Transaction_free(_res_ref);
5523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
5524 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5526 TxOut_free(_res_conv);
5529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5530 LDKCVec_SpendableOutputDescriptorZ _res_constr;
5531 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5532 if (_res_constr.datalen > 0)
5533 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5535 _res_constr.data = NULL;
5536 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5537 for (size_t b = 0; b < _res_constr.datalen; b++) {
5538 int64_t arr_conv_27 = _res_vals[b];
5539 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5540 FREE((void*)arr_conv_27);
5541 _res_constr.data[b] = arr_conv_27_conv;
5543 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5544 CVec_SpendableOutputDescriptorZ_free(_res_constr);
5547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5548 LDKCVec_MessageSendEventZ _res_constr;
5549 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5550 if (_res_constr.datalen > 0)
5551 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5553 _res_constr.data = NULL;
5554 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5555 for (size_t s = 0; s < _res_constr.datalen; s++) {
5556 int64_t arr_conv_18 = _res_vals[s];
5557 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5558 FREE((void*)arr_conv_18);
5559 _res_constr.data[s] = arr_conv_18_conv;
5561 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5562 CVec_MessageSendEventZ_free(_res_constr);
5565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5566 LDKCVec_EventZ _res_constr;
5567 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5568 if (_res_constr.datalen > 0)
5569 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5571 _res_constr.data = NULL;
5572 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5573 for (size_t h = 0; h < _res_constr.datalen; h++) {
5574 int64_t arr_conv_7 = _res_vals[h];
5575 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5576 FREE((void*)arr_conv_7);
5577 _res_constr.data[h] = arr_conv_7_conv;
5579 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5580 CVec_EventZ_free(_res_constr);
5583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5584 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)_res;
5586 C2Tuple_usizeTransactionZ_free(_res_conv);
5589 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, intptr_t a, int8_tArray b) {
5590 LDKTransaction b_ref;
5591 b_ref.datalen = (*env)->GetArrayLength(env, b);
5592 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5593 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5594 b_ref.data_is_owned = true;
5595 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5596 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5597 // XXX: We likely need to clone here, but no _clone fn is available for byte[]
5598 return (long)ret_ref;
5601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5602 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
5603 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5604 if (_res_constr.datalen > 0)
5605 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5607 _res_constr.data = NULL;
5608 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5609 for (size_t y = 0; y < _res_constr.datalen; y++) {
5610 int64_t arr_conv_24 = _res_vals[y];
5611 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5612 FREE((void*)arr_conv_24);
5613 _res_constr.data[y] = arr_conv_24_conv;
5615 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5616 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
5619 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
5620 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5621 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5622 return (long)ret_conv;
5625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
5626 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
5627 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5628 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
5629 return (long)ret_conv;
5632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5633 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)_res;
5635 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
5638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5639 LDKCVec_MonitorEventZ _res_constr;
5640 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5641 if (_res_constr.datalen > 0)
5642 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5644 _res_constr.data = NULL;
5645 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5646 for (size_t o = 0; o < _res_constr.datalen; o++) {
5647 int64_t arr_conv_14 = _res_vals[o];
5648 LDKMonitorEvent arr_conv_14_conv;
5649 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5650 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5651 _res_constr.data[o] = arr_conv_14_conv;
5653 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5654 CVec_MonitorEventZ_free(_res_constr);
5657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5658 LDKChannelMonitorUpdate o_conv;
5659 o_conv.inner = (void*)(o & (~1));
5660 o_conv.is_owned = (o & 1) || (o == 0);
5661 if (o_conv.inner != NULL)
5662 o_conv = ChannelMonitorUpdate_clone(&o_conv);
5663 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5664 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
5665 return (long)ret_conv;
5668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5669 LDKDecodeError e_conv;
5670 e_conv.inner = (void*)(e & (~1));
5671 e_conv.is_owned = (e & 1) || (e == 0);
5672 // Warning: we may need a move here but can't clone!
5673 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5674 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
5675 return (long)ret_conv;
5678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5679 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)_res;
5681 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
5684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
5685 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5686 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5687 return (long)ret_conv;
5690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5691 LDKMonitorUpdateError e_conv;
5692 e_conv.inner = (void*)(e & (~1));
5693 e_conv.is_owned = (e & 1) || (e == 0);
5694 // Warning: we may need a move here but can't clone!
5695 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5696 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
5697 return (long)ret_conv;
5700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5701 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)_res;
5703 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
5706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5707 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)_res;
5709 C2Tuple_OutPointScriptZ_free(_res_conv);
5712 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
5714 a_conv.inner = (void*)(a & (~1));
5715 a_conv.is_owned = (a & 1) || (a == 0);
5716 if (a_conv.inner != NULL)
5717 a_conv = OutPoint_clone(&a_conv);
5719 b_ref.datalen = (*env)->GetArrayLength(env, b);
5720 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5721 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5722 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5723 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5724 ret_ref->a = OutPoint_clone(&ret_ref->a);
5725 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
5726 return (long)ret_ref;
5729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5730 LDKCVec_TransactionZ _res_constr;
5731 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5732 if (_res_constr.datalen > 0)
5733 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5735 _res_constr.data = NULL;
5736 for (size_t i = 0; i < _res_constr.datalen; i++) {
5737 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5738 LDKTransaction arr_conv_8_ref;
5739 arr_conv_8_ref.datalen = (*env)->GetArrayLength(env, arr_conv_8);
5740 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5741 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5742 arr_conv_8_ref.data_is_owned = true;
5743 _res_constr.data[i] = arr_conv_8_ref;
5745 CVec_TransactionZ_free(_res_constr);
5748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5749 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)_res;
5751 C2Tuple_u32TxOutZ_free(_res_conv);
5754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5755 LDKTxOut b_conv = *(LDKTxOut*)b;
5757 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5758 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
5759 // XXX: We likely need to clone here, but no _clone fn is available for TxOut
5760 return (long)ret_ref;
5763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5764 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
5765 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5766 if (_res_constr.datalen > 0)
5767 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5769 _res_constr.data = NULL;
5770 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5771 for (size_t a = 0; a < _res_constr.datalen; a++) {
5772 int64_t arr_conv_26 = _res_vals[a];
5773 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
5774 FREE((void*)arr_conv_26);
5775 _res_constr.data[a] = arr_conv_26_conv;
5777 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5778 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
5781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5782 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)_res;
5784 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
5787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5788 LDKThirtyTwoBytes a_ref;
5789 CHECK((*env)->GetArrayLength(env, a) == 32);
5790 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5791 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5792 b_constr.datalen = (*env)->GetArrayLength(env, b);
5793 if (b_constr.datalen > 0)
5794 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5796 b_constr.data = NULL;
5797 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5798 for (size_t a = 0; a < b_constr.datalen; a++) {
5799 int64_t arr_conv_26 = b_vals[a];
5800 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
5801 FREE((void*)arr_conv_26);
5802 b_constr.data[a] = arr_conv_26_conv;
5804 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5805 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5806 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
5807 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
5808 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Integer, TxOut>[]
5809 return (long)ret_ref;
5812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5813 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
5814 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5815 if (_res_constr.datalen > 0)
5816 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
5818 _res_constr.data = NULL;
5819 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5820 for (size_t u = 0; u < _res_constr.datalen; u++) {
5821 int64_t arr_conv_46 = _res_vals[u];
5822 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_conv_46;
5823 FREE((void*)arr_conv_46);
5824 _res_constr.data[u] = arr_conv_46_conv;
5826 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5827 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
5830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5831 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)_res;
5833 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
5836 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5837 LDKThirtyTwoBytes a_ref;
5838 CHECK((*env)->GetArrayLength(env, a) == 32);
5839 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5840 LDKChannelMonitor b_conv;
5841 b_conv.inner = (void*)(b & (~1));
5842 b_conv.is_owned = (b & 1) || (b == 0);
5843 // Warning: we may need a move here but can't clone!
5844 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5845 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
5846 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
5847 // XXX: We likely need to clone here, but no _clone fn is available for ChannelMonitor
5848 return (long)ret_ref;
5851 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5852 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)o;
5854 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5855 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
5856 return (long)ret_conv;
5859 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5860 LDKDecodeError e_conv;
5861 e_conv.inner = (void*)(e & (~1));
5862 e_conv.is_owned = (e & 1) || (e == 0);
5863 // Warning: we may need a move here but can't clone!
5864 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5865 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
5866 return (long)ret_conv;
5869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5870 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)_res;
5872 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
5875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
5876 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)_res;
5878 C2Tuple_u64u64Z_free(_res_conv);
5881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
5882 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5883 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5884 return (long)ret_ref;
5887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5888 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)o;
5890 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5891 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
5892 return (long)ret_conv;
5895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5896 LDKDecodeError e_conv;
5897 e_conv.inner = (void*)(e & (~1));
5898 e_conv.is_owned = (e & 1) || (e == 0);
5899 // Warning: we may need a move here but can't clone!
5900 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5901 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
5902 return (long)ret_conv;
5905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5906 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)_res;
5908 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
5911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5912 LDKCVec_SignatureZ _res_constr;
5913 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5914 if (_res_constr.datalen > 0)
5915 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5917 _res_constr.data = NULL;
5918 for (size_t i = 0; i < _res_constr.datalen; i++) {
5919 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5920 LDKSignature arr_conv_8_ref;
5921 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5922 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5923 _res_constr.data[i] = arr_conv_8_ref;
5925 CVec_SignatureZ_free(_res_constr);
5928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5929 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)_res;
5931 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
5934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
5936 CHECK((*env)->GetArrayLength(env, a) == 64);
5937 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
5938 LDKCVec_SignatureZ b_constr;
5939 b_constr.datalen = (*env)->GetArrayLength(env, b);
5940 if (b_constr.datalen > 0)
5941 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5943 b_constr.data = NULL;
5944 for (size_t i = 0; i < b_constr.datalen; i++) {
5945 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
5946 LDKSignature arr_conv_8_ref;
5947 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5948 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5949 b_constr.data[i] = arr_conv_8_ref;
5951 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5952 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5953 // XXX: We likely need to clone here, but no _clone fn is available for byte[]
5954 // XXX: We likely need to clone here, but no _clone fn is available for byte[][]
5955 return (long)ret_ref;
5958 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5959 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)o;
5961 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5962 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
5963 return (long)ret_conv;
5966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
5967 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5968 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5969 return (long)ret_conv;
5972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5973 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)_res;
5975 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
5978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
5980 CHECK((*env)->GetArrayLength(env, o) == 64);
5981 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
5982 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5983 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
5984 return (long)ret_conv;
5987 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
5988 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5989 *ret_conv = CResult_SignatureNoneZ_err();
5990 return (long)ret_conv;
5993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5994 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)_res;
5996 CResult_SignatureNoneZ_free(_res_conv);
5999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6000 LDKCVec_SignatureZ o_constr;
6001 o_constr.datalen = (*env)->GetArrayLength(env, o);
6002 if (o_constr.datalen > 0)
6003 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6005 o_constr.data = NULL;
6006 for (size_t i = 0; i < o_constr.datalen; i++) {
6007 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6008 LDKSignature arr_conv_8_ref;
6009 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
6010 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
6011 o_constr.data[i] = arr_conv_8_ref;
6013 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6014 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6015 return (long)ret_conv;
6018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
6019 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6020 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6021 return (long)ret_conv;
6024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6025 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)_res;
6027 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6031 LDKChannelKeys o_conv = *(LDKChannelKeys*)o;
6032 if (o_conv.free == LDKChannelKeys_JCalls_free) {
6033 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6034 LDKChannelKeys_JCalls_clone(o_conv.this_arg);
6036 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
6037 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
6038 return (long)ret_conv;
6041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6042 LDKDecodeError e_conv;
6043 e_conv.inner = (void*)(e & (~1));
6044 e_conv.is_owned = (e & 1) || (e == 0);
6045 // Warning: we may need a move here but can't clone!
6046 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
6047 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
6048 return (long)ret_conv;
6051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6052 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)_res;
6054 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
6057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6058 LDKInMemoryChannelKeys o_conv;
6059 o_conv.inner = (void*)(o & (~1));
6060 o_conv.is_owned = (o & 1) || (o == 0);
6061 if (o_conv.inner != NULL)
6062 o_conv = InMemoryChannelKeys_clone(&o_conv);
6063 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6064 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
6065 return (long)ret_conv;
6068 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6069 LDKDecodeError e_conv;
6070 e_conv.inner = (void*)(e & (~1));
6071 e_conv.is_owned = (e & 1) || (e == 0);
6072 // Warning: we may need a move here but can't clone!
6073 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6074 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
6075 return (long)ret_conv;
6078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6079 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)_res;
6081 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
6084 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6085 LDKTxOut o_conv = *(LDKTxOut*)o;
6087 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6088 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
6089 return (long)ret_conv;
6092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6093 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
6094 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6095 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6096 return (long)ret_conv;
6099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6100 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)_res;
6102 CResult_TxOutAccessErrorZ_free(_res_conv);
6105 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
6106 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6107 *ret_conv = CResult_NoneAPIErrorZ_ok();
6108 return (long)ret_conv;
6111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6112 LDKAPIError e_conv = *(LDKAPIError*)e;
6114 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6115 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6116 return (long)ret_conv;
6119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6120 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)_res;
6122 CResult_NoneAPIErrorZ_free(_res_conv);
6125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6126 LDKCVec_ChannelDetailsZ _res_constr;
6127 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6128 if (_res_constr.datalen > 0)
6129 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6131 _res_constr.data = NULL;
6132 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6133 for (size_t q = 0; q < _res_constr.datalen; q++) {
6134 int64_t arr_conv_16 = _res_vals[q];
6135 LDKChannelDetails arr_conv_16_conv;
6136 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6137 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6138 _res_constr.data[q] = arr_conv_16_conv;
6140 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6141 CVec_ChannelDetailsZ_free(_res_constr);
6144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
6145 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6146 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
6147 return (long)ret_conv;
6150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6151 LDKPaymentSendFailure e_conv;
6152 e_conv.inner = (void*)(e & (~1));
6153 e_conv.is_owned = (e & 1) || (e == 0);
6154 // Warning: we may need a move here but can't clone!
6155 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6156 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
6157 return (long)ret_conv;
6160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6161 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)_res;
6163 CResult_NonePaymentSendFailureZ_free(_res_conv);
6166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6167 LDKCVec_NetAddressZ _res_constr;
6168 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6169 if (_res_constr.datalen > 0)
6170 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6172 _res_constr.data = NULL;
6173 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6174 for (size_t m = 0; m < _res_constr.datalen; m++) {
6175 int64_t arr_conv_12 = _res_vals[m];
6176 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6177 FREE((void*)arr_conv_12);
6178 _res_constr.data[m] = arr_conv_12_conv;
6180 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6181 CVec_NetAddressZ_free(_res_constr);
6184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6185 LDKCVec_ChannelMonitorZ _res_constr;
6186 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6187 if (_res_constr.datalen > 0)
6188 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6190 _res_constr.data = NULL;
6191 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6192 for (size_t q = 0; q < _res_constr.datalen; q++) {
6193 int64_t arr_conv_16 = _res_vals[q];
6194 LDKChannelMonitor arr_conv_16_conv;
6195 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6196 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6197 _res_constr.data[q] = arr_conv_16_conv;
6199 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6200 CVec_ChannelMonitorZ_free(_res_constr);
6203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6204 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)_res;
6206 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6209 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
6210 LDKThirtyTwoBytes a_ref;
6211 CHECK((*env)->GetArrayLength(env, a) == 32);
6212 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
6213 LDKChannelManager b_conv;
6214 b_conv.inner = (void*)(b & (~1));
6215 b_conv.is_owned = (b & 1) || (b == 0);
6216 // Warning: we may need a move here but can't clone!
6217 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6218 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6219 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
6220 // XXX: We likely need to clone here, but no _clone fn is available for ChannelManager
6221 return (long)ret_ref;
6224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6225 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)o;
6227 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6228 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6229 return (long)ret_conv;
6232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6233 LDKDecodeError e_conv;
6234 e_conv.inner = (void*)(e & (~1));
6235 e_conv.is_owned = (e & 1) || (e == 0);
6236 // Warning: we may need a move here but can't clone!
6237 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6238 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6239 return (long)ret_conv;
6242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6243 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)_res;
6245 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
6249 LDKNetAddress o_conv = *(LDKNetAddress*)o;
6251 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6252 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
6253 return (long)ret_conv;
6256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
6257 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6258 *ret_conv = CResult_NetAddressu8Z_err(e);
6259 return (long)ret_conv;
6262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
6263 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)_res;
6265 CResult_NetAddressu8Z_free(_res_conv);
6268 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6269 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)o;
6271 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6272 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
6273 return (long)ret_conv;
6276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6277 LDKDecodeError e_conv;
6278 e_conv.inner = (void*)(e & (~1));
6279 e_conv.is_owned = (e & 1) || (e == 0);
6280 // Warning: we may need a move here but can't clone!
6281 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6282 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
6283 return (long)ret_conv;
6286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6287 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)_res;
6289 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
6292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6293 LDKCVec_u64Z _res_constr;
6294 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6295 if (_res_constr.datalen > 0)
6296 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6298 _res_constr.data = NULL;
6299 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6300 for (size_t g = 0; g < _res_constr.datalen; g++) {
6301 int64_t arr_conv_6 = _res_vals[g];
6302 _res_constr.data[g] = arr_conv_6;
6304 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6305 CVec_u64Z_free(_res_constr);
6308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6309 LDKCVec_UpdateAddHTLCZ _res_constr;
6310 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6311 if (_res_constr.datalen > 0)
6312 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
6314 _res_constr.data = NULL;
6315 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6316 for (size_t p = 0; p < _res_constr.datalen; p++) {
6317 int64_t arr_conv_15 = _res_vals[p];
6318 LDKUpdateAddHTLC arr_conv_15_conv;
6319 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
6320 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
6321 _res_constr.data[p] = arr_conv_15_conv;
6323 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6324 CVec_UpdateAddHTLCZ_free(_res_constr);
6327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6328 LDKCVec_UpdateFulfillHTLCZ _res_constr;
6329 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6330 if (_res_constr.datalen > 0)
6331 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
6333 _res_constr.data = NULL;
6334 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6335 for (size_t t = 0; t < _res_constr.datalen; t++) {
6336 int64_t arr_conv_19 = _res_vals[t];
6337 LDKUpdateFulfillHTLC arr_conv_19_conv;
6338 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
6339 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
6340 _res_constr.data[t] = arr_conv_19_conv;
6342 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6343 CVec_UpdateFulfillHTLCZ_free(_res_constr);
6346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6347 LDKCVec_UpdateFailHTLCZ _res_constr;
6348 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6349 if (_res_constr.datalen > 0)
6350 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
6352 _res_constr.data = NULL;
6353 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6354 for (size_t q = 0; q < _res_constr.datalen; q++) {
6355 int64_t arr_conv_16 = _res_vals[q];
6356 LDKUpdateFailHTLC arr_conv_16_conv;
6357 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6358 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6359 _res_constr.data[q] = arr_conv_16_conv;
6361 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6362 CVec_UpdateFailHTLCZ_free(_res_constr);
6365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6366 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
6367 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6368 if (_res_constr.datalen > 0)
6369 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
6371 _res_constr.data = NULL;
6372 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6373 for (size_t z = 0; z < _res_constr.datalen; z++) {
6374 int64_t arr_conv_25 = _res_vals[z];
6375 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
6376 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
6377 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
6378 _res_constr.data[z] = arr_conv_25_conv;
6380 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6381 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
6384 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6385 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6386 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6387 return (long)ret_conv;
6390 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6391 LDKLightningError e_conv;
6392 e_conv.inner = (void*)(e & (~1));
6393 e_conv.is_owned = (e & 1) || (e == 0);
6394 // Warning: we may need a move here but can't clone!
6395 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6396 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6397 return (long)ret_conv;
6400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6401 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)_res;
6403 CResult_boolLightningErrorZ_free(_res_conv);
6406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6407 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)_res;
6409 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6412 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) {
6413 LDKChannelAnnouncement a_conv;
6414 a_conv.inner = (void*)(a & (~1));
6415 a_conv.is_owned = (a & 1) || (a == 0);
6416 if (a_conv.inner != NULL)
6417 a_conv = ChannelAnnouncement_clone(&a_conv);
6418 LDKChannelUpdate b_conv;
6419 b_conv.inner = (void*)(b & (~1));
6420 b_conv.is_owned = (b & 1) || (b == 0);
6421 if (b_conv.inner != NULL)
6422 b_conv = ChannelUpdate_clone(&b_conv);
6423 LDKChannelUpdate c_conv;
6424 c_conv.inner = (void*)(c & (~1));
6425 c_conv.is_owned = (c & 1) || (c == 0);
6426 if (c_conv.inner != NULL)
6427 c_conv = ChannelUpdate_clone(&c_conv);
6428 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6429 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6430 ret_ref->a = ChannelAnnouncement_clone(&ret_ref->a);
6431 ret_ref->b = ChannelUpdate_clone(&ret_ref->b);
6432 ret_ref->c = ChannelUpdate_clone(&ret_ref->c);
6433 return (long)ret_ref;
6436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6437 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6438 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6439 if (_res_constr.datalen > 0)
6440 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6442 _res_constr.data = NULL;
6443 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6444 for (size_t l = 0; l < _res_constr.datalen; l++) {
6445 int64_t arr_conv_63 = _res_vals[l];
6446 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
6447 FREE((void*)arr_conv_63);
6448 _res_constr.data[l] = arr_conv_63_conv;
6450 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6451 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6455 LDKCVec_NodeAnnouncementZ _res_constr;
6456 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6457 if (_res_constr.datalen > 0)
6458 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6460 _res_constr.data = NULL;
6461 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6462 for (size_t s = 0; s < _res_constr.datalen; s++) {
6463 int64_t arr_conv_18 = _res_vals[s];
6464 LDKNodeAnnouncement arr_conv_18_conv;
6465 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
6466 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
6467 _res_constr.data[s] = arr_conv_18_conv;
6469 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6470 CVec_NodeAnnouncementZ_free(_res_constr);
6473 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6474 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6475 *ret_conv = CResult_NoneLightningErrorZ_ok();
6476 return (long)ret_conv;
6479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6480 LDKLightningError e_conv;
6481 e_conv.inner = (void*)(e & (~1));
6482 e_conv.is_owned = (e & 1) || (e == 0);
6483 // Warning: we may need a move here but can't clone!
6484 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6485 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6486 return (long)ret_conv;
6489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6490 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)_res;
6492 CResult_NoneLightningErrorZ_free(_res_conv);
6495 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6496 LDKChannelReestablish o_conv;
6497 o_conv.inner = (void*)(o & (~1));
6498 o_conv.is_owned = (o & 1) || (o == 0);
6499 if (o_conv.inner != NULL)
6500 o_conv = ChannelReestablish_clone(&o_conv);
6501 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6502 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
6503 return (long)ret_conv;
6506 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6507 LDKDecodeError e_conv;
6508 e_conv.inner = (void*)(e & (~1));
6509 e_conv.is_owned = (e & 1) || (e == 0);
6510 // Warning: we may need a move here but can't clone!
6511 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6512 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
6513 return (long)ret_conv;
6516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6517 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)_res;
6519 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
6522 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6524 o_conv.inner = (void*)(o & (~1));
6525 o_conv.is_owned = (o & 1) || (o == 0);
6526 if (o_conv.inner != NULL)
6527 o_conv = Init_clone(&o_conv);
6528 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6529 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
6530 return (long)ret_conv;
6533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6534 LDKDecodeError e_conv;
6535 e_conv.inner = (void*)(e & (~1));
6536 e_conv.is_owned = (e & 1) || (e == 0);
6537 // Warning: we may need a move here but can't clone!
6538 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6539 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
6540 return (long)ret_conv;
6543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6544 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)_res;
6546 CResult_InitDecodeErrorZ_free(_res_conv);
6549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6551 o_conv.inner = (void*)(o & (~1));
6552 o_conv.is_owned = (o & 1) || (o == 0);
6553 if (o_conv.inner != NULL)
6554 o_conv = Ping_clone(&o_conv);
6555 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6556 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
6557 return (long)ret_conv;
6560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6561 LDKDecodeError e_conv;
6562 e_conv.inner = (void*)(e & (~1));
6563 e_conv.is_owned = (e & 1) || (e == 0);
6564 // Warning: we may need a move here but can't clone!
6565 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6566 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
6567 return (long)ret_conv;
6570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6571 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)_res;
6573 CResult_PingDecodeErrorZ_free(_res_conv);
6576 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6578 o_conv.inner = (void*)(o & (~1));
6579 o_conv.is_owned = (o & 1) || (o == 0);
6580 if (o_conv.inner != NULL)
6581 o_conv = Pong_clone(&o_conv);
6582 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6583 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
6584 return (long)ret_conv;
6587 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6588 LDKDecodeError e_conv;
6589 e_conv.inner = (void*)(e & (~1));
6590 e_conv.is_owned = (e & 1) || (e == 0);
6591 // Warning: we may need a move here but can't clone!
6592 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6593 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
6594 return (long)ret_conv;
6597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6598 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)_res;
6600 CResult_PongDecodeErrorZ_free(_res_conv);
6603 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6604 LDKUnsignedChannelAnnouncement o_conv;
6605 o_conv.inner = (void*)(o & (~1));
6606 o_conv.is_owned = (o & 1) || (o == 0);
6607 if (o_conv.inner != NULL)
6608 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
6609 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6610 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
6611 return (long)ret_conv;
6614 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6615 LDKDecodeError e_conv;
6616 e_conv.inner = (void*)(e & (~1));
6617 e_conv.is_owned = (e & 1) || (e == 0);
6618 // Warning: we may need a move here but can't clone!
6619 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6620 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
6621 return (long)ret_conv;
6624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6625 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)_res;
6627 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
6630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6631 LDKUnsignedChannelUpdate o_conv;
6632 o_conv.inner = (void*)(o & (~1));
6633 o_conv.is_owned = (o & 1) || (o == 0);
6634 if (o_conv.inner != NULL)
6635 o_conv = UnsignedChannelUpdate_clone(&o_conv);
6636 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6637 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
6638 return (long)ret_conv;
6641 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6642 LDKDecodeError e_conv;
6643 e_conv.inner = (void*)(e & (~1));
6644 e_conv.is_owned = (e & 1) || (e == 0);
6645 // Warning: we may need a move here but can't clone!
6646 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6647 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
6648 return (long)ret_conv;
6651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6652 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)_res;
6654 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
6657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6658 LDKErrorMessage o_conv;
6659 o_conv.inner = (void*)(o & (~1));
6660 o_conv.is_owned = (o & 1) || (o == 0);
6661 if (o_conv.inner != NULL)
6662 o_conv = ErrorMessage_clone(&o_conv);
6663 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6664 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
6665 return (long)ret_conv;
6668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6669 LDKDecodeError e_conv;
6670 e_conv.inner = (void*)(e & (~1));
6671 e_conv.is_owned = (e & 1) || (e == 0);
6672 // Warning: we may need a move here but can't clone!
6673 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6674 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
6675 return (long)ret_conv;
6678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6679 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)_res;
6681 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
6684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6685 LDKUnsignedNodeAnnouncement o_conv;
6686 o_conv.inner = (void*)(o & (~1));
6687 o_conv.is_owned = (o & 1) || (o == 0);
6688 if (o_conv.inner != NULL)
6689 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
6690 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6691 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
6692 return (long)ret_conv;
6695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6696 LDKDecodeError e_conv;
6697 e_conv.inner = (void*)(e & (~1));
6698 e_conv.is_owned = (e & 1) || (e == 0);
6699 // Warning: we may need a move here but can't clone!
6700 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6701 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
6702 return (long)ret_conv;
6705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6706 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)_res;
6708 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
6711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6712 LDKQueryShortChannelIds o_conv;
6713 o_conv.inner = (void*)(o & (~1));
6714 o_conv.is_owned = (o & 1) || (o == 0);
6715 if (o_conv.inner != NULL)
6716 o_conv = QueryShortChannelIds_clone(&o_conv);
6717 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6718 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
6719 return (long)ret_conv;
6722 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6723 LDKDecodeError e_conv;
6724 e_conv.inner = (void*)(e & (~1));
6725 e_conv.is_owned = (e & 1) || (e == 0);
6726 // Warning: we may need a move here but can't clone!
6727 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6728 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
6729 return (long)ret_conv;
6732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6733 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)_res;
6735 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
6738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6739 LDKReplyShortChannelIdsEnd o_conv;
6740 o_conv.inner = (void*)(o & (~1));
6741 o_conv.is_owned = (o & 1) || (o == 0);
6742 if (o_conv.inner != NULL)
6743 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
6744 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6745 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
6746 return (long)ret_conv;
6749 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6750 LDKDecodeError e_conv;
6751 e_conv.inner = (void*)(e & (~1));
6752 e_conv.is_owned = (e & 1) || (e == 0);
6753 // Warning: we may need a move here but can't clone!
6754 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6755 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
6756 return (long)ret_conv;
6759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6760 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)_res;
6762 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
6765 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6766 LDKQueryChannelRange o_conv;
6767 o_conv.inner = (void*)(o & (~1));
6768 o_conv.is_owned = (o & 1) || (o == 0);
6769 if (o_conv.inner != NULL)
6770 o_conv = QueryChannelRange_clone(&o_conv);
6771 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6772 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
6773 return (long)ret_conv;
6776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6777 LDKDecodeError e_conv;
6778 e_conv.inner = (void*)(e & (~1));
6779 e_conv.is_owned = (e & 1) || (e == 0);
6780 // Warning: we may need a move here but can't clone!
6781 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6782 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
6783 return (long)ret_conv;
6786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6787 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)_res;
6789 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
6792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6793 LDKReplyChannelRange o_conv;
6794 o_conv.inner = (void*)(o & (~1));
6795 o_conv.is_owned = (o & 1) || (o == 0);
6796 if (o_conv.inner != NULL)
6797 o_conv = ReplyChannelRange_clone(&o_conv);
6798 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6799 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
6800 return (long)ret_conv;
6803 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6804 LDKDecodeError e_conv;
6805 e_conv.inner = (void*)(e & (~1));
6806 e_conv.is_owned = (e & 1) || (e == 0);
6807 // Warning: we may need a move here but can't clone!
6808 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6809 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
6810 return (long)ret_conv;
6813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6814 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)_res;
6816 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
6819 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6820 LDKGossipTimestampFilter o_conv;
6821 o_conv.inner = (void*)(o & (~1));
6822 o_conv.is_owned = (o & 1) || (o == 0);
6823 if (o_conv.inner != NULL)
6824 o_conv = GossipTimestampFilter_clone(&o_conv);
6825 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6826 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
6827 return (long)ret_conv;
6830 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6831 LDKDecodeError e_conv;
6832 e_conv.inner = (void*)(e & (~1));
6833 e_conv.is_owned = (e & 1) || (e == 0);
6834 // Warning: we may need a move here but can't clone!
6835 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6836 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
6837 return (long)ret_conv;
6840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6841 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)_res;
6843 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
6846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6847 LDKCVec_PublicKeyZ _res_constr;
6848 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6849 if (_res_constr.datalen > 0)
6850 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6852 _res_constr.data = NULL;
6853 for (size_t i = 0; i < _res_constr.datalen; i++) {
6854 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6855 LDKPublicKey arr_conv_8_ref;
6856 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 33);
6857 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
6858 _res_constr.data[i] = arr_conv_8_ref;
6860 CVec_PublicKeyZ_free(_res_constr);
6863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6864 LDKCVec_u8Z _res_ref;
6865 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6866 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6867 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6868 CVec_u8Z_free(_res_ref);
6871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6873 o_ref.datalen = (*env)->GetArrayLength(env, o);
6874 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6875 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
6876 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6877 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6878 return (long)ret_conv;
6881 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6882 LDKPeerHandleError e_conv;
6883 e_conv.inner = (void*)(e & (~1));
6884 e_conv.is_owned = (e & 1) || (e == 0);
6885 // Warning: we may need a move here but can't clone!
6886 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6887 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6888 return (long)ret_conv;
6891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6892 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)_res;
6894 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6897 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
6898 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6899 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6900 return (long)ret_conv;
6903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6904 LDKPeerHandleError e_conv;
6905 e_conv.inner = (void*)(e & (~1));
6906 e_conv.is_owned = (e & 1) || (e == 0);
6907 // Warning: we may need a move here but can't clone!
6908 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6909 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6910 return (long)ret_conv;
6913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6914 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)_res;
6916 CResult_NonePeerHandleErrorZ_free(_res_conv);
6919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6920 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6921 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6922 return (long)ret_conv;
6925 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6926 LDKPeerHandleError e_conv;
6927 e_conv.inner = (void*)(e & (~1));
6928 e_conv.is_owned = (e & 1) || (e == 0);
6929 // Warning: we may need a move here but can't clone!
6930 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6931 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6932 return (long)ret_conv;
6935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6936 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)_res;
6938 CResult_boolPeerHandleErrorZ_free(_res_conv);
6941 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6943 CHECK((*env)->GetArrayLength(env, o) == 32);
6944 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
6945 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6946 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
6947 return (long)ret_conv;
6950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6951 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6952 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6953 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
6954 return (long)ret_conv;
6957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6958 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)_res;
6960 CResult_SecretKeySecpErrorZ_free(_res_conv);
6963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6965 CHECK((*env)->GetArrayLength(env, o) == 33);
6966 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
6967 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
6968 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
6969 return (long)ret_conv;
6972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6973 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6974 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
6975 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
6976 return (long)ret_conv;
6979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6980 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)_res;
6982 CResult_PublicKeySecpErrorZ_free(_res_conv);
6985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6986 LDKTxCreationKeys o_conv;
6987 o_conv.inner = (void*)(o & (~1));
6988 o_conv.is_owned = (o & 1) || (o == 0);
6989 if (o_conv.inner != NULL)
6990 o_conv = TxCreationKeys_clone(&o_conv);
6991 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
6992 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
6993 return (long)ret_conv;
6996 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6997 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
6998 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
6999 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
7000 return (long)ret_conv;
7003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7004 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)_res;
7006 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
7009 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7010 LDKTrustedCommitmentTransaction o_conv;
7011 o_conv.inner = (void*)(o & (~1));
7012 o_conv.is_owned = (o & 1) || (o == 0);
7013 // Warning: we may need a move here but can't clone!
7014 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7015 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7016 return (long)ret_conv;
7019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
7020 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7021 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
7022 return (long)ret_conv;
7025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7026 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)_res;
7028 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7032 LDKCVec_RouteHopZ _res_constr;
7033 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7034 if (_res_constr.datalen > 0)
7035 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7037 _res_constr.data = NULL;
7038 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7039 for (size_t k = 0; k < _res_constr.datalen; k++) {
7040 int64_t arr_conv_10 = _res_vals[k];
7041 LDKRouteHop arr_conv_10_conv;
7042 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7043 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7044 _res_constr.data[k] = arr_conv_10_conv;
7046 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7047 CVec_RouteHopZ_free(_res_constr);
7050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7051 LDKCVec_CVec_RouteHopZZ _res_constr;
7052 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7053 if (_res_constr.datalen > 0)
7054 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7056 _res_constr.data = NULL;
7057 for (size_t m = 0; m < _res_constr.datalen; m++) {
7058 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
7059 LDKCVec_RouteHopZ arr_conv_12_constr;
7060 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
7061 if (arr_conv_12_constr.datalen > 0)
7062 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7064 arr_conv_12_constr.data = NULL;
7065 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
7066 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
7067 int64_t arr_conv_10 = arr_conv_12_vals[k];
7068 LDKRouteHop arr_conv_10_conv;
7069 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7070 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7071 arr_conv_12_constr.data[k] = arr_conv_10_conv;
7073 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
7074 _res_constr.data[m] = arr_conv_12_constr;
7076 CVec_CVec_RouteHopZZ_free(_res_constr);
7079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7081 o_conv.inner = (void*)(o & (~1));
7082 o_conv.is_owned = (o & 1) || (o == 0);
7083 if (o_conv.inner != NULL)
7084 o_conv = Route_clone(&o_conv);
7085 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7086 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7087 return (long)ret_conv;
7090 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7091 LDKDecodeError e_conv;
7092 e_conv.inner = (void*)(e & (~1));
7093 e_conv.is_owned = (e & 1) || (e == 0);
7094 // Warning: we may need a move here but can't clone!
7095 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7096 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7097 return (long)ret_conv;
7100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7101 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)_res;
7103 CResult_RouteDecodeErrorZ_free(_res_conv);
7106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7107 LDKCVec_RouteHintZ _res_constr;
7108 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7109 if (_res_constr.datalen > 0)
7110 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7112 _res_constr.data = NULL;
7113 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7114 for (size_t l = 0; l < _res_constr.datalen; l++) {
7115 int64_t arr_conv_11 = _res_vals[l];
7116 LDKRouteHint arr_conv_11_conv;
7117 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
7118 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
7119 _res_constr.data[l] = arr_conv_11_conv;
7121 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7122 CVec_RouteHintZ_free(_res_constr);
7125 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7127 o_conv.inner = (void*)(o & (~1));
7128 o_conv.is_owned = (o & 1) || (o == 0);
7129 if (o_conv.inner != NULL)
7130 o_conv = Route_clone(&o_conv);
7131 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7132 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7133 return (long)ret_conv;
7136 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7137 LDKLightningError e_conv;
7138 e_conv.inner = (void*)(e & (~1));
7139 e_conv.is_owned = (e & 1) || (e == 0);
7140 // Warning: we may need a move here but can't clone!
7141 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7142 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7143 return (long)ret_conv;
7146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7147 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)_res;
7149 CResult_RouteLightningErrorZ_free(_res_conv);
7152 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7153 LDKRoutingFees o_conv;
7154 o_conv.inner = (void*)(o & (~1));
7155 o_conv.is_owned = (o & 1) || (o == 0);
7156 if (o_conv.inner != NULL)
7157 o_conv = RoutingFees_clone(&o_conv);
7158 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7159 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7160 return (long)ret_conv;
7163 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7164 LDKDecodeError e_conv;
7165 e_conv.inner = (void*)(e & (~1));
7166 e_conv.is_owned = (e & 1) || (e == 0);
7167 // Warning: we may need a move here but can't clone!
7168 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7169 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7170 return (long)ret_conv;
7173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7174 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)_res;
7176 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7179 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7180 LDKNodeAnnouncementInfo o_conv;
7181 o_conv.inner = (void*)(o & (~1));
7182 o_conv.is_owned = (o & 1) || (o == 0);
7183 // Warning: we may need a move here but can't clone!
7184 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7185 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7186 return (long)ret_conv;
7189 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7190 LDKDecodeError e_conv;
7191 e_conv.inner = (void*)(e & (~1));
7192 e_conv.is_owned = (e & 1) || (e == 0);
7193 // Warning: we may need a move here but can't clone!
7194 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7195 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7196 return (long)ret_conv;
7199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7200 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)_res;
7202 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7207 o_conv.inner = (void*)(o & (~1));
7208 o_conv.is_owned = (o & 1) || (o == 0);
7209 // Warning: we may need a move here but can't clone!
7210 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7211 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7212 return (long)ret_conv;
7215 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7216 LDKDecodeError e_conv;
7217 e_conv.inner = (void*)(e & (~1));
7218 e_conv.is_owned = (e & 1) || (e == 0);
7219 // Warning: we may need a move here but can't clone!
7220 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7221 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7222 return (long)ret_conv;
7225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7226 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)_res;
7228 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7231 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7232 LDKNetworkGraph o_conv;
7233 o_conv.inner = (void*)(o & (~1));
7234 o_conv.is_owned = (o & 1) || (o == 0);
7235 // Warning: we may need a move here but can't clone!
7236 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7237 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7238 return (long)ret_conv;
7241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7242 LDKDecodeError e_conv;
7243 e_conv.inner = (void*)(e & (~1));
7244 e_conv.is_owned = (e & 1) || (e == 0);
7245 // Warning: we may need a move here but can't clone!
7246 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7247 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7248 return (long)ret_conv;
7251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7252 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)_res;
7254 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7258 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
7259 FREE((void*)this_ptr);
7260 Event_free(this_ptr_conv);
7263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7264 LDKEvent* orig_conv = (LDKEvent*)orig;
7265 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
7266 *ret_copy = Event_clone(orig_conv);
7267 long ret_ref = (long)ret_copy;
7271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
7272 LDKEvent* obj_conv = (LDKEvent*)obj;
7273 LDKCVec_u8Z arg_var = Event_write(obj_conv);
7274 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7275 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7276 CVec_u8Z_free(arg_var);
7280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7281 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
7282 FREE((void*)this_ptr);
7283 MessageSendEvent_free(this_ptr_conv);
7286 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7287 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
7288 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7289 *ret_copy = MessageSendEvent_clone(orig_conv);
7290 long ret_ref = (long)ret_copy;
7294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7295 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
7296 FREE((void*)this_ptr);
7297 MessageSendEventsProvider_free(this_ptr_conv);
7300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7301 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
7302 FREE((void*)this_ptr);
7303 EventsProvider_free(this_ptr_conv);
7306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7307 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
7308 FREE((void*)this_ptr);
7309 APIError_free(this_ptr_conv);
7312 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7313 LDKAPIError* orig_conv = (LDKAPIError*)orig;
7314 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7315 *ret_copy = APIError_clone(orig_conv);
7316 long ret_ref = (long)ret_copy;
7320 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7321 LDKLevel* orig_conv = (LDKLevel*)orig;
7322 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
7326 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
7327 jclass ret_conv = LDKLevel_to_java(env, Level_max());
7331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7332 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
7333 FREE((void*)this_ptr);
7334 Logger_free(this_ptr_conv);
7337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7338 LDKChannelHandshakeConfig this_ptr_conv;
7339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7341 ChannelHandshakeConfig_free(this_ptr_conv);
7344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7345 LDKChannelHandshakeConfig orig_conv;
7346 orig_conv.inner = (void*)(orig & (~1));
7347 orig_conv.is_owned = false;
7348 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
7349 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7350 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7351 long ret_ref = (long)ret_var.inner;
7352 if (ret_var.is_owned) {
7358 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7359 LDKChannelHandshakeConfig this_ptr_conv;
7360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7361 this_ptr_conv.is_owned = false;
7362 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
7366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7367 LDKChannelHandshakeConfig this_ptr_conv;
7368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7369 this_ptr_conv.is_owned = false;
7370 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
7373 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7374 LDKChannelHandshakeConfig this_ptr_conv;
7375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7376 this_ptr_conv.is_owned = false;
7377 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
7381 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) {
7382 LDKChannelHandshakeConfig this_ptr_conv;
7383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7384 this_ptr_conv.is_owned = false;
7385 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
7388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7389 LDKChannelHandshakeConfig this_ptr_conv;
7390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7391 this_ptr_conv.is_owned = false;
7392 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
7396 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) {
7397 LDKChannelHandshakeConfig this_ptr_conv;
7398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7399 this_ptr_conv.is_owned = false;
7400 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
7403 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) {
7404 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
7405 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7406 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7407 long ret_ref = (long)ret_var.inner;
7408 if (ret_var.is_owned) {
7414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
7415 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
7416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7418 long ret_ref = (long)ret_var.inner;
7419 if (ret_var.is_owned) {
7425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7426 LDKChannelHandshakeLimits this_ptr_conv;
7427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7429 ChannelHandshakeLimits_free(this_ptr_conv);
7432 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7433 LDKChannelHandshakeLimits orig_conv;
7434 orig_conv.inner = (void*)(orig & (~1));
7435 orig_conv.is_owned = false;
7436 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
7437 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7438 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7439 long ret_ref = (long)ret_var.inner;
7440 if (ret_var.is_owned) {
7446 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7447 LDKChannelHandshakeLimits this_ptr_conv;
7448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7449 this_ptr_conv.is_owned = false;
7450 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
7454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7455 LDKChannelHandshakeLimits this_ptr_conv;
7456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7457 this_ptr_conv.is_owned = false;
7458 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
7461 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7462 LDKChannelHandshakeLimits this_ptr_conv;
7463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7464 this_ptr_conv.is_owned = false;
7465 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
7469 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) {
7470 LDKChannelHandshakeLimits this_ptr_conv;
7471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7472 this_ptr_conv.is_owned = false;
7473 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
7476 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) {
7477 LDKChannelHandshakeLimits this_ptr_conv;
7478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7479 this_ptr_conv.is_owned = false;
7480 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
7484 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) {
7485 LDKChannelHandshakeLimits this_ptr_conv;
7486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7487 this_ptr_conv.is_owned = false;
7488 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7492 LDKChannelHandshakeLimits this_ptr_conv;
7493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7494 this_ptr_conv.is_owned = false;
7495 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
7499 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) {
7500 LDKChannelHandshakeLimits this_ptr_conv;
7501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7502 this_ptr_conv.is_owned = false;
7503 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
7506 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
7507 LDKChannelHandshakeLimits this_ptr_conv;
7508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7509 this_ptr_conv.is_owned = false;
7510 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
7514 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) {
7515 LDKChannelHandshakeLimits this_ptr_conv;
7516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7517 this_ptr_conv.is_owned = false;
7518 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
7521 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7522 LDKChannelHandshakeLimits this_ptr_conv;
7523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7524 this_ptr_conv.is_owned = false;
7525 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
7529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7530 LDKChannelHandshakeLimits this_ptr_conv;
7531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7532 this_ptr_conv.is_owned = false;
7533 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
7536 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7537 LDKChannelHandshakeLimits this_ptr_conv;
7538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7539 this_ptr_conv.is_owned = false;
7540 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
7544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7545 LDKChannelHandshakeLimits this_ptr_conv;
7546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7547 this_ptr_conv.is_owned = false;
7548 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
7551 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7552 LDKChannelHandshakeLimits this_ptr_conv;
7553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7554 this_ptr_conv.is_owned = false;
7555 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
7559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7560 LDKChannelHandshakeLimits this_ptr_conv;
7561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7562 this_ptr_conv.is_owned = false;
7563 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
7566 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
7567 LDKChannelHandshakeLimits this_ptr_conv;
7568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7569 this_ptr_conv.is_owned = false;
7570 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
7574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7575 LDKChannelHandshakeLimits this_ptr_conv;
7576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7577 this_ptr_conv.is_owned = false;
7578 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
7581 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7582 LDKChannelHandshakeLimits this_ptr_conv;
7583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7584 this_ptr_conv.is_owned = false;
7585 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
7589 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) {
7590 LDKChannelHandshakeLimits this_ptr_conv;
7591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7592 this_ptr_conv.is_owned = false;
7593 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
7596 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv *env, jclass clz, int64_t min_funding_satoshis_arg, int64_t max_htlc_minimum_msat_arg, int64_t min_max_htlc_value_in_flight_msat_arg, int64_t max_channel_reserve_satoshis_arg, int16_t min_max_accepted_htlcs_arg, int64_t min_dust_limit_satoshis_arg, int64_t max_dust_limit_satoshis_arg, int32_t max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, int16_t their_to_self_delay_arg) {
7597 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg);
7598 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7599 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7600 long ret_ref = (long)ret_var.inner;
7601 if (ret_var.is_owned) {
7607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
7608 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
7609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7611 long ret_ref = (long)ret_var.inner;
7612 if (ret_var.is_owned) {
7618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7619 LDKChannelConfig this_ptr_conv;
7620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7622 ChannelConfig_free(this_ptr_conv);
7625 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7626 LDKChannelConfig orig_conv;
7627 orig_conv.inner = (void*)(orig & (~1));
7628 orig_conv.is_owned = false;
7629 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
7630 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7631 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7632 long ret_ref = (long)ret_var.inner;
7633 if (ret_var.is_owned) {
7639 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
7640 LDKChannelConfig this_ptr_conv;
7641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7642 this_ptr_conv.is_owned = false;
7643 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
7647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7648 LDKChannelConfig this_ptr_conv;
7649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7650 this_ptr_conv.is_owned = false;
7651 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
7654 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
7655 LDKChannelConfig this_ptr_conv;
7656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7657 this_ptr_conv.is_owned = false;
7658 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
7662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7663 LDKChannelConfig this_ptr_conv;
7664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7665 this_ptr_conv.is_owned = false;
7666 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
7669 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
7670 LDKChannelConfig this_ptr_conv;
7671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7672 this_ptr_conv.is_owned = false;
7673 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
7677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7678 LDKChannelConfig this_ptr_conv;
7679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7680 this_ptr_conv.is_owned = false;
7681 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
7684 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv *env, jclass clz, int32_t fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
7685 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
7686 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7687 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7688 long ret_ref = (long)ret_var.inner;
7689 if (ret_var.is_owned) {
7695 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
7696 LDKChannelConfig ret_var = ChannelConfig_default();
7697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7699 long ret_ref = (long)ret_var.inner;
7700 if (ret_var.is_owned) {
7706 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
7707 LDKChannelConfig obj_conv;
7708 obj_conv.inner = (void*)(obj & (~1));
7709 obj_conv.is_owned = false;
7710 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
7711 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7712 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7713 CVec_u8Z_free(arg_var);
7717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
7719 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
7720 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
7721 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
7722 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7723 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7724 long ret_ref = (long)ret_var.inner;
7725 if (ret_var.is_owned) {
7728 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
7732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7733 LDKUserConfig this_ptr_conv;
7734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7736 UserConfig_free(this_ptr_conv);
7739 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7740 LDKUserConfig orig_conv;
7741 orig_conv.inner = (void*)(orig & (~1));
7742 orig_conv.is_owned = false;
7743 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
7744 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7745 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7746 long ret_ref = (long)ret_var.inner;
7747 if (ret_var.is_owned) {
7753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
7754 LDKUserConfig this_ptr_conv;
7755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7756 this_ptr_conv.is_owned = false;
7757 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
7758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7760 long ret_ref = (long)ret_var.inner;
7761 if (ret_var.is_owned) {
7767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7768 LDKUserConfig this_ptr_conv;
7769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7770 this_ptr_conv.is_owned = false;
7771 LDKChannelHandshakeConfig val_conv;
7772 val_conv.inner = (void*)(val & (~1));
7773 val_conv.is_owned = (val & 1) || (val == 0);
7774 if (val_conv.inner != NULL)
7775 val_conv = ChannelHandshakeConfig_clone(&val_conv);
7776 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
7779 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
7780 LDKUserConfig this_ptr_conv;
7781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7782 this_ptr_conv.is_owned = false;
7783 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
7784 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7785 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7786 long ret_ref = (long)ret_var.inner;
7787 if (ret_var.is_owned) {
7793 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) {
7794 LDKUserConfig this_ptr_conv;
7795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7796 this_ptr_conv.is_owned = false;
7797 LDKChannelHandshakeLimits val_conv;
7798 val_conv.inner = (void*)(val & (~1));
7799 val_conv.is_owned = (val & 1) || (val == 0);
7800 if (val_conv.inner != NULL)
7801 val_conv = ChannelHandshakeLimits_clone(&val_conv);
7802 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
7805 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
7806 LDKUserConfig this_ptr_conv;
7807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7808 this_ptr_conv.is_owned = false;
7809 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
7810 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7811 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7812 long ret_ref = (long)ret_var.inner;
7813 if (ret_var.is_owned) {
7819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7820 LDKUserConfig this_ptr_conv;
7821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7822 this_ptr_conv.is_owned = false;
7823 LDKChannelConfig val_conv;
7824 val_conv.inner = (void*)(val & (~1));
7825 val_conv.is_owned = (val & 1) || (val == 0);
7826 if (val_conv.inner != NULL)
7827 val_conv = ChannelConfig_clone(&val_conv);
7828 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
7831 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) {
7832 LDKChannelHandshakeConfig own_channel_config_arg_conv;
7833 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
7834 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
7835 if (own_channel_config_arg_conv.inner != NULL)
7836 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
7837 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
7838 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
7839 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
7840 if (peer_channel_config_limits_arg_conv.inner != NULL)
7841 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
7842 LDKChannelConfig channel_options_arg_conv;
7843 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
7844 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
7845 if (channel_options_arg_conv.inner != NULL)
7846 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
7847 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
7848 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7849 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7850 long ret_ref = (long)ret_var.inner;
7851 if (ret_var.is_owned) {
7857 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
7858 LDKUserConfig ret_var = UserConfig_default();
7859 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7860 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7861 long ret_ref = (long)ret_var.inner;
7862 if (ret_var.is_owned) {
7868 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7869 LDKAccessError* orig_conv = (LDKAccessError*)orig;
7870 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
7874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7875 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
7876 FREE((void*)this_ptr);
7877 Access_free(this_ptr_conv);
7880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7881 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
7882 FREE((void*)this_ptr);
7883 Watch_free(this_ptr_conv);
7886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7887 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
7888 FREE((void*)this_ptr);
7889 Filter_free(this_ptr_conv);
7892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7893 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
7894 FREE((void*)this_ptr);
7895 BroadcasterInterface_free(this_ptr_conv);
7898 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7899 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
7900 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
7904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7905 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
7906 FREE((void*)this_ptr);
7907 FeeEstimator_free(this_ptr_conv);
7910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7911 LDKChainMonitor this_ptr_conv;
7912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7914 ChainMonitor_free(this_ptr_conv);
7917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
7918 LDKChainMonitor this_arg_conv;
7919 this_arg_conv.inner = (void*)(this_arg & (~1));
7920 this_arg_conv.is_owned = false;
7921 unsigned char header_arr[80];
7922 CHECK((*env)->GetArrayLength(env, header) == 80);
7923 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7924 unsigned char (*header_ref)[80] = &header_arr;
7925 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7926 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7927 if (txdata_constr.datalen > 0)
7928 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7930 txdata_constr.data = NULL;
7931 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
7932 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7933 int64_t arr_conv_24 = txdata_vals[y];
7934 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
7935 FREE((void*)arr_conv_24);
7936 txdata_constr.data[y] = arr_conv_24_conv;
7938 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
7939 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int32_t disconnected_height) {
7943 LDKChainMonitor this_arg_conv;
7944 this_arg_conv.inner = (void*)(this_arg & (~1));
7945 this_arg_conv.is_owned = false;
7946 unsigned char header_arr[80];
7947 CHECK((*env)->GetArrayLength(env, header) == 80);
7948 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7949 unsigned char (*header_ref)[80] = &header_arr;
7950 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
7953 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) {
7954 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
7955 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
7956 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7957 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7958 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
7960 LDKLogger logger_conv = *(LDKLogger*)logger;
7961 if (logger_conv.free == LDKLogger_JCalls_free) {
7962 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7963 LDKLogger_JCalls_clone(logger_conv.this_arg);
7965 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
7966 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
7967 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7968 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
7970 LDKPersist persister_conv = *(LDKPersist*)persister;
7971 if (persister_conv.free == LDKPersist_JCalls_free) {
7972 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7973 LDKPersist_JCalls_clone(persister_conv.this_arg);
7975 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
7976 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7977 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7978 long ret_ref = (long)ret_var.inner;
7979 if (ret_var.is_owned) {
7985 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
7986 LDKChainMonitor this_arg_conv;
7987 this_arg_conv.inner = (void*)(this_arg & (~1));
7988 this_arg_conv.is_owned = false;
7989 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
7990 *ret = ChainMonitor_as_Watch(&this_arg_conv);
7994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
7995 LDKChainMonitor this_arg_conv;
7996 this_arg_conv.inner = (void*)(this_arg & (~1));
7997 this_arg_conv.is_owned = false;
7998 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7999 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
8003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8004 LDKChannelMonitorUpdate this_ptr_conv;
8005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8007 ChannelMonitorUpdate_free(this_ptr_conv);
8010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8011 LDKChannelMonitorUpdate orig_conv;
8012 orig_conv.inner = (void*)(orig & (~1));
8013 orig_conv.is_owned = false;
8014 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
8015 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8016 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8017 long ret_ref = (long)ret_var.inner;
8018 if (ret_var.is_owned) {
8024 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8025 LDKChannelMonitorUpdate this_ptr_conv;
8026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8027 this_ptr_conv.is_owned = false;
8028 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
8032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8033 LDKChannelMonitorUpdate this_ptr_conv;
8034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8035 this_ptr_conv.is_owned = false;
8036 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
8039 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
8040 LDKChannelMonitorUpdate obj_conv;
8041 obj_conv.inner = (void*)(obj & (~1));
8042 obj_conv.is_owned = false;
8043 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
8044 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8045 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8046 CVec_u8Z_free(arg_var);
8050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8052 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8053 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8054 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8055 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
8056 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8057 return (long)ret_conv;
8060 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8061 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
8062 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
8066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8067 LDKMonitorUpdateError this_ptr_conv;
8068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8069 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8070 MonitorUpdateError_free(this_ptr_conv);
8073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8074 LDKMonitorEvent this_ptr_conv;
8075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8076 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8077 MonitorEvent_free(this_ptr_conv);
8080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8081 LDKMonitorEvent orig_conv;
8082 orig_conv.inner = (void*)(orig & (~1));
8083 orig_conv.is_owned = false;
8084 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
8085 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8086 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8087 long ret_ref = (long)ret_var.inner;
8088 if (ret_var.is_owned) {
8094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8095 LDKHTLCUpdate this_ptr_conv;
8096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8097 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8098 HTLCUpdate_free(this_ptr_conv);
8101 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8102 LDKHTLCUpdate orig_conv;
8103 orig_conv.inner = (void*)(orig & (~1));
8104 orig_conv.is_owned = false;
8105 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
8106 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8107 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8108 long ret_ref = (long)ret_var.inner;
8109 if (ret_var.is_owned) {
8115 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
8116 LDKHTLCUpdate obj_conv;
8117 obj_conv.inner = (void*)(obj & (~1));
8118 obj_conv.is_owned = false;
8119 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
8120 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8121 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8122 CVec_u8Z_free(arg_var);
8126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8128 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8129 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8130 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
8131 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8132 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8133 long ret_ref = (long)ret_var.inner;
8134 if (ret_var.is_owned) {
8137 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8142 LDKChannelMonitor this_ptr_conv;
8143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8145 ChannelMonitor_free(this_ptr_conv);
8148 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8149 LDKChannelMonitor obj_conv;
8150 obj_conv.inner = (void*)(obj & (~1));
8151 obj_conv.is_owned = false;
8152 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
8153 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8154 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8155 CVec_u8Z_free(arg_var);
8159 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) {
8160 LDKChannelMonitor this_arg_conv;
8161 this_arg_conv.inner = (void*)(this_arg & (~1));
8162 this_arg_conv.is_owned = false;
8163 LDKChannelMonitorUpdate updates_conv;
8164 updates_conv.inner = (void*)(updates & (~1));
8165 updates_conv.is_owned = false;
8166 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
8167 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
8168 LDKLogger* logger_conv = (LDKLogger*)logger;
8169 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8170 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
8171 return (long)ret_conv;
8174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8175 LDKChannelMonitor this_arg_conv;
8176 this_arg_conv.inner = (void*)(this_arg & (~1));
8177 this_arg_conv.is_owned = false;
8178 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
8182 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
8183 LDKChannelMonitor this_arg_conv;
8184 this_arg_conv.inner = (void*)(this_arg & (~1));
8185 this_arg_conv.is_owned = false;
8186 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8187 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
8188 ret_ref->a = OutPoint_clone(&ret_ref->a);
8189 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
8190 return (long)ret_ref;
8193 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8194 LDKChannelMonitor this_arg_conv;
8195 this_arg_conv.inner = (void*)(this_arg & (~1));
8196 this_arg_conv.is_owned = false;
8197 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
8198 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8199 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8200 for (size_t o = 0; o < ret_var.datalen; o++) {
8201 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
8202 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8203 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8204 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
8205 if (arr_conv_14_var.is_owned) {
8206 arr_conv_14_ref |= 1;
8208 ret_arr_ptr[o] = arr_conv_14_ref;
8210 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8215 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8216 LDKChannelMonitor this_arg_conv;
8217 this_arg_conv.inner = (void*)(this_arg & (~1));
8218 this_arg_conv.is_owned = false;
8219 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
8220 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8221 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8222 for (size_t h = 0; h < ret_var.datalen; h++) {
8223 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8224 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
8225 long arr_conv_7_ref = (long)arr_conv_7_copy;
8226 ret_arr_ptr[h] = arr_conv_7_ref;
8228 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8233 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) {
8234 LDKChannelMonitor this_arg_conv;
8235 this_arg_conv.inner = (void*)(this_arg & (~1));
8236 this_arg_conv.is_owned = false;
8237 LDKLogger* logger_conv = (LDKLogger*)logger;
8238 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
8239 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8241 for (size_t i = 0; i < ret_var.datalen; i++) {
8242 LDKTransaction arr_conv_8_var = ret_var.data[i];
8243 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, arr_conv_8_var.datalen);
8244 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
8245 Transaction_free(arr_conv_8_var);
8246 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
8252 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) {
8253 LDKChannelMonitor this_arg_conv;
8254 this_arg_conv.inner = (void*)(this_arg & (~1));
8255 this_arg_conv.is_owned = false;
8256 unsigned char header_arr[80];
8257 CHECK((*env)->GetArrayLength(env, header) == 80);
8258 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8259 unsigned char (*header_ref)[80] = &header_arr;
8260 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8261 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
8262 if (txdata_constr.datalen > 0)
8263 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8265 txdata_constr.data = NULL;
8266 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8267 for (size_t y = 0; y < txdata_constr.datalen; y++) {
8268 int64_t arr_conv_24 = txdata_vals[y];
8269 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
8270 FREE((void*)arr_conv_24);
8271 txdata_constr.data[y] = arr_conv_24_conv;
8273 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8274 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
8275 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8276 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8277 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8279 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8280 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8281 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8282 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8284 LDKLogger logger_conv = *(LDKLogger*)logger;
8285 if (logger_conv.free == LDKLogger_JCalls_free) {
8286 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8287 LDKLogger_JCalls_clone(logger_conv.this_arg);
8289 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);
8290 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8291 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8292 for (size_t u = 0; u < ret_var.datalen; u++) {
8293 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8294 *arr_conv_46_ref = ret_var.data[u];
8295 arr_conv_46_ref->a = ThirtyTwoBytes_clone(&arr_conv_46_ref->a);
8296 // XXX: We likely need to clone here, but no _clone fn is available for TwoTuple<Integer, TxOut>[]
8297 ret_arr_ptr[u] = (long)arr_conv_46_ref;
8299 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8304 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) {
8305 LDKChannelMonitor this_arg_conv;
8306 this_arg_conv.inner = (void*)(this_arg & (~1));
8307 this_arg_conv.is_owned = false;
8308 unsigned char header_arr[80];
8309 CHECK((*env)->GetArrayLength(env, header) == 80);
8310 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8311 unsigned char (*header_ref)[80] = &header_arr;
8312 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
8313 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8314 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8315 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8317 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8318 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8319 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8320 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8322 LDKLogger logger_conv = *(LDKLogger*)logger;
8323 if (logger_conv.free == LDKLogger_JCalls_free) {
8324 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8325 LDKLogger_JCalls_clone(logger_conv.this_arg);
8327 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
8330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8331 LDKPersist this_ptr_conv = *(LDKPersist*)this_ptr;
8332 FREE((void*)this_ptr);
8333 Persist_free(this_ptr_conv);
8336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
8338 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8339 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8340 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
8341 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8342 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
8343 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8344 return (long)ret_conv;
8347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8348 LDKOutPoint this_ptr_conv;
8349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8351 OutPoint_free(this_ptr_conv);
8354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8355 LDKOutPoint orig_conv;
8356 orig_conv.inner = (void*)(orig & (~1));
8357 orig_conv.is_owned = false;
8358 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
8359 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8360 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8361 long ret_ref = (long)ret_var.inner;
8362 if (ret_var.is_owned) {
8368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
8369 LDKOutPoint this_ptr_conv;
8370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8371 this_ptr_conv.is_owned = false;
8372 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8373 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
8377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8378 LDKOutPoint this_ptr_conv;
8379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8380 this_ptr_conv.is_owned = false;
8381 LDKThirtyTwoBytes val_ref;
8382 CHECK((*env)->GetArrayLength(env, val) == 32);
8383 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8384 OutPoint_set_txid(&this_ptr_conv, val_ref);
8387 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
8388 LDKOutPoint this_ptr_conv;
8389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8390 this_ptr_conv.is_owned = false;
8391 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
8395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
8396 LDKOutPoint this_ptr_conv;
8397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8398 this_ptr_conv.is_owned = false;
8399 OutPoint_set_index(&this_ptr_conv, val);
8402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
8403 LDKThirtyTwoBytes txid_arg_ref;
8404 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
8405 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
8406 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
8407 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8408 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8409 long ret_ref = (long)ret_var.inner;
8410 if (ret_var.is_owned) {
8416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8417 LDKOutPoint this_arg_conv;
8418 this_arg_conv.inner = (void*)(this_arg & (~1));
8419 this_arg_conv.is_owned = false;
8420 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
8421 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
8425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
8426 LDKOutPoint obj_conv;
8427 obj_conv.inner = (void*)(obj & (~1));
8428 obj_conv.is_owned = false;
8429 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
8430 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8431 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8432 CVec_u8Z_free(arg_var);
8436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8438 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8439 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8440 LDKOutPoint ret_var = OutPoint_read(ser_ref);
8441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8443 long ret_ref = (long)ret_var.inner;
8444 if (ret_var.is_owned) {
8447 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8452 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
8453 FREE((void*)this_ptr);
8454 SpendableOutputDescriptor_free(this_ptr_conv);
8457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8458 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
8459 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
8460 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
8461 long ret_ref = (long)ret_copy;
8465 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8466 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
8467 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
8468 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8469 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8470 CVec_u8Z_free(arg_var);
8474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8476 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8477 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8478 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8479 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
8480 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8481 return (long)ret_conv;
8484 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8485 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
8486 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8487 *ret = ChannelKeys_clone(orig_conv);
8491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8492 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
8493 FREE((void*)this_ptr);
8494 ChannelKeys_free(this_ptr_conv);
8497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8498 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
8499 FREE((void*)this_ptr);
8500 KeysInterface_free(this_ptr_conv);
8503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8504 LDKInMemoryChannelKeys this_ptr_conv;
8505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8507 InMemoryChannelKeys_free(this_ptr_conv);
8510 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8511 LDKInMemoryChannelKeys orig_conv;
8512 orig_conv.inner = (void*)(orig & (~1));
8513 orig_conv.is_owned = false;
8514 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
8515 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8516 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8517 long ret_ref = (long)ret_var.inner;
8518 if (ret_var.is_owned) {
8524 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8525 LDKInMemoryChannelKeys this_ptr_conv;
8526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8527 this_ptr_conv.is_owned = false;
8528 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8529 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
8533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8534 LDKInMemoryChannelKeys this_ptr_conv;
8535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8536 this_ptr_conv.is_owned = false;
8537 LDKSecretKey val_ref;
8538 CHECK((*env)->GetArrayLength(env, val) == 32);
8539 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8540 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
8543 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8544 LDKInMemoryChannelKeys this_ptr_conv;
8545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8546 this_ptr_conv.is_owned = false;
8547 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8548 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
8552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8553 LDKInMemoryChannelKeys this_ptr_conv;
8554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8555 this_ptr_conv.is_owned = false;
8556 LDKSecretKey val_ref;
8557 CHECK((*env)->GetArrayLength(env, val) == 32);
8558 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8559 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
8562 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8563 LDKInMemoryChannelKeys this_ptr_conv;
8564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8565 this_ptr_conv.is_owned = false;
8566 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8567 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
8571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8572 LDKInMemoryChannelKeys this_ptr_conv;
8573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8574 this_ptr_conv.is_owned = false;
8575 LDKSecretKey val_ref;
8576 CHECK((*env)->GetArrayLength(env, val) == 32);
8577 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8578 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
8581 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8582 LDKInMemoryChannelKeys this_ptr_conv;
8583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8584 this_ptr_conv.is_owned = false;
8585 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8586 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
8590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8591 LDKInMemoryChannelKeys this_ptr_conv;
8592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8593 this_ptr_conv.is_owned = false;
8594 LDKSecretKey val_ref;
8595 CHECK((*env)->GetArrayLength(env, val) == 32);
8596 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8597 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
8600 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8601 LDKInMemoryChannelKeys this_ptr_conv;
8602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8603 this_ptr_conv.is_owned = false;
8604 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8605 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
8609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8610 LDKInMemoryChannelKeys this_ptr_conv;
8611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8612 this_ptr_conv.is_owned = false;
8613 LDKSecretKey val_ref;
8614 CHECK((*env)->GetArrayLength(env, val) == 32);
8615 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8616 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
8619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
8620 LDKInMemoryChannelKeys this_ptr_conv;
8621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8622 this_ptr_conv.is_owned = false;
8623 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8624 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
8628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8629 LDKInMemoryChannelKeys this_ptr_conv;
8630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8631 this_ptr_conv.is_owned = false;
8632 LDKThirtyTwoBytes val_ref;
8633 CHECK((*env)->GetArrayLength(env, val) == 32);
8634 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8635 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
8638 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv *env, jclass clz, int8_tArray funding_key, int8_tArray revocation_base_key, int8_tArray payment_key, int8_tArray delayed_payment_base_key, int8_tArray htlc_base_key, int8_tArray commitment_seed, int64_t channel_value_satoshis, int64_t key_derivation_params) {
8639 LDKSecretKey funding_key_ref;
8640 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
8641 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
8642 LDKSecretKey revocation_base_key_ref;
8643 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
8644 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
8645 LDKSecretKey payment_key_ref;
8646 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
8647 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
8648 LDKSecretKey delayed_payment_base_key_ref;
8649 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
8650 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
8651 LDKSecretKey htlc_base_key_ref;
8652 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
8653 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
8654 LDKThirtyTwoBytes commitment_seed_ref;
8655 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
8656 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
8657 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
8658 FREE((void*)key_derivation_params);
8659 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_new(funding_key_ref, revocation_base_key_ref, payment_key_ref, delayed_payment_base_key_ref, htlc_base_key_ref, commitment_seed_ref, channel_value_satoshis, key_derivation_params_conv);
8660 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8661 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8662 long ret_ref = (long)ret_var.inner;
8663 if (ret_var.is_owned) {
8669 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8670 LDKInMemoryChannelKeys this_arg_conv;
8671 this_arg_conv.inner = (void*)(this_arg & (~1));
8672 this_arg_conv.is_owned = false;
8673 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
8674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8676 long ret_ref = (long)ret_var.inner;
8677 if (ret_var.is_owned) {
8683 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8684 LDKInMemoryChannelKeys this_arg_conv;
8685 this_arg_conv.inner = (void*)(this_arg & (~1));
8686 this_arg_conv.is_owned = false;
8687 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
8691 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8692 LDKInMemoryChannelKeys this_arg_conv;
8693 this_arg_conv.inner = (void*)(this_arg & (~1));
8694 this_arg_conv.is_owned = false;
8695 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
8699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
8700 LDKInMemoryChannelKeys this_arg_conv;
8701 this_arg_conv.inner = (void*)(this_arg & (~1));
8702 this_arg_conv.is_owned = false;
8703 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
8707 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
8708 LDKInMemoryChannelKeys this_arg_conv;
8709 this_arg_conv.inner = (void*)(this_arg & (~1));
8710 this_arg_conv.is_owned = false;
8711 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
8712 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8713 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8714 long ret_ref = (long)ret_var.inner;
8715 if (ret_var.is_owned) {
8721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
8722 LDKInMemoryChannelKeys this_arg_conv;
8723 this_arg_conv.inner = (void*)(this_arg & (~1));
8724 this_arg_conv.is_owned = false;
8725 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
8726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8728 long ret_ref = (long)ret_var.inner;
8729 if (ret_var.is_owned) {
8735 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8736 LDKInMemoryChannelKeys this_arg_conv;
8737 this_arg_conv.inner = (void*)(this_arg & (~1));
8738 this_arg_conv.is_owned = false;
8739 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8740 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
8744 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
8745 LDKInMemoryChannelKeys obj_conv;
8746 obj_conv.inner = (void*)(obj & (~1));
8747 obj_conv.is_owned = false;
8748 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
8749 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8750 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8751 CVec_u8Z_free(arg_var);
8755 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8757 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8758 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8759 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
8760 *ret_conv = InMemoryChannelKeys_read(ser_ref);
8761 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8762 return (long)ret_conv;
8765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8766 LDKKeysManager this_ptr_conv;
8767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8769 KeysManager_free(this_ptr_conv);
8772 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv *env, jclass clz, int8_tArray seed, jclass network, int64_t starting_time_secs, int32_t starting_time_nanos) {
8773 unsigned char seed_arr[32];
8774 CHECK((*env)->GetArrayLength(env, seed) == 32);
8775 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
8776 unsigned char (*seed_ref)[32] = &seed_arr;
8777 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
8778 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
8779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8781 long ret_ref = (long)ret_var.inner;
8782 if (ret_var.is_owned) {
8788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_value_satoshis, int64_t params_1, int64_t params_2) {
8789 LDKKeysManager this_arg_conv;
8790 this_arg_conv.inner = (void*)(this_arg & (~1));
8791 this_arg_conv.is_owned = false;
8792 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
8793 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8794 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8795 long ret_ref = (long)ret_var.inner;
8796 if (ret_var.is_owned) {
8802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
8803 LDKKeysManager this_arg_conv;
8804 this_arg_conv.inner = (void*)(this_arg & (~1));
8805 this_arg_conv.is_owned = false;
8806 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
8807 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
8811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8812 LDKChannelManager this_ptr_conv;
8813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8815 ChannelManager_free(this_ptr_conv);
8818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8819 LDKChannelDetails this_ptr_conv;
8820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8822 ChannelDetails_free(this_ptr_conv);
8825 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8826 LDKChannelDetails orig_conv;
8827 orig_conv.inner = (void*)(orig & (~1));
8828 orig_conv.is_owned = false;
8829 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
8830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8832 long ret_ref = (long)ret_var.inner;
8833 if (ret_var.is_owned) {
8839 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8840 LDKChannelDetails this_ptr_conv;
8841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8842 this_ptr_conv.is_owned = false;
8843 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8844 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
8848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8849 LDKChannelDetails this_ptr_conv;
8850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8851 this_ptr_conv.is_owned = false;
8852 LDKThirtyTwoBytes val_ref;
8853 CHECK((*env)->GetArrayLength(env, val) == 32);
8854 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8855 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
8858 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8859 LDKChannelDetails this_ptr_conv;
8860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8861 this_ptr_conv.is_owned = false;
8862 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
8863 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
8867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8868 LDKChannelDetails this_ptr_conv;
8869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8870 this_ptr_conv.is_owned = false;
8871 LDKPublicKey val_ref;
8872 CHECK((*env)->GetArrayLength(env, val) == 33);
8873 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
8874 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
8877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
8878 LDKChannelDetails this_ptr_conv;
8879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8880 this_ptr_conv.is_owned = false;
8881 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
8882 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8883 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8884 long ret_ref = (long)ret_var.inner;
8885 if (ret_var.is_owned) {
8891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8892 LDKChannelDetails this_ptr_conv;
8893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8894 this_ptr_conv.is_owned = false;
8895 LDKInitFeatures val_conv;
8896 val_conv.inner = (void*)(val & (~1));
8897 val_conv.is_owned = (val & 1) || (val == 0);
8898 // Warning: we may need a move here but can't clone!
8899 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
8902 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
8903 LDKChannelDetails this_ptr_conv;
8904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8905 this_ptr_conv.is_owned = false;
8906 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
8910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8911 LDKChannelDetails this_ptr_conv;
8912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8913 this_ptr_conv.is_owned = false;
8914 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
8917 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8918 LDKChannelDetails this_ptr_conv;
8919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8920 this_ptr_conv.is_owned = false;
8921 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
8925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8926 LDKChannelDetails this_ptr_conv;
8927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8928 this_ptr_conv.is_owned = false;
8929 ChannelDetails_set_user_id(&this_ptr_conv, val);
8932 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
8933 LDKChannelDetails this_ptr_conv;
8934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8935 this_ptr_conv.is_owned = false;
8936 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
8940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8941 LDKChannelDetails this_ptr_conv;
8942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8943 this_ptr_conv.is_owned = false;
8944 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
8947 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
8948 LDKChannelDetails this_ptr_conv;
8949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8950 this_ptr_conv.is_owned = false;
8951 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
8955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8956 LDKChannelDetails this_ptr_conv;
8957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8958 this_ptr_conv.is_owned = false;
8959 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
8962 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
8963 LDKChannelDetails this_ptr_conv;
8964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8965 this_ptr_conv.is_owned = false;
8966 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
8970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
8971 LDKChannelDetails this_ptr_conv;
8972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8973 this_ptr_conv.is_owned = false;
8974 ChannelDetails_set_is_live(&this_ptr_conv, val);
8977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8978 LDKPaymentSendFailure this_ptr_conv;
8979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8981 PaymentSendFailure_free(this_ptr_conv);
8984 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv *env, jclass clz, jclass network, int64_t fee_est, int64_t chain_monitor, int64_t tx_broadcaster, int64_t logger, int64_t keys_manager, int64_t config, intptr_t current_blockchain_height) {
8985 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
8986 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
8987 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
8988 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8989 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
8991 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
8992 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
8993 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8994 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
8996 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
8997 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8998 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8999 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9001 LDKLogger logger_conv = *(LDKLogger*)logger;
9002 if (logger_conv.free == LDKLogger_JCalls_free) {
9003 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9004 LDKLogger_JCalls_clone(logger_conv.this_arg);
9006 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
9007 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9008 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9009 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9011 LDKUserConfig config_conv;
9012 config_conv.inner = (void*)(config & (~1));
9013 config_conv.is_owned = (config & 1) || (config == 0);
9014 if (config_conv.inner != NULL)
9015 config_conv = UserConfig_clone(&config_conv);
9016 LDKChannelManager ret_var = ChannelManager_new(network_conv, fee_est_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height);
9017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9019 long ret_ref = (long)ret_var.inner;
9020 if (ret_var.is_owned) {
9026 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) {
9027 LDKChannelManager this_arg_conv;
9028 this_arg_conv.inner = (void*)(this_arg & (~1));
9029 this_arg_conv.is_owned = false;
9030 LDKPublicKey their_network_key_ref;
9031 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
9032 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
9033 LDKUserConfig override_config_conv;
9034 override_config_conv.inner = (void*)(override_config & (~1));
9035 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
9036 if (override_config_conv.inner != NULL)
9037 override_config_conv = UserConfig_clone(&override_config_conv);
9038 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9039 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
9040 return (long)ret_conv;
9043 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9044 LDKChannelManager this_arg_conv;
9045 this_arg_conv.inner = (void*)(this_arg & (~1));
9046 this_arg_conv.is_owned = false;
9047 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
9048 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9049 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9050 for (size_t q = 0; q < ret_var.datalen; q++) {
9051 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9052 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9053 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9054 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9055 if (arr_conv_16_var.is_owned) {
9056 arr_conv_16_ref |= 1;
9058 ret_arr_ptr[q] = arr_conv_16_ref;
9060 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9065 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9066 LDKChannelManager this_arg_conv;
9067 this_arg_conv.inner = (void*)(this_arg & (~1));
9068 this_arg_conv.is_owned = false;
9069 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
9070 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9071 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9072 for (size_t q = 0; q < ret_var.datalen; q++) {
9073 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9074 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9075 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9076 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9077 if (arr_conv_16_var.is_owned) {
9078 arr_conv_16_ref |= 1;
9080 ret_arr_ptr[q] = arr_conv_16_ref;
9082 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9087 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
9088 LDKChannelManager this_arg_conv;
9089 this_arg_conv.inner = (void*)(this_arg & (~1));
9090 this_arg_conv.is_owned = false;
9091 unsigned char channel_id_arr[32];
9092 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9093 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9094 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9095 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9096 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
9097 return (long)ret_conv;
9100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
9101 LDKChannelManager this_arg_conv;
9102 this_arg_conv.inner = (void*)(this_arg & (~1));
9103 this_arg_conv.is_owned = false;
9104 unsigned char channel_id_arr[32];
9105 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9106 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9107 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9108 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
9111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9112 LDKChannelManager this_arg_conv;
9113 this_arg_conv.inner = (void*)(this_arg & (~1));
9114 this_arg_conv.is_owned = false;
9115 ChannelManager_force_close_all_channels(&this_arg_conv);
9118 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) {
9119 LDKChannelManager this_arg_conv;
9120 this_arg_conv.inner = (void*)(this_arg & (~1));
9121 this_arg_conv.is_owned = false;
9122 LDKRoute route_conv;
9123 route_conv.inner = (void*)(route & (~1));
9124 route_conv.is_owned = false;
9125 LDKThirtyTwoBytes payment_hash_ref;
9126 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9127 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
9128 LDKThirtyTwoBytes payment_secret_ref;
9129 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9130 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9131 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9132 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
9133 return (long)ret_conv;
9136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray temporary_channel_id, int64_t funding_txo) {
9137 LDKChannelManager this_arg_conv;
9138 this_arg_conv.inner = (void*)(this_arg & (~1));
9139 this_arg_conv.is_owned = false;
9140 unsigned char temporary_channel_id_arr[32];
9141 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
9142 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
9143 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
9144 LDKOutPoint funding_txo_conv;
9145 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9146 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
9147 if (funding_txo_conv.inner != NULL)
9148 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9149 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
9152 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) {
9153 LDKChannelManager this_arg_conv;
9154 this_arg_conv.inner = (void*)(this_arg & (~1));
9155 this_arg_conv.is_owned = false;
9156 LDKThreeBytes rgb_ref;
9157 CHECK((*env)->GetArrayLength(env, rgb) == 3);
9158 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
9159 LDKThirtyTwoBytes alias_ref;
9160 CHECK((*env)->GetArrayLength(env, alias) == 32);
9161 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
9162 LDKCVec_NetAddressZ addresses_constr;
9163 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
9164 if (addresses_constr.datalen > 0)
9165 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9167 addresses_constr.data = NULL;
9168 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
9169 for (size_t m = 0; m < addresses_constr.datalen; m++) {
9170 int64_t arr_conv_12 = addresses_vals[m];
9171 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9172 FREE((void*)arr_conv_12);
9173 addresses_constr.data[m] = arr_conv_12_conv;
9175 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
9176 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
9179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
9180 LDKChannelManager this_arg_conv;
9181 this_arg_conv.inner = (void*)(this_arg & (~1));
9182 this_arg_conv.is_owned = false;
9183 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
9186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
9187 LDKChannelManager this_arg_conv;
9188 this_arg_conv.inner = (void*)(this_arg & (~1));
9189 this_arg_conv.is_owned = false;
9190 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
9193 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) {
9194 LDKChannelManager this_arg_conv;
9195 this_arg_conv.inner = (void*)(this_arg & (~1));
9196 this_arg_conv.is_owned = false;
9197 unsigned char payment_hash_arr[32];
9198 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9199 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
9200 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
9201 LDKThirtyTwoBytes payment_secret_ref;
9202 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9203 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9204 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
9208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t expected_amount) {
9209 LDKChannelManager this_arg_conv;
9210 this_arg_conv.inner = (void*)(this_arg & (~1));
9211 this_arg_conv.is_owned = false;
9212 LDKThirtyTwoBytes payment_preimage_ref;
9213 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
9214 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
9215 LDKThirtyTwoBytes payment_secret_ref;
9216 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9217 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9218 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
9222 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9223 LDKChannelManager this_arg_conv;
9224 this_arg_conv.inner = (void*)(this_arg & (~1));
9225 this_arg_conv.is_owned = false;
9226 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9227 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
9231 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) {
9232 LDKChannelManager this_arg_conv;
9233 this_arg_conv.inner = (void*)(this_arg & (~1));
9234 this_arg_conv.is_owned = false;
9235 LDKOutPoint funding_txo_conv;
9236 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9237 funding_txo_conv.is_owned = false;
9238 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
9241 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9242 LDKChannelManager this_arg_conv;
9243 this_arg_conv.inner = (void*)(this_arg & (~1));
9244 this_arg_conv.is_owned = false;
9245 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9246 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
9250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9251 LDKChannelManager this_arg_conv;
9252 this_arg_conv.inner = (void*)(this_arg & (~1));
9253 this_arg_conv.is_owned = false;
9254 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9255 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
9259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header, int64_tArray txdata, int32_t height) {
9260 LDKChannelManager this_arg_conv;
9261 this_arg_conv.inner = (void*)(this_arg & (~1));
9262 this_arg_conv.is_owned = false;
9263 unsigned char header_arr[80];
9264 CHECK((*env)->GetArrayLength(env, header) == 80);
9265 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9266 unsigned char (*header_ref)[80] = &header_arr;
9267 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9268 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
9269 if (txdata_constr.datalen > 0)
9270 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9272 txdata_constr.data = NULL;
9273 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
9274 for (size_t y = 0; y < txdata_constr.datalen; y++) {
9275 int64_t arr_conv_24 = txdata_vals[y];
9276 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
9277 FREE((void*)arr_conv_24);
9278 txdata_constr.data[y] = arr_conv_24_conv;
9280 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
9281 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
9285 LDKChannelManager this_arg_conv;
9286 this_arg_conv.inner = (void*)(this_arg & (~1));
9287 this_arg_conv.is_owned = false;
9288 unsigned char header_arr[80];
9289 CHECK((*env)->GetArrayLength(env, header) == 80);
9290 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9291 unsigned char (*header_ref)[80] = &header_arr;
9292 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
9295 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
9296 LDKChannelManager this_arg_conv;
9297 this_arg_conv.inner = (void*)(this_arg & (~1));
9298 this_arg_conv.is_owned = false;
9299 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9300 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
9304 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
9305 LDKChannelManager obj_conv;
9306 obj_conv.inner = (void*)(obj & (~1));
9307 obj_conv.is_owned = false;
9308 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
9309 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
9310 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
9311 CVec_u8Z_free(arg_var);
9315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9316 LDKChannelManagerReadArgs this_ptr_conv;
9317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9319 ChannelManagerReadArgs_free(this_ptr_conv);
9322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
9323 LDKChannelManagerReadArgs this_ptr_conv;
9324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9325 this_ptr_conv.is_owned = false;
9326 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
9330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9331 LDKChannelManagerReadArgs this_ptr_conv;
9332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9333 this_ptr_conv.is_owned = false;
9334 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
9335 if (val_conv.free == LDKKeysInterface_JCalls_free) {
9336 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9337 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
9339 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
9342 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
9343 LDKChannelManagerReadArgs this_ptr_conv;
9344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9345 this_ptr_conv.is_owned = false;
9346 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
9350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9351 LDKChannelManagerReadArgs this_ptr_conv;
9352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9353 this_ptr_conv.is_owned = false;
9354 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
9355 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
9356 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9357 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
9359 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
9362 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
9363 LDKChannelManagerReadArgs this_ptr_conv;
9364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9365 this_ptr_conv.is_owned = false;
9366 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
9370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9371 LDKChannelManagerReadArgs this_ptr_conv;
9372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9373 this_ptr_conv.is_owned = false;
9374 LDKWatch val_conv = *(LDKWatch*)val;
9375 if (val_conv.free == LDKWatch_JCalls_free) {
9376 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9377 LDKWatch_JCalls_clone(val_conv.this_arg);
9379 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
9382 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
9383 LDKChannelManagerReadArgs this_ptr_conv;
9384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9385 this_ptr_conv.is_owned = false;
9386 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
9390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9391 LDKChannelManagerReadArgs this_ptr_conv;
9392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9393 this_ptr_conv.is_owned = false;
9394 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
9395 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
9396 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9397 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
9399 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
9402 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
9403 LDKChannelManagerReadArgs this_ptr_conv;
9404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9405 this_ptr_conv.is_owned = false;
9406 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
9410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9411 LDKChannelManagerReadArgs this_ptr_conv;
9412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9413 this_ptr_conv.is_owned = false;
9414 LDKLogger val_conv = *(LDKLogger*)val;
9415 if (val_conv.free == LDKLogger_JCalls_free) {
9416 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9417 LDKLogger_JCalls_clone(val_conv.this_arg);
9419 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
9422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
9423 LDKChannelManagerReadArgs this_ptr_conv;
9424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9425 this_ptr_conv.is_owned = false;
9426 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
9427 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9428 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9429 long ret_ref = (long)ret_var.inner;
9430 if (ret_var.is_owned) {
9436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9437 LDKChannelManagerReadArgs this_ptr_conv;
9438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9439 this_ptr_conv.is_owned = false;
9440 LDKUserConfig val_conv;
9441 val_conv.inner = (void*)(val & (~1));
9442 val_conv.is_owned = (val & 1) || (val == 0);
9443 if (val_conv.inner != NULL)
9444 val_conv = UserConfig_clone(&val_conv);
9445 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
9448 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) {
9449 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
9450 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9451 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9452 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9454 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
9455 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
9456 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9457 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
9459 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
9460 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9461 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9462 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9464 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
9465 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9466 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9467 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9469 LDKLogger logger_conv = *(LDKLogger*)logger;
9470 if (logger_conv.free == LDKLogger_JCalls_free) {
9471 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9472 LDKLogger_JCalls_clone(logger_conv.this_arg);
9474 LDKUserConfig default_config_conv;
9475 default_config_conv.inner = (void*)(default_config & (~1));
9476 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
9477 if (default_config_conv.inner != NULL)
9478 default_config_conv = UserConfig_clone(&default_config_conv);
9479 LDKCVec_ChannelMonitorZ channel_monitors_constr;
9480 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
9481 if (channel_monitors_constr.datalen > 0)
9482 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9484 channel_monitors_constr.data = NULL;
9485 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
9486 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
9487 int64_t arr_conv_16 = channel_monitors_vals[q];
9488 LDKChannelMonitor arr_conv_16_conv;
9489 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
9490 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
9491 // Warning: we may need a move here but can't clone!
9492 channel_monitors_constr.data[q] = arr_conv_16_conv;
9494 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
9495 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);
9496 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9497 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9498 long ret_ref = (long)ret_var.inner;
9499 if (ret_var.is_owned) {
9505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
9507 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
9508 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
9509 LDKChannelManagerReadArgs arg_conv;
9510 arg_conv.inner = (void*)(arg & (~1));
9511 arg_conv.is_owned = (arg & 1) || (arg == 0);
9512 // Warning: we may need a move here but can't clone!
9513 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9514 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
9515 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
9516 return (long)ret_conv;
9519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9520 LDKDecodeError this_ptr_conv;
9521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9523 DecodeError_free(this_ptr_conv);
9526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9527 LDKInit this_ptr_conv;
9528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9530 Init_free(this_ptr_conv);
9533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9535 orig_conv.inner = (void*)(orig & (~1));
9536 orig_conv.is_owned = false;
9537 LDKInit ret_var = Init_clone(&orig_conv);
9538 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9539 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9540 long ret_ref = (long)ret_var.inner;
9541 if (ret_var.is_owned) {
9547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9548 LDKErrorMessage this_ptr_conv;
9549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9551 ErrorMessage_free(this_ptr_conv);
9554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9555 LDKErrorMessage orig_conv;
9556 orig_conv.inner = (void*)(orig & (~1));
9557 orig_conv.is_owned = false;
9558 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
9559 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9560 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9561 long ret_ref = (long)ret_var.inner;
9562 if (ret_var.is_owned) {
9568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9569 LDKErrorMessage this_ptr_conv;
9570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9571 this_ptr_conv.is_owned = false;
9572 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9573 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
9577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9578 LDKErrorMessage this_ptr_conv;
9579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9580 this_ptr_conv.is_owned = false;
9581 LDKThirtyTwoBytes val_ref;
9582 CHECK((*env)->GetArrayLength(env, val) == 32);
9583 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9584 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
9587 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
9588 LDKErrorMessage this_ptr_conv;
9589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9590 this_ptr_conv.is_owned = false;
9591 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
9592 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
9596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9597 LDKErrorMessage this_ptr_conv;
9598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9599 this_ptr_conv.is_owned = false;
9600 LDKCVec_u8Z val_ref;
9601 val_ref.datalen = (*env)->GetArrayLength(env, val);
9602 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9603 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
9604 ErrorMessage_set_data(&this_ptr_conv, val_ref);
9607 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
9608 LDKThirtyTwoBytes channel_id_arg_ref;
9609 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
9610 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9611 LDKCVec_u8Z data_arg_ref;
9612 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
9613 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9614 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
9615 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
9616 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9617 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9618 long ret_ref = (long)ret_var.inner;
9619 if (ret_var.is_owned) {
9625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9626 LDKPing this_ptr_conv;
9627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9629 Ping_free(this_ptr_conv);
9632 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9634 orig_conv.inner = (void*)(orig & (~1));
9635 orig_conv.is_owned = false;
9636 LDKPing ret_var = Ping_clone(&orig_conv);
9637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9639 long ret_ref = (long)ret_var.inner;
9640 if (ret_var.is_owned) {
9646 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9647 LDKPing this_ptr_conv;
9648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9649 this_ptr_conv.is_owned = false;
9650 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
9654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9655 LDKPing this_ptr_conv;
9656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9657 this_ptr_conv.is_owned = false;
9658 Ping_set_ponglen(&this_ptr_conv, val);
9661 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9662 LDKPing this_ptr_conv;
9663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9664 this_ptr_conv.is_owned = false;
9665 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
9669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9670 LDKPing this_ptr_conv;
9671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9672 this_ptr_conv.is_owned = false;
9673 Ping_set_byteslen(&this_ptr_conv, val);
9676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
9677 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
9678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9680 long ret_ref = (long)ret_var.inner;
9681 if (ret_var.is_owned) {
9687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9688 LDKPong this_ptr_conv;
9689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9691 Pong_free(this_ptr_conv);
9694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9696 orig_conv.inner = (void*)(orig & (~1));
9697 orig_conv.is_owned = false;
9698 LDKPong ret_var = Pong_clone(&orig_conv);
9699 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9700 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9701 long ret_ref = (long)ret_var.inner;
9702 if (ret_var.is_owned) {
9708 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9709 LDKPong this_ptr_conv;
9710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9711 this_ptr_conv.is_owned = false;
9712 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
9716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9717 LDKPong this_ptr_conv;
9718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9719 this_ptr_conv.is_owned = false;
9720 Pong_set_byteslen(&this_ptr_conv, val);
9723 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
9724 LDKPong ret_var = Pong_new(byteslen_arg);
9725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9727 long ret_ref = (long)ret_var.inner;
9728 if (ret_var.is_owned) {
9734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9735 LDKOpenChannel this_ptr_conv;
9736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9738 OpenChannel_free(this_ptr_conv);
9741 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9742 LDKOpenChannel orig_conv;
9743 orig_conv.inner = (void*)(orig & (~1));
9744 orig_conv.is_owned = false;
9745 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
9746 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9747 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9748 long ret_ref = (long)ret_var.inner;
9749 if (ret_var.is_owned) {
9755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
9756 LDKOpenChannel this_ptr_conv;
9757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9758 this_ptr_conv.is_owned = false;
9759 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9760 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
9764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9765 LDKOpenChannel this_ptr_conv;
9766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9767 this_ptr_conv.is_owned = false;
9768 LDKThirtyTwoBytes val_ref;
9769 CHECK((*env)->GetArrayLength(env, val) == 32);
9770 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9771 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
9774 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9775 LDKOpenChannel this_ptr_conv;
9776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9777 this_ptr_conv.is_owned = false;
9778 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9779 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
9783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9784 LDKOpenChannel this_ptr_conv;
9785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9786 this_ptr_conv.is_owned = false;
9787 LDKThirtyTwoBytes val_ref;
9788 CHECK((*env)->GetArrayLength(env, val) == 32);
9789 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9790 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
9793 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9794 LDKOpenChannel this_ptr_conv;
9795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9796 this_ptr_conv.is_owned = false;
9797 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
9801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9802 LDKOpenChannel this_ptr_conv;
9803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9804 this_ptr_conv.is_owned = false;
9805 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
9808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9809 LDKOpenChannel this_ptr_conv;
9810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9811 this_ptr_conv.is_owned = false;
9812 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
9816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9817 LDKOpenChannel this_ptr_conv;
9818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9819 this_ptr_conv.is_owned = false;
9820 OpenChannel_set_push_msat(&this_ptr_conv, val);
9823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9824 LDKOpenChannel this_ptr_conv;
9825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9826 this_ptr_conv.is_owned = false;
9827 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
9831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9832 LDKOpenChannel this_ptr_conv;
9833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9834 this_ptr_conv.is_owned = false;
9835 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
9838 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) {
9839 LDKOpenChannel this_ptr_conv;
9840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9841 this_ptr_conv.is_owned = false;
9842 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
9846 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) {
9847 LDKOpenChannel this_ptr_conv;
9848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9849 this_ptr_conv.is_owned = false;
9850 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9853 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9854 LDKOpenChannel this_ptr_conv;
9855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9856 this_ptr_conv.is_owned = false;
9857 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
9861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9862 LDKOpenChannel this_ptr_conv;
9863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9864 this_ptr_conv.is_owned = false;
9865 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
9868 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9869 LDKOpenChannel this_ptr_conv;
9870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9871 this_ptr_conv.is_owned = false;
9872 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
9876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9877 LDKOpenChannel this_ptr_conv;
9878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9879 this_ptr_conv.is_owned = false;
9880 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
9883 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
9884 LDKOpenChannel this_ptr_conv;
9885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9886 this_ptr_conv.is_owned = false;
9887 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
9891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9892 LDKOpenChannel this_ptr_conv;
9893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9894 this_ptr_conv.is_owned = false;
9895 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
9898 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9899 LDKOpenChannel this_ptr_conv;
9900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9901 this_ptr_conv.is_owned = false;
9902 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
9906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9907 LDKOpenChannel this_ptr_conv;
9908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9909 this_ptr_conv.is_owned = false;
9910 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
9913 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
9914 LDKOpenChannel this_ptr_conv;
9915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9916 this_ptr_conv.is_owned = false;
9917 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
9921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9922 LDKOpenChannel this_ptr_conv;
9923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9924 this_ptr_conv.is_owned = false;
9925 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
9928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
9929 LDKOpenChannel this_ptr_conv;
9930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9931 this_ptr_conv.is_owned = false;
9932 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9933 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
9937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9938 LDKOpenChannel this_ptr_conv;
9939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9940 this_ptr_conv.is_owned = false;
9941 LDKPublicKey val_ref;
9942 CHECK((*env)->GetArrayLength(env, val) == 33);
9943 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9944 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
9947 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
9948 LDKOpenChannel this_ptr_conv;
9949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9950 this_ptr_conv.is_owned = false;
9951 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9952 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
9956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9957 LDKOpenChannel this_ptr_conv;
9958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9959 this_ptr_conv.is_owned = false;
9960 LDKPublicKey val_ref;
9961 CHECK((*env)->GetArrayLength(env, val) == 33);
9962 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9963 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
9966 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
9967 LDKOpenChannel this_ptr_conv;
9968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9969 this_ptr_conv.is_owned = false;
9970 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9971 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
9975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9976 LDKOpenChannel this_ptr_conv;
9977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9978 this_ptr_conv.is_owned = false;
9979 LDKPublicKey val_ref;
9980 CHECK((*env)->GetArrayLength(env, val) == 33);
9981 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
9982 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
9985 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
9986 LDKOpenChannel this_ptr_conv;
9987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9988 this_ptr_conv.is_owned = false;
9989 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9990 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
9994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9995 LDKOpenChannel this_ptr_conv;
9996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9997 this_ptr_conv.is_owned = false;
9998 LDKPublicKey val_ref;
9999 CHECK((*env)->GetArrayLength(env, val) == 33);
10000 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10001 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10004 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10005 LDKOpenChannel this_ptr_conv;
10006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10007 this_ptr_conv.is_owned = false;
10008 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10009 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10014 LDKOpenChannel this_ptr_conv;
10015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10016 this_ptr_conv.is_owned = false;
10017 LDKPublicKey val_ref;
10018 CHECK((*env)->GetArrayLength(env, val) == 33);
10019 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10020 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10023 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10024 LDKOpenChannel this_ptr_conv;
10025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10026 this_ptr_conv.is_owned = false;
10027 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10028 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10032 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) {
10033 LDKOpenChannel this_ptr_conv;
10034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10035 this_ptr_conv.is_owned = false;
10036 LDKPublicKey val_ref;
10037 CHECK((*env)->GetArrayLength(env, val) == 33);
10038 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10039 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10042 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
10043 LDKOpenChannel this_ptr_conv;
10044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10045 this_ptr_conv.is_owned = false;
10046 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
10050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
10051 LDKOpenChannel this_ptr_conv;
10052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10053 this_ptr_conv.is_owned = false;
10054 OpenChannel_set_channel_flags(&this_ptr_conv, val);
10057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10058 LDKAcceptChannel this_ptr_conv;
10059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10061 AcceptChannel_free(this_ptr_conv);
10064 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10065 LDKAcceptChannel orig_conv;
10066 orig_conv.inner = (void*)(orig & (~1));
10067 orig_conv.is_owned = false;
10068 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
10069 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10070 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10071 long ret_ref = (long)ret_var.inner;
10072 if (ret_var.is_owned) {
10078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10079 LDKAcceptChannel this_ptr_conv;
10080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10081 this_ptr_conv.is_owned = false;
10082 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10083 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
10087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10088 LDKAcceptChannel this_ptr_conv;
10089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10090 this_ptr_conv.is_owned = false;
10091 LDKThirtyTwoBytes val_ref;
10092 CHECK((*env)->GetArrayLength(env, val) == 32);
10093 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10094 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
10097 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10098 LDKAcceptChannel this_ptr_conv;
10099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10100 this_ptr_conv.is_owned = false;
10101 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
10105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10106 LDKAcceptChannel this_ptr_conv;
10107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10108 this_ptr_conv.is_owned = false;
10109 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
10112 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) {
10113 LDKAcceptChannel this_ptr_conv;
10114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10115 this_ptr_conv.is_owned = false;
10116 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
10120 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) {
10121 LDKAcceptChannel this_ptr_conv;
10122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10123 this_ptr_conv.is_owned = false;
10124 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10127 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10128 LDKAcceptChannel this_ptr_conv;
10129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10130 this_ptr_conv.is_owned = false;
10131 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
10135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10136 LDKAcceptChannel this_ptr_conv;
10137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10138 this_ptr_conv.is_owned = false;
10139 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
10142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10143 LDKAcceptChannel this_ptr_conv;
10144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10145 this_ptr_conv.is_owned = false;
10146 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
10150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10151 LDKAcceptChannel this_ptr_conv;
10152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10153 this_ptr_conv.is_owned = false;
10154 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
10157 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10158 LDKAcceptChannel this_ptr_conv;
10159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10160 this_ptr_conv.is_owned = false;
10161 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
10165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10166 LDKAcceptChannel this_ptr_conv;
10167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10168 this_ptr_conv.is_owned = false;
10169 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
10172 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10173 LDKAcceptChannel this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = false;
10176 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
10180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10181 LDKAcceptChannel this_ptr_conv;
10182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10183 this_ptr_conv.is_owned = false;
10184 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
10187 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
10188 LDKAcceptChannel this_ptr_conv;
10189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10190 this_ptr_conv.is_owned = false;
10191 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
10195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10196 LDKAcceptChannel this_ptr_conv;
10197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10198 this_ptr_conv.is_owned = false;
10199 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
10202 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10203 LDKAcceptChannel this_ptr_conv;
10204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10205 this_ptr_conv.is_owned = false;
10206 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10207 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
10211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10212 LDKAcceptChannel this_ptr_conv;
10213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10214 this_ptr_conv.is_owned = false;
10215 LDKPublicKey val_ref;
10216 CHECK((*env)->GetArrayLength(env, val) == 33);
10217 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10218 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10221 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10222 LDKAcceptChannel this_ptr_conv;
10223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10224 this_ptr_conv.is_owned = false;
10225 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10226 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10231 LDKAcceptChannel this_ptr_conv;
10232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10233 this_ptr_conv.is_owned = false;
10234 LDKPublicKey val_ref;
10235 CHECK((*env)->GetArrayLength(env, val) == 33);
10236 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10237 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10240 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10241 LDKAcceptChannel this_ptr_conv;
10242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10243 this_ptr_conv.is_owned = false;
10244 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10245 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
10249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10250 LDKAcceptChannel this_ptr_conv;
10251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10252 this_ptr_conv.is_owned = false;
10253 LDKPublicKey val_ref;
10254 CHECK((*env)->GetArrayLength(env, val) == 33);
10255 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10256 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
10259 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10260 LDKAcceptChannel this_ptr_conv;
10261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10262 this_ptr_conv.is_owned = false;
10263 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10264 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10269 LDKAcceptChannel this_ptr_conv;
10270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10271 this_ptr_conv.is_owned = false;
10272 LDKPublicKey val_ref;
10273 CHECK((*env)->GetArrayLength(env, val) == 33);
10274 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10275 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10279 LDKAcceptChannel this_ptr_conv;
10280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10281 this_ptr_conv.is_owned = false;
10282 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10283 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10288 LDKAcceptChannel this_ptr_conv;
10289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10290 this_ptr_conv.is_owned = false;
10291 LDKPublicKey val_ref;
10292 CHECK((*env)->GetArrayLength(env, val) == 33);
10293 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10294 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10297 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10298 LDKAcceptChannel this_ptr_conv;
10299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10300 this_ptr_conv.is_owned = false;
10301 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10302 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10306 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) {
10307 LDKAcceptChannel this_ptr_conv;
10308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10309 this_ptr_conv.is_owned = false;
10310 LDKPublicKey val_ref;
10311 CHECK((*env)->GetArrayLength(env, val) == 33);
10312 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10313 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10317 LDKFundingCreated this_ptr_conv;
10318 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10319 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10320 FundingCreated_free(this_ptr_conv);
10323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10324 LDKFundingCreated orig_conv;
10325 orig_conv.inner = (void*)(orig & (~1));
10326 orig_conv.is_owned = false;
10327 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
10328 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10329 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10330 long ret_ref = (long)ret_var.inner;
10331 if (ret_var.is_owned) {
10337 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10338 LDKFundingCreated this_ptr_conv;
10339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10340 this_ptr_conv.is_owned = false;
10341 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10342 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
10346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10347 LDKFundingCreated this_ptr_conv;
10348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10349 this_ptr_conv.is_owned = false;
10350 LDKThirtyTwoBytes val_ref;
10351 CHECK((*env)->GetArrayLength(env, val) == 32);
10352 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10353 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
10356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
10357 LDKFundingCreated this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = false;
10360 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10361 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
10365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10366 LDKFundingCreated this_ptr_conv;
10367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10368 this_ptr_conv.is_owned = false;
10369 LDKThirtyTwoBytes val_ref;
10370 CHECK((*env)->GetArrayLength(env, val) == 32);
10371 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10372 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
10375 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
10376 LDKFundingCreated this_ptr_conv;
10377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10378 this_ptr_conv.is_owned = false;
10379 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
10383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10384 LDKFundingCreated this_ptr_conv;
10385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10386 this_ptr_conv.is_owned = false;
10387 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
10390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10391 LDKFundingCreated this_ptr_conv;
10392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10393 this_ptr_conv.is_owned = false;
10394 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10395 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
10399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10400 LDKFundingCreated this_ptr_conv;
10401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10402 this_ptr_conv.is_owned = false;
10403 LDKSignature val_ref;
10404 CHECK((*env)->GetArrayLength(env, val) == 64);
10405 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10406 FundingCreated_set_signature(&this_ptr_conv, val_ref);
10409 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) {
10410 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
10411 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
10412 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
10413 LDKThirtyTwoBytes funding_txid_arg_ref;
10414 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
10415 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
10416 LDKSignature signature_arg_ref;
10417 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10418 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10419 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
10420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10422 long ret_ref = (long)ret_var.inner;
10423 if (ret_var.is_owned) {
10429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10430 LDKFundingSigned this_ptr_conv;
10431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10433 FundingSigned_free(this_ptr_conv);
10436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10437 LDKFundingSigned orig_conv;
10438 orig_conv.inner = (void*)(orig & (~1));
10439 orig_conv.is_owned = false;
10440 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
10441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10443 long ret_ref = (long)ret_var.inner;
10444 if (ret_var.is_owned) {
10450 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10451 LDKFundingSigned this_ptr_conv;
10452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10453 this_ptr_conv.is_owned = false;
10454 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10455 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
10459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10460 LDKFundingSigned this_ptr_conv;
10461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10462 this_ptr_conv.is_owned = false;
10463 LDKThirtyTwoBytes val_ref;
10464 CHECK((*env)->GetArrayLength(env, val) == 32);
10465 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10466 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
10469 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10470 LDKFundingSigned this_ptr_conv;
10471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10472 this_ptr_conv.is_owned = false;
10473 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10474 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
10478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10479 LDKFundingSigned this_ptr_conv;
10480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10481 this_ptr_conv.is_owned = false;
10482 LDKSignature val_ref;
10483 CHECK((*env)->GetArrayLength(env, val) == 64);
10484 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10485 FundingSigned_set_signature(&this_ptr_conv, val_ref);
10488 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
10489 LDKThirtyTwoBytes channel_id_arg_ref;
10490 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10491 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10492 LDKSignature signature_arg_ref;
10493 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10494 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10495 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
10496 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10497 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10498 long ret_ref = (long)ret_var.inner;
10499 if (ret_var.is_owned) {
10505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10506 LDKFundingLocked this_ptr_conv;
10507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10509 FundingLocked_free(this_ptr_conv);
10512 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10513 LDKFundingLocked orig_conv;
10514 orig_conv.inner = (void*)(orig & (~1));
10515 orig_conv.is_owned = false;
10516 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
10517 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10518 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10519 long ret_ref = (long)ret_var.inner;
10520 if (ret_var.is_owned) {
10526 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10527 LDKFundingLocked this_ptr_conv;
10528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10529 this_ptr_conv.is_owned = false;
10530 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10531 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
10535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10536 LDKFundingLocked this_ptr_conv;
10537 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10538 this_ptr_conv.is_owned = false;
10539 LDKThirtyTwoBytes val_ref;
10540 CHECK((*env)->GetArrayLength(env, val) == 32);
10541 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10542 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
10545 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10546 LDKFundingLocked this_ptr_conv;
10547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10548 this_ptr_conv.is_owned = false;
10549 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10550 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
10554 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) {
10555 LDKFundingLocked this_ptr_conv;
10556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10557 this_ptr_conv.is_owned = false;
10558 LDKPublicKey val_ref;
10559 CHECK((*env)->GetArrayLength(env, val) == 33);
10560 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10561 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
10564 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) {
10565 LDKThirtyTwoBytes channel_id_arg_ref;
10566 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10567 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10568 LDKPublicKey next_per_commitment_point_arg_ref;
10569 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
10570 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
10571 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
10572 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10573 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10574 long ret_ref = (long)ret_var.inner;
10575 if (ret_var.is_owned) {
10581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10582 LDKShutdown this_ptr_conv;
10583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10585 Shutdown_free(this_ptr_conv);
10588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10589 LDKShutdown orig_conv;
10590 orig_conv.inner = (void*)(orig & (~1));
10591 orig_conv.is_owned = false;
10592 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
10593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10595 long ret_ref = (long)ret_var.inner;
10596 if (ret_var.is_owned) {
10602 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10603 LDKShutdown this_ptr_conv;
10604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10605 this_ptr_conv.is_owned = false;
10606 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10607 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
10611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10612 LDKShutdown this_ptr_conv;
10613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10614 this_ptr_conv.is_owned = false;
10615 LDKThirtyTwoBytes val_ref;
10616 CHECK((*env)->GetArrayLength(env, val) == 32);
10617 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10618 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
10621 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10622 LDKShutdown this_ptr_conv;
10623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10624 this_ptr_conv.is_owned = false;
10625 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
10626 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10627 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10632 LDKShutdown this_ptr_conv;
10633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10634 this_ptr_conv.is_owned = false;
10635 LDKCVec_u8Z val_ref;
10636 val_ref.datalen = (*env)->GetArrayLength(env, val);
10637 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10638 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
10639 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
10642 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
10643 LDKThirtyTwoBytes channel_id_arg_ref;
10644 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10645 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10646 LDKCVec_u8Z scriptpubkey_arg_ref;
10647 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
10648 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10649 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
10650 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
10651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10653 long ret_ref = (long)ret_var.inner;
10654 if (ret_var.is_owned) {
10660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10661 LDKClosingSigned this_ptr_conv;
10662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10664 ClosingSigned_free(this_ptr_conv);
10667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10668 LDKClosingSigned orig_conv;
10669 orig_conv.inner = (void*)(orig & (~1));
10670 orig_conv.is_owned = false;
10671 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
10672 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10673 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10674 long ret_ref = (long)ret_var.inner;
10675 if (ret_var.is_owned) {
10681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10682 LDKClosingSigned this_ptr_conv;
10683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10684 this_ptr_conv.is_owned = false;
10685 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10686 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
10690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10691 LDKClosingSigned this_ptr_conv;
10692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10693 this_ptr_conv.is_owned = false;
10694 LDKThirtyTwoBytes val_ref;
10695 CHECK((*env)->GetArrayLength(env, val) == 32);
10696 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10697 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
10700 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10701 LDKClosingSigned this_ptr_conv;
10702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10703 this_ptr_conv.is_owned = false;
10704 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
10708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10709 LDKClosingSigned this_ptr_conv;
10710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10711 this_ptr_conv.is_owned = false;
10712 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
10715 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10716 LDKClosingSigned this_ptr_conv;
10717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10718 this_ptr_conv.is_owned = false;
10719 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10720 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
10724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10725 LDKClosingSigned this_ptr_conv;
10726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10727 this_ptr_conv.is_owned = false;
10728 LDKSignature val_ref;
10729 CHECK((*env)->GetArrayLength(env, val) == 64);
10730 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10731 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
10734 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) {
10735 LDKThirtyTwoBytes channel_id_arg_ref;
10736 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10737 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10738 LDKSignature signature_arg_ref;
10739 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10740 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10741 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
10742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10744 long ret_ref = (long)ret_var.inner;
10745 if (ret_var.is_owned) {
10751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10752 LDKUpdateAddHTLC this_ptr_conv;
10753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10755 UpdateAddHTLC_free(this_ptr_conv);
10758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10759 LDKUpdateAddHTLC orig_conv;
10760 orig_conv.inner = (void*)(orig & (~1));
10761 orig_conv.is_owned = false;
10762 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
10763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10765 long ret_ref = (long)ret_var.inner;
10766 if (ret_var.is_owned) {
10772 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10773 LDKUpdateAddHTLC this_ptr_conv;
10774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10775 this_ptr_conv.is_owned = false;
10776 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10777 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
10781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10782 LDKUpdateAddHTLC this_ptr_conv;
10783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10784 this_ptr_conv.is_owned = false;
10785 LDKThirtyTwoBytes val_ref;
10786 CHECK((*env)->GetArrayLength(env, val) == 32);
10787 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10788 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
10791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10792 LDKUpdateAddHTLC this_ptr_conv;
10793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10794 this_ptr_conv.is_owned = false;
10795 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
10799 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10800 LDKUpdateAddHTLC this_ptr_conv;
10801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10802 this_ptr_conv.is_owned = false;
10803 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
10806 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10807 LDKUpdateAddHTLC this_ptr_conv;
10808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10809 this_ptr_conv.is_owned = false;
10810 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
10814 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10815 LDKUpdateAddHTLC this_ptr_conv;
10816 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10817 this_ptr_conv.is_owned = false;
10818 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
10821 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
10822 LDKUpdateAddHTLC this_ptr_conv;
10823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10824 this_ptr_conv.is_owned = false;
10825 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10826 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
10830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10831 LDKUpdateAddHTLC this_ptr_conv;
10832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10833 this_ptr_conv.is_owned = false;
10834 LDKThirtyTwoBytes val_ref;
10835 CHECK((*env)->GetArrayLength(env, val) == 32);
10836 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10837 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
10840 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
10841 LDKUpdateAddHTLC this_ptr_conv;
10842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10843 this_ptr_conv.is_owned = false;
10844 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
10848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10849 LDKUpdateAddHTLC this_ptr_conv;
10850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10851 this_ptr_conv.is_owned = false;
10852 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
10855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10856 LDKUpdateFulfillHTLC this_ptr_conv;
10857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10858 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10859 UpdateFulfillHTLC_free(this_ptr_conv);
10862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10863 LDKUpdateFulfillHTLC orig_conv;
10864 orig_conv.inner = (void*)(orig & (~1));
10865 orig_conv.is_owned = false;
10866 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
10867 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10868 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10869 long ret_ref = (long)ret_var.inner;
10870 if (ret_var.is_owned) {
10876 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10877 LDKUpdateFulfillHTLC this_ptr_conv;
10878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10879 this_ptr_conv.is_owned = false;
10880 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10881 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
10885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10886 LDKUpdateFulfillHTLC this_ptr_conv;
10887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10888 this_ptr_conv.is_owned = false;
10889 LDKThirtyTwoBytes val_ref;
10890 CHECK((*env)->GetArrayLength(env, val) == 32);
10891 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10892 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
10895 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10896 LDKUpdateFulfillHTLC this_ptr_conv;
10897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10898 this_ptr_conv.is_owned = false;
10899 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
10903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10904 LDKUpdateFulfillHTLC this_ptr_conv;
10905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10906 this_ptr_conv.is_owned = false;
10907 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
10910 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
10911 LDKUpdateFulfillHTLC this_ptr_conv;
10912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10913 this_ptr_conv.is_owned = false;
10914 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10915 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
10919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10920 LDKUpdateFulfillHTLC this_ptr_conv;
10921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10922 this_ptr_conv.is_owned = false;
10923 LDKThirtyTwoBytes val_ref;
10924 CHECK((*env)->GetArrayLength(env, val) == 32);
10925 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10926 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
10929 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) {
10930 LDKThirtyTwoBytes channel_id_arg_ref;
10931 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10932 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10933 LDKThirtyTwoBytes payment_preimage_arg_ref;
10934 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
10935 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
10936 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
10937 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10938 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10939 long ret_ref = (long)ret_var.inner;
10940 if (ret_var.is_owned) {
10946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10947 LDKUpdateFailHTLC this_ptr_conv;
10948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10950 UpdateFailHTLC_free(this_ptr_conv);
10953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10954 LDKUpdateFailHTLC orig_conv;
10955 orig_conv.inner = (void*)(orig & (~1));
10956 orig_conv.is_owned = false;
10957 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
10958 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10959 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10960 long ret_ref = (long)ret_var.inner;
10961 if (ret_var.is_owned) {
10967 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10968 LDKUpdateFailHTLC this_ptr_conv;
10969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10970 this_ptr_conv.is_owned = false;
10971 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10972 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
10976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10977 LDKUpdateFailHTLC this_ptr_conv;
10978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10979 this_ptr_conv.is_owned = false;
10980 LDKThirtyTwoBytes val_ref;
10981 CHECK((*env)->GetArrayLength(env, val) == 32);
10982 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10983 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
10986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10987 LDKUpdateFailHTLC this_ptr_conv;
10988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10989 this_ptr_conv.is_owned = false;
10990 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
10994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10995 LDKUpdateFailHTLC this_ptr_conv;
10996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10997 this_ptr_conv.is_owned = false;
10998 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
11001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11002 LDKUpdateFailMalformedHTLC this_ptr_conv;
11003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11005 UpdateFailMalformedHTLC_free(this_ptr_conv);
11008 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11009 LDKUpdateFailMalformedHTLC orig_conv;
11010 orig_conv.inner = (void*)(orig & (~1));
11011 orig_conv.is_owned = false;
11012 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
11013 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11014 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11015 long ret_ref = (long)ret_var.inner;
11016 if (ret_var.is_owned) {
11022 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11023 LDKUpdateFailMalformedHTLC this_ptr_conv;
11024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11025 this_ptr_conv.is_owned = false;
11026 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11027 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
11031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11032 LDKUpdateFailMalformedHTLC this_ptr_conv;
11033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11034 this_ptr_conv.is_owned = false;
11035 LDKThirtyTwoBytes val_ref;
11036 CHECK((*env)->GetArrayLength(env, val) == 32);
11037 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11038 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
11041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11042 LDKUpdateFailMalformedHTLC this_ptr_conv;
11043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11044 this_ptr_conv.is_owned = false;
11045 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
11049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11050 LDKUpdateFailMalformedHTLC this_ptr_conv;
11051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11052 this_ptr_conv.is_owned = false;
11053 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
11056 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
11057 LDKUpdateFailMalformedHTLC this_ptr_conv;
11058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11059 this_ptr_conv.is_owned = false;
11060 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
11064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11065 LDKUpdateFailMalformedHTLC this_ptr_conv;
11066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11067 this_ptr_conv.is_owned = false;
11068 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
11071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11072 LDKCommitmentSigned this_ptr_conv;
11073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11075 CommitmentSigned_free(this_ptr_conv);
11078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11079 LDKCommitmentSigned orig_conv;
11080 orig_conv.inner = (void*)(orig & (~1));
11081 orig_conv.is_owned = false;
11082 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
11083 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11084 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11085 long ret_ref = (long)ret_var.inner;
11086 if (ret_var.is_owned) {
11092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11093 LDKCommitmentSigned this_ptr_conv;
11094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11095 this_ptr_conv.is_owned = false;
11096 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11097 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
11101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11102 LDKCommitmentSigned this_ptr_conv;
11103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11104 this_ptr_conv.is_owned = false;
11105 LDKThirtyTwoBytes val_ref;
11106 CHECK((*env)->GetArrayLength(env, val) == 32);
11107 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11108 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
11111 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11112 LDKCommitmentSigned this_ptr_conv;
11113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11114 this_ptr_conv.is_owned = false;
11115 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11116 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
11120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11121 LDKCommitmentSigned this_ptr_conv;
11122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11123 this_ptr_conv.is_owned = false;
11124 LDKSignature val_ref;
11125 CHECK((*env)->GetArrayLength(env, val) == 64);
11126 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11127 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
11130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
11131 LDKCommitmentSigned this_ptr_conv;
11132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11133 this_ptr_conv.is_owned = false;
11134 LDKCVec_SignatureZ val_constr;
11135 val_constr.datalen = (*env)->GetArrayLength(env, val);
11136 if (val_constr.datalen > 0)
11137 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11139 val_constr.data = NULL;
11140 for (size_t i = 0; i < val_constr.datalen; i++) {
11141 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
11142 LDKSignature arr_conv_8_ref;
11143 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11144 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11145 val_constr.data[i] = arr_conv_8_ref;
11147 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
11150 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) {
11151 LDKThirtyTwoBytes channel_id_arg_ref;
11152 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11153 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11154 LDKSignature signature_arg_ref;
11155 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11156 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11157 LDKCVec_SignatureZ htlc_signatures_arg_constr;
11158 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
11159 if (htlc_signatures_arg_constr.datalen > 0)
11160 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11162 htlc_signatures_arg_constr.data = NULL;
11163 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
11164 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
11165 LDKSignature arr_conv_8_ref;
11166 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11167 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11168 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
11170 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
11171 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11172 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11173 long ret_ref = (long)ret_var.inner;
11174 if (ret_var.is_owned) {
11180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11181 LDKRevokeAndACK this_ptr_conv;
11182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11184 RevokeAndACK_free(this_ptr_conv);
11187 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11188 LDKRevokeAndACK orig_conv;
11189 orig_conv.inner = (void*)(orig & (~1));
11190 orig_conv.is_owned = false;
11191 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
11192 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11193 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11194 long ret_ref = (long)ret_var.inner;
11195 if (ret_var.is_owned) {
11201 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11202 LDKRevokeAndACK this_ptr_conv;
11203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11204 this_ptr_conv.is_owned = false;
11205 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11206 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
11210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11211 LDKRevokeAndACK this_ptr_conv;
11212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11213 this_ptr_conv.is_owned = false;
11214 LDKThirtyTwoBytes val_ref;
11215 CHECK((*env)->GetArrayLength(env, val) == 32);
11216 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11217 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
11220 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11221 LDKRevokeAndACK this_ptr_conv;
11222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11223 this_ptr_conv.is_owned = false;
11224 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11225 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
11229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11230 LDKRevokeAndACK this_ptr_conv;
11231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11232 this_ptr_conv.is_owned = false;
11233 LDKThirtyTwoBytes val_ref;
11234 CHECK((*env)->GetArrayLength(env, val) == 32);
11235 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11236 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
11239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11240 LDKRevokeAndACK this_ptr_conv;
11241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11242 this_ptr_conv.is_owned = false;
11243 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11244 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
11248 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) {
11249 LDKRevokeAndACK this_ptr_conv;
11250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11251 this_ptr_conv.is_owned = false;
11252 LDKPublicKey val_ref;
11253 CHECK((*env)->GetArrayLength(env, val) == 33);
11254 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11255 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
11258 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) {
11259 LDKThirtyTwoBytes channel_id_arg_ref;
11260 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11261 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11262 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
11263 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
11264 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
11265 LDKPublicKey next_per_commitment_point_arg_ref;
11266 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
11267 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
11268 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
11269 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11270 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11271 long ret_ref = (long)ret_var.inner;
11272 if (ret_var.is_owned) {
11278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11279 LDKUpdateFee this_ptr_conv;
11280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11282 UpdateFee_free(this_ptr_conv);
11285 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11286 LDKUpdateFee orig_conv;
11287 orig_conv.inner = (void*)(orig & (~1));
11288 orig_conv.is_owned = false;
11289 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
11290 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11291 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11292 long ret_ref = (long)ret_var.inner;
11293 if (ret_var.is_owned) {
11299 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11300 LDKUpdateFee this_ptr_conv;
11301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11302 this_ptr_conv.is_owned = false;
11303 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11304 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
11308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11309 LDKUpdateFee this_ptr_conv;
11310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11311 this_ptr_conv.is_owned = false;
11312 LDKThirtyTwoBytes val_ref;
11313 CHECK((*env)->GetArrayLength(env, val) == 32);
11314 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11315 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
11318 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
11319 LDKUpdateFee this_ptr_conv;
11320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11321 this_ptr_conv.is_owned = false;
11322 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
11326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11327 LDKUpdateFee this_ptr_conv;
11328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11329 this_ptr_conv.is_owned = false;
11330 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
11333 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) {
11334 LDKThirtyTwoBytes channel_id_arg_ref;
11335 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11336 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11337 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
11338 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11339 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11340 long ret_ref = (long)ret_var.inner;
11341 if (ret_var.is_owned) {
11347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11348 LDKDataLossProtect this_ptr_conv;
11349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11351 DataLossProtect_free(this_ptr_conv);
11354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11355 LDKDataLossProtect orig_conv;
11356 orig_conv.inner = (void*)(orig & (~1));
11357 orig_conv.is_owned = false;
11358 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
11359 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11360 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11361 long ret_ref = (long)ret_var.inner;
11362 if (ret_var.is_owned) {
11368 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11369 LDKDataLossProtect this_ptr_conv;
11370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11371 this_ptr_conv.is_owned = false;
11372 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11373 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
11377 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) {
11378 LDKDataLossProtect this_ptr_conv;
11379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11380 this_ptr_conv.is_owned = false;
11381 LDKThirtyTwoBytes val_ref;
11382 CHECK((*env)->GetArrayLength(env, val) == 32);
11383 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11384 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
11387 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11388 LDKDataLossProtect this_ptr_conv;
11389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11390 this_ptr_conv.is_owned = false;
11391 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11392 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
11396 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) {
11397 LDKDataLossProtect this_ptr_conv;
11398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11399 this_ptr_conv.is_owned = false;
11400 LDKPublicKey val_ref;
11401 CHECK((*env)->GetArrayLength(env, val) == 33);
11402 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11403 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
11406 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) {
11407 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
11408 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
11409 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
11410 LDKPublicKey my_current_per_commitment_point_arg_ref;
11411 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
11412 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
11413 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
11414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11416 long ret_ref = (long)ret_var.inner;
11417 if (ret_var.is_owned) {
11423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11424 LDKChannelReestablish this_ptr_conv;
11425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11427 ChannelReestablish_free(this_ptr_conv);
11430 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11431 LDKChannelReestablish orig_conv;
11432 orig_conv.inner = (void*)(orig & (~1));
11433 orig_conv.is_owned = false;
11434 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
11435 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11436 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11437 long ret_ref = (long)ret_var.inner;
11438 if (ret_var.is_owned) {
11444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11445 LDKChannelReestablish this_ptr_conv;
11446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11447 this_ptr_conv.is_owned = false;
11448 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11449 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
11453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11454 LDKChannelReestablish this_ptr_conv;
11455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11456 this_ptr_conv.is_owned = false;
11457 LDKThirtyTwoBytes val_ref;
11458 CHECK((*env)->GetArrayLength(env, val) == 32);
11459 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11460 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
11463 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11464 LDKChannelReestablish this_ptr_conv;
11465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11466 this_ptr_conv.is_owned = false;
11467 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
11471 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) {
11472 LDKChannelReestablish this_ptr_conv;
11473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11474 this_ptr_conv.is_owned = false;
11475 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
11478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11479 LDKChannelReestablish this_ptr_conv;
11480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11481 this_ptr_conv.is_owned = false;
11482 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
11486 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) {
11487 LDKChannelReestablish this_ptr_conv;
11488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11489 this_ptr_conv.is_owned = false;
11490 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
11493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11494 LDKAnnouncementSignatures this_ptr_conv;
11495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11497 AnnouncementSignatures_free(this_ptr_conv);
11500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11501 LDKAnnouncementSignatures orig_conv;
11502 orig_conv.inner = (void*)(orig & (~1));
11503 orig_conv.is_owned = false;
11504 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
11505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11507 long ret_ref = (long)ret_var.inner;
11508 if (ret_var.is_owned) {
11514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11515 LDKAnnouncementSignatures this_ptr_conv;
11516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11517 this_ptr_conv.is_owned = false;
11518 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11519 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
11523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11524 LDKAnnouncementSignatures this_ptr_conv;
11525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11526 this_ptr_conv.is_owned = false;
11527 LDKThirtyTwoBytes val_ref;
11528 CHECK((*env)->GetArrayLength(env, val) == 32);
11529 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11530 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
11533 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11534 LDKAnnouncementSignatures this_ptr_conv;
11535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11536 this_ptr_conv.is_owned = false;
11537 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
11541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11542 LDKAnnouncementSignatures this_ptr_conv;
11543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11544 this_ptr_conv.is_owned = false;
11545 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
11548 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11549 LDKAnnouncementSignatures this_ptr_conv;
11550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11551 this_ptr_conv.is_owned = false;
11552 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11553 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
11557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11558 LDKAnnouncementSignatures this_ptr_conv;
11559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11560 this_ptr_conv.is_owned = false;
11561 LDKSignature val_ref;
11562 CHECK((*env)->GetArrayLength(env, val) == 64);
11563 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11564 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
11567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11568 LDKAnnouncementSignatures this_ptr_conv;
11569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11570 this_ptr_conv.is_owned = false;
11571 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11572 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
11576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11577 LDKAnnouncementSignatures this_ptr_conv;
11578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11579 this_ptr_conv.is_owned = false;
11580 LDKSignature val_ref;
11581 CHECK((*env)->GetArrayLength(env, val) == 64);
11582 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11583 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
11586 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) {
11587 LDKThirtyTwoBytes channel_id_arg_ref;
11588 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11589 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11590 LDKSignature node_signature_arg_ref;
11591 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
11592 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
11593 LDKSignature bitcoin_signature_arg_ref;
11594 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
11595 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
11596 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
11597 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11598 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11599 long ret_ref = (long)ret_var.inner;
11600 if (ret_var.is_owned) {
11606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11607 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
11608 FREE((void*)this_ptr);
11609 NetAddress_free(this_ptr_conv);
11612 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11613 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
11614 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
11615 *ret_copy = NetAddress_clone(orig_conv);
11616 long ret_ref = (long)ret_copy;
11620 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
11621 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
11622 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
11623 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
11624 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
11625 CVec_u8Z_free(arg_var);
11629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11630 LDKu8slice ser_ref;
11631 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11632 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11633 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11634 *ret_conv = Result_read(ser_ref);
11635 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11636 return (long)ret_conv;
11639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11640 LDKUnsignedNodeAnnouncement this_ptr_conv;
11641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11643 UnsignedNodeAnnouncement_free(this_ptr_conv);
11646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11647 LDKUnsignedNodeAnnouncement orig_conv;
11648 orig_conv.inner = (void*)(orig & (~1));
11649 orig_conv.is_owned = false;
11650 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
11651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11653 long ret_ref = (long)ret_var.inner;
11654 if (ret_var.is_owned) {
11660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11661 LDKUnsignedNodeAnnouncement this_ptr_conv;
11662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11663 this_ptr_conv.is_owned = false;
11664 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
11665 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11666 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11667 long ret_ref = (long)ret_var.inner;
11668 if (ret_var.is_owned) {
11674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11675 LDKUnsignedNodeAnnouncement this_ptr_conv;
11676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11677 this_ptr_conv.is_owned = false;
11678 LDKNodeFeatures val_conv;
11679 val_conv.inner = (void*)(val & (~1));
11680 val_conv.is_owned = (val & 1) || (val == 0);
11681 // Warning: we may need a move here but can't clone!
11682 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
11685 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
11686 LDKUnsignedNodeAnnouncement this_ptr_conv;
11687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11688 this_ptr_conv.is_owned = false;
11689 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
11693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11694 LDKUnsignedNodeAnnouncement this_ptr_conv;
11695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11696 this_ptr_conv.is_owned = false;
11697 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
11700 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11701 LDKUnsignedNodeAnnouncement this_ptr_conv;
11702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11703 this_ptr_conv.is_owned = false;
11704 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11705 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
11709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11710 LDKUnsignedNodeAnnouncement this_ptr_conv;
11711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11712 this_ptr_conv.is_owned = false;
11713 LDKPublicKey val_ref;
11714 CHECK((*env)->GetArrayLength(env, val) == 33);
11715 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11716 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
11719 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
11720 LDKUnsignedNodeAnnouncement this_ptr_conv;
11721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11722 this_ptr_conv.is_owned = false;
11723 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
11724 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
11728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11729 LDKUnsignedNodeAnnouncement this_ptr_conv;
11730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11731 this_ptr_conv.is_owned = false;
11732 LDKThreeBytes val_ref;
11733 CHECK((*env)->GetArrayLength(env, val) == 3);
11734 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
11735 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
11738 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
11739 LDKUnsignedNodeAnnouncement this_ptr_conv;
11740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11741 this_ptr_conv.is_owned = false;
11742 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11743 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
11747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11748 LDKUnsignedNodeAnnouncement this_ptr_conv;
11749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11750 this_ptr_conv.is_owned = false;
11751 LDKThirtyTwoBytes val_ref;
11752 CHECK((*env)->GetArrayLength(env, val) == 32);
11753 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11754 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
11757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
11758 LDKUnsignedNodeAnnouncement this_ptr_conv;
11759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11760 this_ptr_conv.is_owned = false;
11761 LDKCVec_NetAddressZ val_constr;
11762 val_constr.datalen = (*env)->GetArrayLength(env, val);
11763 if (val_constr.datalen > 0)
11764 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11766 val_constr.data = NULL;
11767 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
11768 for (size_t m = 0; m < val_constr.datalen; m++) {
11769 int64_t arr_conv_12 = val_vals[m];
11770 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
11771 FREE((void*)arr_conv_12);
11772 val_constr.data[m] = arr_conv_12_conv;
11774 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
11775 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
11778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11779 LDKNodeAnnouncement this_ptr_conv;
11780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11782 NodeAnnouncement_free(this_ptr_conv);
11785 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11786 LDKNodeAnnouncement orig_conv;
11787 orig_conv.inner = (void*)(orig & (~1));
11788 orig_conv.is_owned = false;
11789 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
11790 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11791 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11792 long ret_ref = (long)ret_var.inner;
11793 if (ret_var.is_owned) {
11799 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11800 LDKNodeAnnouncement this_ptr_conv;
11801 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11802 this_ptr_conv.is_owned = false;
11803 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11804 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
11808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11809 LDKNodeAnnouncement this_ptr_conv;
11810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11811 this_ptr_conv.is_owned = false;
11812 LDKSignature val_ref;
11813 CHECK((*env)->GetArrayLength(env, val) == 64);
11814 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11815 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
11818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
11819 LDKNodeAnnouncement this_ptr_conv;
11820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11821 this_ptr_conv.is_owned = false;
11822 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
11823 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11824 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11825 long ret_ref = (long)ret_var.inner;
11826 if (ret_var.is_owned) {
11832 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11833 LDKNodeAnnouncement this_ptr_conv;
11834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11835 this_ptr_conv.is_owned = false;
11836 LDKUnsignedNodeAnnouncement val_conv;
11837 val_conv.inner = (void*)(val & (~1));
11838 val_conv.is_owned = (val & 1) || (val == 0);
11839 if (val_conv.inner != NULL)
11840 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
11841 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
11844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
11845 LDKSignature signature_arg_ref;
11846 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11847 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11848 LDKUnsignedNodeAnnouncement contents_arg_conv;
11849 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11850 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11851 if (contents_arg_conv.inner != NULL)
11852 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
11853 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
11854 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11855 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11856 long ret_ref = (long)ret_var.inner;
11857 if (ret_var.is_owned) {
11863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11864 LDKUnsignedChannelAnnouncement this_ptr_conv;
11865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11867 UnsignedChannelAnnouncement_free(this_ptr_conv);
11870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11871 LDKUnsignedChannelAnnouncement orig_conv;
11872 orig_conv.inner = (void*)(orig & (~1));
11873 orig_conv.is_owned = false;
11874 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
11875 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11876 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11877 long ret_ref = (long)ret_var.inner;
11878 if (ret_var.is_owned) {
11884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11885 LDKUnsignedChannelAnnouncement this_ptr_conv;
11886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11887 this_ptr_conv.is_owned = false;
11888 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
11889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11891 long ret_ref = (long)ret_var.inner;
11892 if (ret_var.is_owned) {
11898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11899 LDKUnsignedChannelAnnouncement this_ptr_conv;
11900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11901 this_ptr_conv.is_owned = false;
11902 LDKChannelFeatures val_conv;
11903 val_conv.inner = (void*)(val & (~1));
11904 val_conv.is_owned = (val & 1) || (val == 0);
11905 // Warning: we may need a move here but can't clone!
11906 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
11909 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11910 LDKUnsignedChannelAnnouncement this_ptr_conv;
11911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11912 this_ptr_conv.is_owned = false;
11913 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11914 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
11918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11919 LDKUnsignedChannelAnnouncement this_ptr_conv;
11920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11921 this_ptr_conv.is_owned = false;
11922 LDKThirtyTwoBytes val_ref;
11923 CHECK((*env)->GetArrayLength(env, val) == 32);
11924 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11925 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
11928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11929 LDKUnsignedChannelAnnouncement this_ptr_conv;
11930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11931 this_ptr_conv.is_owned = false;
11932 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
11936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11937 LDKUnsignedChannelAnnouncement this_ptr_conv;
11938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11939 this_ptr_conv.is_owned = false;
11940 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
11943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
11944 LDKUnsignedChannelAnnouncement this_ptr_conv;
11945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11946 this_ptr_conv.is_owned = false;
11947 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11948 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
11952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11953 LDKUnsignedChannelAnnouncement this_ptr_conv;
11954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11955 this_ptr_conv.is_owned = false;
11956 LDKPublicKey val_ref;
11957 CHECK((*env)->GetArrayLength(env, val) == 33);
11958 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11959 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
11962 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
11963 LDKUnsignedChannelAnnouncement this_ptr_conv;
11964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11965 this_ptr_conv.is_owned = false;
11966 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11967 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
11971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11972 LDKUnsignedChannelAnnouncement this_ptr_conv;
11973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11974 this_ptr_conv.is_owned = false;
11975 LDKPublicKey val_ref;
11976 CHECK((*env)->GetArrayLength(env, val) == 33);
11977 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11978 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
11981 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
11982 LDKUnsignedChannelAnnouncement this_ptr_conv;
11983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11984 this_ptr_conv.is_owned = false;
11985 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11986 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
11990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11991 LDKUnsignedChannelAnnouncement this_ptr_conv;
11992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11993 this_ptr_conv.is_owned = false;
11994 LDKPublicKey val_ref;
11995 CHECK((*env)->GetArrayLength(env, val) == 33);
11996 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11997 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
12000 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12001 LDKUnsignedChannelAnnouncement this_ptr_conv;
12002 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12003 this_ptr_conv.is_owned = false;
12004 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12005 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
12009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12010 LDKUnsignedChannelAnnouncement this_ptr_conv;
12011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12012 this_ptr_conv.is_owned = false;
12013 LDKPublicKey val_ref;
12014 CHECK((*env)->GetArrayLength(env, val) == 33);
12015 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12016 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
12019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12020 LDKChannelAnnouncement this_ptr_conv;
12021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12023 ChannelAnnouncement_free(this_ptr_conv);
12026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12027 LDKChannelAnnouncement orig_conv;
12028 orig_conv.inner = (void*)(orig & (~1));
12029 orig_conv.is_owned = false;
12030 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
12031 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12032 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12033 long ret_ref = (long)ret_var.inner;
12034 if (ret_var.is_owned) {
12040 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12041 LDKChannelAnnouncement this_ptr_conv;
12042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12043 this_ptr_conv.is_owned = false;
12044 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12045 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
12049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12050 LDKChannelAnnouncement this_ptr_conv;
12051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12052 this_ptr_conv.is_owned = false;
12053 LDKSignature val_ref;
12054 CHECK((*env)->GetArrayLength(env, val) == 64);
12055 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12056 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
12059 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12060 LDKChannelAnnouncement this_ptr_conv;
12061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12062 this_ptr_conv.is_owned = false;
12063 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12064 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
12068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12069 LDKChannelAnnouncement this_ptr_conv;
12070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12071 this_ptr_conv.is_owned = false;
12072 LDKSignature val_ref;
12073 CHECK((*env)->GetArrayLength(env, val) == 64);
12074 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12075 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
12078 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12079 LDKChannelAnnouncement this_ptr_conv;
12080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12081 this_ptr_conv.is_owned = false;
12082 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12083 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
12087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12088 LDKChannelAnnouncement this_ptr_conv;
12089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12090 this_ptr_conv.is_owned = false;
12091 LDKSignature val_ref;
12092 CHECK((*env)->GetArrayLength(env, val) == 64);
12093 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12094 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
12097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12098 LDKChannelAnnouncement this_ptr_conv;
12099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12100 this_ptr_conv.is_owned = false;
12101 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12102 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
12106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12107 LDKChannelAnnouncement this_ptr_conv;
12108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12109 this_ptr_conv.is_owned = false;
12110 LDKSignature val_ref;
12111 CHECK((*env)->GetArrayLength(env, val) == 64);
12112 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12113 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
12116 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12117 LDKChannelAnnouncement this_ptr_conv;
12118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12119 this_ptr_conv.is_owned = false;
12120 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
12121 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12122 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12123 long ret_ref = (long)ret_var.inner;
12124 if (ret_var.is_owned) {
12130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12131 LDKChannelAnnouncement this_ptr_conv;
12132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12133 this_ptr_conv.is_owned = false;
12134 LDKUnsignedChannelAnnouncement val_conv;
12135 val_conv.inner = (void*)(val & (~1));
12136 val_conv.is_owned = (val & 1) || (val == 0);
12137 if (val_conv.inner != NULL)
12138 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
12139 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
12142 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) {
12143 LDKSignature node_signature_1_arg_ref;
12144 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
12145 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
12146 LDKSignature node_signature_2_arg_ref;
12147 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
12148 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
12149 LDKSignature bitcoin_signature_1_arg_ref;
12150 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
12151 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
12152 LDKSignature bitcoin_signature_2_arg_ref;
12153 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
12154 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
12155 LDKUnsignedChannelAnnouncement contents_arg_conv;
12156 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12157 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12158 if (contents_arg_conv.inner != NULL)
12159 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
12160 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);
12161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12163 long ret_ref = (long)ret_var.inner;
12164 if (ret_var.is_owned) {
12170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12171 LDKUnsignedChannelUpdate this_ptr_conv;
12172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12174 UnsignedChannelUpdate_free(this_ptr_conv);
12177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12178 LDKUnsignedChannelUpdate orig_conv;
12179 orig_conv.inner = (void*)(orig & (~1));
12180 orig_conv.is_owned = false;
12181 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
12182 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12183 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12184 long ret_ref = (long)ret_var.inner;
12185 if (ret_var.is_owned) {
12191 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12192 LDKUnsignedChannelUpdate this_ptr_conv;
12193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12194 this_ptr_conv.is_owned = false;
12195 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12196 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
12200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12201 LDKUnsignedChannelUpdate this_ptr_conv;
12202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12203 this_ptr_conv.is_owned = false;
12204 LDKThirtyTwoBytes val_ref;
12205 CHECK((*env)->GetArrayLength(env, val) == 32);
12206 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12207 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
12210 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12211 LDKUnsignedChannelUpdate this_ptr_conv;
12212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12213 this_ptr_conv.is_owned = false;
12214 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
12218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12219 LDKUnsignedChannelUpdate this_ptr_conv;
12220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12221 this_ptr_conv.is_owned = false;
12222 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
12225 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12226 LDKUnsignedChannelUpdate this_ptr_conv;
12227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12228 this_ptr_conv.is_owned = false;
12229 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
12233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12234 LDKUnsignedChannelUpdate this_ptr_conv;
12235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12236 this_ptr_conv.is_owned = false;
12237 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
12240 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
12241 LDKUnsignedChannelUpdate this_ptr_conv;
12242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12243 this_ptr_conv.is_owned = false;
12244 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
12248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
12249 LDKUnsignedChannelUpdate this_ptr_conv;
12250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12251 this_ptr_conv.is_owned = false;
12252 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
12255 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
12256 LDKUnsignedChannelUpdate this_ptr_conv;
12257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12258 this_ptr_conv.is_owned = false;
12259 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
12263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12264 LDKUnsignedChannelUpdate this_ptr_conv;
12265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12266 this_ptr_conv.is_owned = false;
12267 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
12270 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12271 LDKUnsignedChannelUpdate this_ptr_conv;
12272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12273 this_ptr_conv.is_owned = false;
12274 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
12278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12279 LDKUnsignedChannelUpdate this_ptr_conv;
12280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12281 this_ptr_conv.is_owned = false;
12282 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
12285 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12286 LDKUnsignedChannelUpdate this_ptr_conv;
12287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12288 this_ptr_conv.is_owned = false;
12289 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
12293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12294 LDKUnsignedChannelUpdate this_ptr_conv;
12295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12296 this_ptr_conv.is_owned = false;
12297 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
12300 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
12301 LDKUnsignedChannelUpdate this_ptr_conv;
12302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12303 this_ptr_conv.is_owned = false;
12304 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
12308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12309 LDKUnsignedChannelUpdate this_ptr_conv;
12310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12311 this_ptr_conv.is_owned = false;
12312 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
12315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12316 LDKChannelUpdate this_ptr_conv;
12317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12319 ChannelUpdate_free(this_ptr_conv);
12322 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12323 LDKChannelUpdate orig_conv;
12324 orig_conv.inner = (void*)(orig & (~1));
12325 orig_conv.is_owned = false;
12326 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
12327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12329 long ret_ref = (long)ret_var.inner;
12330 if (ret_var.is_owned) {
12336 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
12337 LDKChannelUpdate this_ptr_conv;
12338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12339 this_ptr_conv.is_owned = false;
12340 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12341 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
12345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12346 LDKChannelUpdate this_ptr_conv;
12347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12348 this_ptr_conv.is_owned = false;
12349 LDKSignature val_ref;
12350 CHECK((*env)->GetArrayLength(env, val) == 64);
12351 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12352 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
12355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12356 LDKChannelUpdate this_ptr_conv;
12357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12358 this_ptr_conv.is_owned = false;
12359 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
12360 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12361 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12362 long ret_ref = (long)ret_var.inner;
12363 if (ret_var.is_owned) {
12369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12370 LDKChannelUpdate this_ptr_conv;
12371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12372 this_ptr_conv.is_owned = false;
12373 LDKUnsignedChannelUpdate val_conv;
12374 val_conv.inner = (void*)(val & (~1));
12375 val_conv.is_owned = (val & 1) || (val == 0);
12376 if (val_conv.inner != NULL)
12377 val_conv = UnsignedChannelUpdate_clone(&val_conv);
12378 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
12381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
12382 LDKSignature signature_arg_ref;
12383 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
12384 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12385 LDKUnsignedChannelUpdate contents_arg_conv;
12386 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12387 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12388 if (contents_arg_conv.inner != NULL)
12389 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
12390 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
12391 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12392 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12393 long ret_ref = (long)ret_var.inner;
12394 if (ret_var.is_owned) {
12400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12401 LDKQueryChannelRange this_ptr_conv;
12402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12404 QueryChannelRange_free(this_ptr_conv);
12407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12408 LDKQueryChannelRange orig_conv;
12409 orig_conv.inner = (void*)(orig & (~1));
12410 orig_conv.is_owned = false;
12411 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
12412 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12413 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12414 long ret_ref = (long)ret_var.inner;
12415 if (ret_var.is_owned) {
12421 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12422 LDKQueryChannelRange this_ptr_conv;
12423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12424 this_ptr_conv.is_owned = false;
12425 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12426 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
12430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12431 LDKQueryChannelRange this_ptr_conv;
12432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12433 this_ptr_conv.is_owned = false;
12434 LDKThirtyTwoBytes val_ref;
12435 CHECK((*env)->GetArrayLength(env, val) == 32);
12436 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12437 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12440 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12441 LDKQueryChannelRange this_ptr_conv;
12442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12443 this_ptr_conv.is_owned = false;
12444 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
12448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12449 LDKQueryChannelRange this_ptr_conv;
12450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12451 this_ptr_conv.is_owned = false;
12452 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
12455 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12456 LDKQueryChannelRange this_ptr_conv;
12457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12458 this_ptr_conv.is_owned = false;
12459 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
12463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12464 LDKQueryChannelRange this_ptr_conv;
12465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12466 this_ptr_conv.is_owned = false;
12467 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12470 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) {
12471 LDKThirtyTwoBytes chain_hash_arg_ref;
12472 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12473 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12474 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
12475 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12476 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12477 long ret_ref = (long)ret_var.inner;
12478 if (ret_var.is_owned) {
12484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12485 LDKReplyChannelRange this_ptr_conv;
12486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12488 ReplyChannelRange_free(this_ptr_conv);
12491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12492 LDKReplyChannelRange orig_conv;
12493 orig_conv.inner = (void*)(orig & (~1));
12494 orig_conv.is_owned = false;
12495 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
12496 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12497 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12498 long ret_ref = (long)ret_var.inner;
12499 if (ret_var.is_owned) {
12505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12506 LDKReplyChannelRange this_ptr_conv;
12507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12508 this_ptr_conv.is_owned = false;
12509 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12510 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
12514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12515 LDKReplyChannelRange this_ptr_conv;
12516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12517 this_ptr_conv.is_owned = false;
12518 LDKThirtyTwoBytes val_ref;
12519 CHECK((*env)->GetArrayLength(env, val) == 32);
12520 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12521 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12524 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12525 LDKReplyChannelRange this_ptr_conv;
12526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12527 this_ptr_conv.is_owned = false;
12528 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
12532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12533 LDKReplyChannelRange this_ptr_conv;
12534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12535 this_ptr_conv.is_owned = false;
12536 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
12539 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12540 LDKReplyChannelRange this_ptr_conv;
12541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12542 this_ptr_conv.is_owned = false;
12543 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
12547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12548 LDKReplyChannelRange this_ptr_conv;
12549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12550 this_ptr_conv.is_owned = false;
12551 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12554 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12555 LDKReplyChannelRange this_ptr_conv;
12556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12557 this_ptr_conv.is_owned = false;
12558 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
12562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12563 LDKReplyChannelRange this_ptr_conv;
12564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12565 this_ptr_conv.is_owned = false;
12566 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
12569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12570 LDKReplyChannelRange this_ptr_conv;
12571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12572 this_ptr_conv.is_owned = false;
12573 LDKCVec_u64Z val_constr;
12574 val_constr.datalen = (*env)->GetArrayLength(env, val);
12575 if (val_constr.datalen > 0)
12576 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12578 val_constr.data = NULL;
12579 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12580 for (size_t g = 0; g < val_constr.datalen; g++) {
12581 int64_t arr_conv_6 = val_vals[g];
12582 val_constr.data[g] = arr_conv_6;
12584 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12585 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
12588 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, int32_t first_blocknum_arg, int32_t number_of_blocks_arg, jboolean full_information_arg, int64_tArray short_channel_ids_arg) {
12589 LDKThirtyTwoBytes chain_hash_arg_ref;
12590 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12591 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12592 LDKCVec_u64Z short_channel_ids_arg_constr;
12593 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12594 if (short_channel_ids_arg_constr.datalen > 0)
12595 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12597 short_channel_ids_arg_constr.data = NULL;
12598 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12599 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12600 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12601 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12603 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12604 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
12605 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12606 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12607 long ret_ref = (long)ret_var.inner;
12608 if (ret_var.is_owned) {
12614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12615 LDKQueryShortChannelIds this_ptr_conv;
12616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12618 QueryShortChannelIds_free(this_ptr_conv);
12621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12622 LDKQueryShortChannelIds orig_conv;
12623 orig_conv.inner = (void*)(orig & (~1));
12624 orig_conv.is_owned = false;
12625 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
12626 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12627 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12628 long ret_ref = (long)ret_var.inner;
12629 if (ret_var.is_owned) {
12635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12636 LDKQueryShortChannelIds this_ptr_conv;
12637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12638 this_ptr_conv.is_owned = false;
12639 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12640 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
12644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12645 LDKQueryShortChannelIds this_ptr_conv;
12646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12647 this_ptr_conv.is_owned = false;
12648 LDKThirtyTwoBytes val_ref;
12649 CHECK((*env)->GetArrayLength(env, val) == 32);
12650 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12651 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
12654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12655 LDKQueryShortChannelIds this_ptr_conv;
12656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12657 this_ptr_conv.is_owned = false;
12658 LDKCVec_u64Z val_constr;
12659 val_constr.datalen = (*env)->GetArrayLength(env, val);
12660 if (val_constr.datalen > 0)
12661 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12663 val_constr.data = NULL;
12664 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12665 for (size_t g = 0; g < val_constr.datalen; g++) {
12666 int64_t arr_conv_6 = val_vals[g];
12667 val_constr.data[g] = arr_conv_6;
12669 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12670 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
12673 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) {
12674 LDKThirtyTwoBytes chain_hash_arg_ref;
12675 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12676 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12677 LDKCVec_u64Z short_channel_ids_arg_constr;
12678 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12679 if (short_channel_ids_arg_constr.datalen > 0)
12680 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12682 short_channel_ids_arg_constr.data = NULL;
12683 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12684 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12685 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12686 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12688 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12689 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
12690 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12691 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12692 long ret_ref = (long)ret_var.inner;
12693 if (ret_var.is_owned) {
12699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12700 LDKReplyShortChannelIdsEnd this_ptr_conv;
12701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12703 ReplyShortChannelIdsEnd_free(this_ptr_conv);
12706 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12707 LDKReplyShortChannelIdsEnd orig_conv;
12708 orig_conv.inner = (void*)(orig & (~1));
12709 orig_conv.is_owned = false;
12710 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
12711 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12712 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12713 long ret_ref = (long)ret_var.inner;
12714 if (ret_var.is_owned) {
12720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12721 LDKReplyShortChannelIdsEnd this_ptr_conv;
12722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12723 this_ptr_conv.is_owned = false;
12724 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12725 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
12729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12730 LDKReplyShortChannelIdsEnd this_ptr_conv;
12731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12732 this_ptr_conv.is_owned = false;
12733 LDKThirtyTwoBytes val_ref;
12734 CHECK((*env)->GetArrayLength(env, val) == 32);
12735 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12736 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
12739 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12740 LDKReplyShortChannelIdsEnd this_ptr_conv;
12741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12742 this_ptr_conv.is_owned = false;
12743 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
12747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12748 LDKReplyShortChannelIdsEnd this_ptr_conv;
12749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12750 this_ptr_conv.is_owned = false;
12751 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
12754 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
12755 LDKThirtyTwoBytes chain_hash_arg_ref;
12756 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12757 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12758 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
12759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12761 long ret_ref = (long)ret_var.inner;
12762 if (ret_var.is_owned) {
12768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12769 LDKGossipTimestampFilter this_ptr_conv;
12770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12771 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12772 GossipTimestampFilter_free(this_ptr_conv);
12775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12776 LDKGossipTimestampFilter orig_conv;
12777 orig_conv.inner = (void*)(orig & (~1));
12778 orig_conv.is_owned = false;
12779 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
12780 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12781 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12782 long ret_ref = (long)ret_var.inner;
12783 if (ret_var.is_owned) {
12789 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12790 LDKGossipTimestampFilter this_ptr_conv;
12791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12792 this_ptr_conv.is_owned = false;
12793 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12794 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
12798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12799 LDKGossipTimestampFilter this_ptr_conv;
12800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12801 this_ptr_conv.is_owned = false;
12802 LDKThirtyTwoBytes val_ref;
12803 CHECK((*env)->GetArrayLength(env, val) == 32);
12804 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12805 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
12808 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12809 LDKGossipTimestampFilter this_ptr_conv;
12810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12811 this_ptr_conv.is_owned = false;
12812 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
12816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12817 LDKGossipTimestampFilter this_ptr_conv;
12818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12819 this_ptr_conv.is_owned = false;
12820 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
12823 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
12824 LDKGossipTimestampFilter this_ptr_conv;
12825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12826 this_ptr_conv.is_owned = false;
12827 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
12831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12832 LDKGossipTimestampFilter this_ptr_conv;
12833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12834 this_ptr_conv.is_owned = false;
12835 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
12838 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) {
12839 LDKThirtyTwoBytes chain_hash_arg_ref;
12840 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12841 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12842 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
12843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12845 long ret_ref = (long)ret_var.inner;
12846 if (ret_var.is_owned) {
12852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12853 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
12854 FREE((void*)this_ptr);
12855 ErrorAction_free(this_ptr_conv);
12858 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12859 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
12860 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12861 *ret_copy = ErrorAction_clone(orig_conv);
12862 long ret_ref = (long)ret_copy;
12866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12867 LDKLightningError this_ptr_conv;
12868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12870 LightningError_free(this_ptr_conv);
12873 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
12874 LDKLightningError this_ptr_conv;
12875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12876 this_ptr_conv.is_owned = false;
12877 LDKStr _str = LightningError_get_err(&this_ptr_conv);
12878 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
12882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12883 LDKLightningError this_ptr_conv;
12884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12885 this_ptr_conv.is_owned = false;
12886 LDKCVec_u8Z val_ref;
12887 val_ref.datalen = (*env)->GetArrayLength(env, val);
12888 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12889 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12890 LightningError_set_err(&this_ptr_conv, val_ref);
12893 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
12894 LDKLightningError this_ptr_conv;
12895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12896 this_ptr_conv.is_owned = false;
12897 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12898 *ret_copy = LightningError_get_action(&this_ptr_conv);
12899 long ret_ref = (long)ret_copy;
12903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12904 LDKLightningError this_ptr_conv;
12905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12906 this_ptr_conv.is_owned = false;
12907 LDKErrorAction val_conv = *(LDKErrorAction*)val;
12909 LightningError_set_action(&this_ptr_conv, val_conv);
12912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
12913 LDKCVec_u8Z err_arg_ref;
12914 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
12915 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12916 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
12917 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
12918 FREE((void*)action_arg);
12919 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
12920 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12921 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12922 long ret_ref = (long)ret_var.inner;
12923 if (ret_var.is_owned) {
12929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12930 LDKCommitmentUpdate this_ptr_conv;
12931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12933 CommitmentUpdate_free(this_ptr_conv);
12936 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12937 LDKCommitmentUpdate orig_conv;
12938 orig_conv.inner = (void*)(orig & (~1));
12939 orig_conv.is_owned = false;
12940 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
12941 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12942 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12943 long ret_ref = (long)ret_var.inner;
12944 if (ret_var.is_owned) {
12950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12951 LDKCommitmentUpdate this_ptr_conv;
12952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12953 this_ptr_conv.is_owned = false;
12954 LDKCVec_UpdateAddHTLCZ val_constr;
12955 val_constr.datalen = (*env)->GetArrayLength(env, val);
12956 if (val_constr.datalen > 0)
12957 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12959 val_constr.data = NULL;
12960 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12961 for (size_t p = 0; p < val_constr.datalen; p++) {
12962 int64_t arr_conv_15 = val_vals[p];
12963 LDKUpdateAddHTLC arr_conv_15_conv;
12964 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
12965 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
12966 if (arr_conv_15_conv.inner != NULL)
12967 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
12968 val_constr.data[p] = arr_conv_15_conv;
12970 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12971 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
12974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12975 LDKCommitmentUpdate this_ptr_conv;
12976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12977 this_ptr_conv.is_owned = false;
12978 LDKCVec_UpdateFulfillHTLCZ val_constr;
12979 val_constr.datalen = (*env)->GetArrayLength(env, val);
12980 if (val_constr.datalen > 0)
12981 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
12983 val_constr.data = NULL;
12984 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12985 for (size_t t = 0; t < val_constr.datalen; t++) {
12986 int64_t arr_conv_19 = val_vals[t];
12987 LDKUpdateFulfillHTLC arr_conv_19_conv;
12988 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
12989 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
12990 if (arr_conv_19_conv.inner != NULL)
12991 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
12992 val_constr.data[t] = arr_conv_19_conv;
12994 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12995 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
12998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12999 LDKCommitmentUpdate this_ptr_conv;
13000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13001 this_ptr_conv.is_owned = false;
13002 LDKCVec_UpdateFailHTLCZ val_constr;
13003 val_constr.datalen = (*env)->GetArrayLength(env, val);
13004 if (val_constr.datalen > 0)
13005 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13007 val_constr.data = NULL;
13008 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13009 for (size_t q = 0; q < val_constr.datalen; q++) {
13010 int64_t arr_conv_16 = val_vals[q];
13011 LDKUpdateFailHTLC arr_conv_16_conv;
13012 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13013 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13014 if (arr_conv_16_conv.inner != NULL)
13015 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13016 val_constr.data[q] = arr_conv_16_conv;
13018 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13019 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
13022 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) {
13023 LDKCommitmentUpdate this_ptr_conv;
13024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13025 this_ptr_conv.is_owned = false;
13026 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
13027 val_constr.datalen = (*env)->GetArrayLength(env, val);
13028 if (val_constr.datalen > 0)
13029 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13031 val_constr.data = NULL;
13032 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13033 for (size_t z = 0; z < val_constr.datalen; z++) {
13034 int64_t arr_conv_25 = val_vals[z];
13035 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13036 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13037 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13038 if (arr_conv_25_conv.inner != NULL)
13039 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13040 val_constr.data[z] = arr_conv_25_conv;
13042 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13043 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
13046 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
13047 LDKCommitmentUpdate this_ptr_conv;
13048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13049 this_ptr_conv.is_owned = false;
13050 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
13051 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13052 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13053 long ret_ref = (long)ret_var.inner;
13054 if (ret_var.is_owned) {
13060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13061 LDKCommitmentUpdate this_ptr_conv;
13062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13063 this_ptr_conv.is_owned = false;
13064 LDKUpdateFee val_conv;
13065 val_conv.inner = (void*)(val & (~1));
13066 val_conv.is_owned = (val & 1) || (val == 0);
13067 if (val_conv.inner != NULL)
13068 val_conv = UpdateFee_clone(&val_conv);
13069 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
13072 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
13073 LDKCommitmentUpdate this_ptr_conv;
13074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13075 this_ptr_conv.is_owned = false;
13076 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
13077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13079 long ret_ref = (long)ret_var.inner;
13080 if (ret_var.is_owned) {
13086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13087 LDKCommitmentUpdate this_ptr_conv;
13088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13089 this_ptr_conv.is_owned = false;
13090 LDKCommitmentSigned val_conv;
13091 val_conv.inner = (void*)(val & (~1));
13092 val_conv.is_owned = (val & 1) || (val == 0);
13093 if (val_conv.inner != NULL)
13094 val_conv = CommitmentSigned_clone(&val_conv);
13095 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
13098 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) {
13099 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
13100 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
13101 if (update_add_htlcs_arg_constr.datalen > 0)
13102 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13104 update_add_htlcs_arg_constr.data = NULL;
13105 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
13106 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
13107 int64_t arr_conv_15 = update_add_htlcs_arg_vals[p];
13108 LDKUpdateAddHTLC arr_conv_15_conv;
13109 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13110 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13111 if (arr_conv_15_conv.inner != NULL)
13112 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13113 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
13115 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
13116 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
13117 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
13118 if (update_fulfill_htlcs_arg_constr.datalen > 0)
13119 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13121 update_fulfill_htlcs_arg_constr.data = NULL;
13122 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
13123 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
13124 int64_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
13125 LDKUpdateFulfillHTLC arr_conv_19_conv;
13126 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13127 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13128 if (arr_conv_19_conv.inner != NULL)
13129 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13130 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
13132 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
13133 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
13134 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
13135 if (update_fail_htlcs_arg_constr.datalen > 0)
13136 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13138 update_fail_htlcs_arg_constr.data = NULL;
13139 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
13140 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
13141 int64_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
13142 LDKUpdateFailHTLC arr_conv_16_conv;
13143 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13144 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13145 if (arr_conv_16_conv.inner != NULL)
13146 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13147 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
13149 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
13150 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
13151 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
13152 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
13153 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13155 update_fail_malformed_htlcs_arg_constr.data = NULL;
13156 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
13157 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
13158 int64_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
13159 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13160 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13161 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13162 if (arr_conv_25_conv.inner != NULL)
13163 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13164 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
13166 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
13167 LDKUpdateFee update_fee_arg_conv;
13168 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
13169 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
13170 if (update_fee_arg_conv.inner != NULL)
13171 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
13172 LDKCommitmentSigned commitment_signed_arg_conv;
13173 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
13174 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
13175 if (commitment_signed_arg_conv.inner != NULL)
13176 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
13177 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);
13178 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13179 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13180 long ret_ref = (long)ret_var.inner;
13181 if (ret_var.is_owned) {
13187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13188 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
13189 FREE((void*)this_ptr);
13190 HTLCFailChannelUpdate_free(this_ptr_conv);
13193 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13194 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
13195 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
13196 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
13197 long ret_ref = (long)ret_copy;
13201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13202 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
13203 FREE((void*)this_ptr);
13204 ChannelMessageHandler_free(this_ptr_conv);
13207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13208 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
13209 FREE((void*)this_ptr);
13210 RoutingMessageHandler_free(this_ptr_conv);
13213 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13214 LDKAcceptChannel obj_conv;
13215 obj_conv.inner = (void*)(obj & (~1));
13216 obj_conv.is_owned = false;
13217 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
13218 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13219 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13220 CVec_u8Z_free(arg_var);
13224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13225 LDKu8slice ser_ref;
13226 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13227 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13228 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
13229 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13230 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13231 long ret_ref = (long)ret_var.inner;
13232 if (ret_var.is_owned) {
13235 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13239 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
13240 LDKAnnouncementSignatures obj_conv;
13241 obj_conv.inner = (void*)(obj & (~1));
13242 obj_conv.is_owned = false;
13243 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
13244 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13245 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13246 CVec_u8Z_free(arg_var);
13250 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13251 LDKu8slice ser_ref;
13252 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13253 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13254 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
13255 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13256 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13257 long ret_ref = (long)ret_var.inner;
13258 if (ret_var.is_owned) {
13261 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13265 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
13266 LDKChannelReestablish obj_conv;
13267 obj_conv.inner = (void*)(obj & (~1));
13268 obj_conv.is_owned = false;
13269 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
13270 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13271 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13272 CVec_u8Z_free(arg_var);
13276 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13277 LDKu8slice ser_ref;
13278 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13279 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13280 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13281 *ret_conv = ChannelReestablish_read(ser_ref);
13282 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13283 return (long)ret_conv;
13286 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13287 LDKClosingSigned obj_conv;
13288 obj_conv.inner = (void*)(obj & (~1));
13289 obj_conv.is_owned = false;
13290 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
13291 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13292 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13293 CVec_u8Z_free(arg_var);
13297 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13298 LDKu8slice ser_ref;
13299 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13300 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13301 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
13302 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13303 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13304 long ret_ref = (long)ret_var.inner;
13305 if (ret_var.is_owned) {
13308 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13312 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13313 LDKCommitmentSigned obj_conv;
13314 obj_conv.inner = (void*)(obj & (~1));
13315 obj_conv.is_owned = false;
13316 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
13317 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13318 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13319 CVec_u8Z_free(arg_var);
13323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13324 LDKu8slice ser_ref;
13325 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13326 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13327 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
13328 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13329 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13330 long ret_ref = (long)ret_var.inner;
13331 if (ret_var.is_owned) {
13334 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13338 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
13339 LDKFundingCreated obj_conv;
13340 obj_conv.inner = (void*)(obj & (~1));
13341 obj_conv.is_owned = false;
13342 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
13343 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13344 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13345 CVec_u8Z_free(arg_var);
13349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13350 LDKu8slice ser_ref;
13351 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13352 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13353 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
13354 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13355 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13356 long ret_ref = (long)ret_var.inner;
13357 if (ret_var.is_owned) {
13360 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13364 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13365 LDKFundingSigned obj_conv;
13366 obj_conv.inner = (void*)(obj & (~1));
13367 obj_conv.is_owned = false;
13368 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
13369 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13370 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13371 CVec_u8Z_free(arg_var);
13375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13376 LDKu8slice ser_ref;
13377 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13378 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13379 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
13380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13382 long ret_ref = (long)ret_var.inner;
13383 if (ret_var.is_owned) {
13386 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13390 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
13391 LDKFundingLocked obj_conv;
13392 obj_conv.inner = (void*)(obj & (~1));
13393 obj_conv.is_owned = false;
13394 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
13395 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13396 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13397 CVec_u8Z_free(arg_var);
13401 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13402 LDKu8slice ser_ref;
13403 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13404 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13405 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
13406 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13407 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13408 long ret_ref = (long)ret_var.inner;
13409 if (ret_var.is_owned) {
13412 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13416 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
13418 obj_conv.inner = (void*)(obj & (~1));
13419 obj_conv.is_owned = false;
13420 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
13421 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13422 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13423 CVec_u8Z_free(arg_var);
13427 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13428 LDKu8slice ser_ref;
13429 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13430 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13431 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13432 *ret_conv = Init_read(ser_ref);
13433 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13434 return (long)ret_conv;
13437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13438 LDKOpenChannel obj_conv;
13439 obj_conv.inner = (void*)(obj & (~1));
13440 obj_conv.is_owned = false;
13441 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
13442 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13443 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13444 CVec_u8Z_free(arg_var);
13448 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13449 LDKu8slice ser_ref;
13450 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13451 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13452 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
13453 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13454 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13455 long ret_ref = (long)ret_var.inner;
13456 if (ret_var.is_owned) {
13459 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
13464 LDKRevokeAndACK obj_conv;
13465 obj_conv.inner = (void*)(obj & (~1));
13466 obj_conv.is_owned = false;
13467 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
13468 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13469 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13470 CVec_u8Z_free(arg_var);
13474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13475 LDKu8slice ser_ref;
13476 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13477 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13478 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
13479 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13480 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13481 long ret_ref = (long)ret_var.inner;
13482 if (ret_var.is_owned) {
13485 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13489 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
13490 LDKShutdown obj_conv;
13491 obj_conv.inner = (void*)(obj & (~1));
13492 obj_conv.is_owned = false;
13493 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
13494 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13495 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13496 CVec_u8Z_free(arg_var);
13500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13501 LDKu8slice ser_ref;
13502 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13503 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13504 LDKShutdown ret_var = Shutdown_read(ser_ref);
13505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13507 long ret_ref = (long)ret_var.inner;
13508 if (ret_var.is_owned) {
13511 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13515 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13516 LDKUpdateFailHTLC obj_conv;
13517 obj_conv.inner = (void*)(obj & (~1));
13518 obj_conv.is_owned = false;
13519 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
13520 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13521 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13522 CVec_u8Z_free(arg_var);
13526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13527 LDKu8slice ser_ref;
13528 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13529 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13530 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
13531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13533 long ret_ref = (long)ret_var.inner;
13534 if (ret_var.is_owned) {
13537 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13541 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13542 LDKUpdateFailMalformedHTLC obj_conv;
13543 obj_conv.inner = (void*)(obj & (~1));
13544 obj_conv.is_owned = false;
13545 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
13546 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13547 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13548 CVec_u8Z_free(arg_var);
13552 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13553 LDKu8slice ser_ref;
13554 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13555 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13556 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
13557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13559 long ret_ref = (long)ret_var.inner;
13560 if (ret_var.is_owned) {
13563 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13567 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
13568 LDKUpdateFee obj_conv;
13569 obj_conv.inner = (void*)(obj & (~1));
13570 obj_conv.is_owned = false;
13571 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
13572 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13573 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13574 CVec_u8Z_free(arg_var);
13578 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13579 LDKu8slice ser_ref;
13580 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13581 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13582 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
13583 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13584 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13585 long ret_ref = (long)ret_var.inner;
13586 if (ret_var.is_owned) {
13589 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13594 LDKUpdateFulfillHTLC obj_conv;
13595 obj_conv.inner = (void*)(obj & (~1));
13596 obj_conv.is_owned = false;
13597 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
13598 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13599 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13600 CVec_u8Z_free(arg_var);
13604 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13605 LDKu8slice ser_ref;
13606 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13607 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13608 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
13609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13611 long ret_ref = (long)ret_var.inner;
13612 if (ret_var.is_owned) {
13615 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13619 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13620 LDKUpdateAddHTLC obj_conv;
13621 obj_conv.inner = (void*)(obj & (~1));
13622 obj_conv.is_owned = false;
13623 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
13624 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13625 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13626 CVec_u8Z_free(arg_var);
13630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13631 LDKu8slice ser_ref;
13632 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13633 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13634 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
13635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13637 long ret_ref = (long)ret_var.inner;
13638 if (ret_var.is_owned) {
13641 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13645 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
13647 obj_conv.inner = (void*)(obj & (~1));
13648 obj_conv.is_owned = false;
13649 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
13650 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13651 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13652 CVec_u8Z_free(arg_var);
13656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13657 LDKu8slice ser_ref;
13658 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13659 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13660 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13661 *ret_conv = Ping_read(ser_ref);
13662 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13663 return (long)ret_conv;
13666 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
13668 obj_conv.inner = (void*)(obj & (~1));
13669 obj_conv.is_owned = false;
13670 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
13671 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13672 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13673 CVec_u8Z_free(arg_var);
13677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13678 LDKu8slice ser_ref;
13679 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13680 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13681 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13682 *ret_conv = Pong_read(ser_ref);
13683 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13684 return (long)ret_conv;
13687 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13688 LDKUnsignedChannelAnnouncement obj_conv;
13689 obj_conv.inner = (void*)(obj & (~1));
13690 obj_conv.is_owned = false;
13691 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
13692 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13693 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13694 CVec_u8Z_free(arg_var);
13698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13699 LDKu8slice ser_ref;
13700 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13701 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13702 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13703 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
13704 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13705 return (long)ret_conv;
13708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13709 LDKChannelAnnouncement obj_conv;
13710 obj_conv.inner = (void*)(obj & (~1));
13711 obj_conv.is_owned = false;
13712 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
13713 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13714 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13715 CVec_u8Z_free(arg_var);
13719 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13720 LDKu8slice ser_ref;
13721 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13722 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13723 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
13724 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13725 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13726 long ret_ref = (long)ret_var.inner;
13727 if (ret_var.is_owned) {
13730 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13734 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13735 LDKUnsignedChannelUpdate obj_conv;
13736 obj_conv.inner = (void*)(obj & (~1));
13737 obj_conv.is_owned = false;
13738 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
13739 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13740 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13741 CVec_u8Z_free(arg_var);
13745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13746 LDKu8slice ser_ref;
13747 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13748 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13749 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13750 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
13751 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13752 return (long)ret_conv;
13755 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13756 LDKChannelUpdate obj_conv;
13757 obj_conv.inner = (void*)(obj & (~1));
13758 obj_conv.is_owned = false;
13759 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
13760 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13761 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13762 CVec_u8Z_free(arg_var);
13766 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13767 LDKu8slice ser_ref;
13768 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13769 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13770 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
13771 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13772 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13773 long ret_ref = (long)ret_var.inner;
13774 if (ret_var.is_owned) {
13777 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
13782 LDKErrorMessage obj_conv;
13783 obj_conv.inner = (void*)(obj & (~1));
13784 obj_conv.is_owned = false;
13785 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
13786 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13787 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13788 CVec_u8Z_free(arg_var);
13792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13793 LDKu8slice ser_ref;
13794 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13795 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13796 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13797 *ret_conv = ErrorMessage_read(ser_ref);
13798 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13799 return (long)ret_conv;
13802 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13803 LDKUnsignedNodeAnnouncement obj_conv;
13804 obj_conv.inner = (void*)(obj & (~1));
13805 obj_conv.is_owned = false;
13806 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
13807 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13808 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13809 CVec_u8Z_free(arg_var);
13813 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13814 LDKu8slice ser_ref;
13815 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13816 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13817 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13818 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
13819 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13820 return (long)ret_conv;
13823 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13824 LDKNodeAnnouncement obj_conv;
13825 obj_conv.inner = (void*)(obj & (~1));
13826 obj_conv.is_owned = false;
13827 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
13828 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13829 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13830 CVec_u8Z_free(arg_var);
13834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13835 LDKu8slice ser_ref;
13836 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13837 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13838 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
13839 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13840 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13841 long ret_ref = (long)ret_var.inner;
13842 if (ret_var.is_owned) {
13845 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13849 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13850 LDKu8slice ser_ref;
13851 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13852 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13853 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13854 *ret_conv = QueryShortChannelIds_read(ser_ref);
13855 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13856 return (long)ret_conv;
13859 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
13860 LDKQueryShortChannelIds obj_conv;
13861 obj_conv.inner = (void*)(obj & (~1));
13862 obj_conv.is_owned = false;
13863 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
13864 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13865 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13866 CVec_u8Z_free(arg_var);
13870 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13871 LDKu8slice ser_ref;
13872 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13873 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13874 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13875 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
13876 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13877 return (long)ret_conv;
13880 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
13881 LDKReplyShortChannelIdsEnd obj_conv;
13882 obj_conv.inner = (void*)(obj & (~1));
13883 obj_conv.is_owned = false;
13884 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
13885 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13886 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13887 CVec_u8Z_free(arg_var);
13891 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13892 LDKu8slice ser_ref;
13893 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13894 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13895 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13896 *ret_conv = QueryChannelRange_read(ser_ref);
13897 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13898 return (long)ret_conv;
13901 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
13902 LDKQueryChannelRange obj_conv;
13903 obj_conv.inner = (void*)(obj & (~1));
13904 obj_conv.is_owned = false;
13905 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
13906 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13907 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13908 CVec_u8Z_free(arg_var);
13912 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13913 LDKu8slice ser_ref;
13914 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13915 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13916 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13917 *ret_conv = ReplyChannelRange_read(ser_ref);
13918 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13919 return (long)ret_conv;
13922 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
13923 LDKReplyChannelRange obj_conv;
13924 obj_conv.inner = (void*)(obj & (~1));
13925 obj_conv.is_owned = false;
13926 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
13927 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13928 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13929 CVec_u8Z_free(arg_var);
13933 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13934 LDKu8slice ser_ref;
13935 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13936 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13937 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13938 *ret_conv = GossipTimestampFilter_read(ser_ref);
13939 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13940 return (long)ret_conv;
13943 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
13944 LDKGossipTimestampFilter obj_conv;
13945 obj_conv.inner = (void*)(obj & (~1));
13946 obj_conv.is_owned = false;
13947 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
13948 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13949 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13950 CVec_u8Z_free(arg_var);
13954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13955 LDKMessageHandler this_ptr_conv;
13956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13957 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13958 MessageHandler_free(this_ptr_conv);
13961 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
13962 LDKMessageHandler this_ptr_conv;
13963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13964 this_ptr_conv.is_owned = false;
13965 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
13969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13970 LDKMessageHandler this_ptr_conv;
13971 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13972 this_ptr_conv.is_owned = false;
13973 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
13974 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
13975 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13976 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
13978 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
13981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
13982 LDKMessageHandler this_ptr_conv;
13983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13984 this_ptr_conv.is_owned = false;
13985 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
13989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13990 LDKMessageHandler this_ptr_conv;
13991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13992 this_ptr_conv.is_owned = false;
13993 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
13994 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
13995 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13996 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
13998 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
14001 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) {
14002 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
14003 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
14004 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14005 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
14007 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
14008 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
14009 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14010 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
14012 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
14013 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14014 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14015 long ret_ref = (long)ret_var.inner;
14016 if (ret_var.is_owned) {
14022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14023 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
14024 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14025 *ret = SocketDescriptor_clone(orig_conv);
14029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14030 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
14031 FREE((void*)this_ptr);
14032 SocketDescriptor_free(this_ptr_conv);
14035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14036 LDKPeerHandleError this_ptr_conv;
14037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14039 PeerHandleError_free(this_ptr_conv);
14042 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
14043 LDKPeerHandleError this_ptr_conv;
14044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14045 this_ptr_conv.is_owned = false;
14046 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
14050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14051 LDKPeerHandleError this_ptr_conv;
14052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14053 this_ptr_conv.is_owned = false;
14054 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
14057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
14058 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
14059 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14060 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14061 long ret_ref = (long)ret_var.inner;
14062 if (ret_var.is_owned) {
14068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14069 LDKPeerManager this_ptr_conv;
14070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14072 PeerManager_free(this_ptr_conv);
14075 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) {
14076 LDKMessageHandler message_handler_conv;
14077 message_handler_conv.inner = (void*)(message_handler & (~1));
14078 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
14079 // Warning: we may need a move here but can't clone!
14080 LDKSecretKey our_node_secret_ref;
14081 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
14082 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
14083 unsigned char ephemeral_random_data_arr[32];
14084 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
14085 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
14086 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
14087 LDKLogger logger_conv = *(LDKLogger*)logger;
14088 if (logger_conv.free == LDKLogger_JCalls_free) {
14089 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14090 LDKLogger_JCalls_clone(logger_conv.this_arg);
14092 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
14093 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14094 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14095 long ret_ref = (long)ret_var.inner;
14096 if (ret_var.is_owned) {
14102 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
14103 LDKPeerManager this_arg_conv;
14104 this_arg_conv.inner = (void*)(this_arg & (~1));
14105 this_arg_conv.is_owned = false;
14106 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
14107 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14109 for (size_t i = 0; i < ret_var.datalen; i++) {
14110 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 33);
14111 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
14112 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
14114 FREE(ret_var.data);
14118 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) {
14119 LDKPeerManager this_arg_conv;
14120 this_arg_conv.inner = (void*)(this_arg & (~1));
14121 this_arg_conv.is_owned = false;
14122 LDKPublicKey their_node_id_ref;
14123 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14124 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14125 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
14126 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14127 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14128 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14130 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
14131 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
14132 return (long)ret_conv;
14135 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14136 LDKPeerManager this_arg_conv;
14137 this_arg_conv.inner = (void*)(this_arg & (~1));
14138 this_arg_conv.is_owned = false;
14139 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
14140 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14141 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14142 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14144 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14145 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
14146 return (long)ret_conv;
14149 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) {
14150 LDKPeerManager this_arg_conv;
14151 this_arg_conv.inner = (void*)(this_arg & (~1));
14152 this_arg_conv.is_owned = false;
14153 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14154 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14155 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
14156 return (long)ret_conv;
14159 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) {
14160 LDKPeerManager this_arg_conv;
14161 this_arg_conv.inner = (void*)(this_arg & (~1));
14162 this_arg_conv.is_owned = false;
14163 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
14164 LDKu8slice data_ref;
14165 data_ref.datalen = (*env)->GetArrayLength(env, data);
14166 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
14167 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14168 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
14169 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
14170 return (long)ret_conv;
14173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14174 LDKPeerManager this_arg_conv;
14175 this_arg_conv.inner = (void*)(this_arg & (~1));
14176 this_arg_conv.is_owned = false;
14177 PeerManager_process_events(&this_arg_conv);
14180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14181 LDKPeerManager this_arg_conv;
14182 this_arg_conv.inner = (void*)(this_arg & (~1));
14183 this_arg_conv.is_owned = false;
14184 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14185 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
14188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv *env, jclass clz, int64_t this_arg) {
14189 LDKPeerManager this_arg_conv;
14190 this_arg_conv.inner = (void*)(this_arg & (~1));
14191 this_arg_conv.is_owned = false;
14192 PeerManager_timer_tick_occured(&this_arg_conv);
14195 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
14196 unsigned char commitment_seed_arr[32];
14197 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14198 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
14199 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
14200 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
14201 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
14205 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) {
14206 LDKPublicKey per_commitment_point_ref;
14207 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14208 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14209 unsigned char base_secret_arr[32];
14210 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
14211 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
14212 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
14213 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14214 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
14215 return (long)ret_conv;
14218 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) {
14219 LDKPublicKey per_commitment_point_ref;
14220 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14221 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14222 LDKPublicKey base_point_ref;
14223 CHECK((*env)->GetArrayLength(env, base_point) == 33);
14224 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
14225 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14226 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
14227 return (long)ret_conv;
14230 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) {
14231 unsigned char per_commitment_secret_arr[32];
14232 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
14233 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
14234 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
14235 unsigned char countersignatory_revocation_base_secret_arr[32];
14236 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
14237 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
14238 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
14239 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14240 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
14241 return (long)ret_conv;
14244 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) {
14245 LDKPublicKey per_commitment_point_ref;
14246 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14247 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14248 LDKPublicKey countersignatory_revocation_base_point_ref;
14249 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
14250 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
14251 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14252 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
14253 return (long)ret_conv;
14256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14257 LDKTxCreationKeys this_ptr_conv;
14258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14259 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14260 TxCreationKeys_free(this_ptr_conv);
14263 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14264 LDKTxCreationKeys orig_conv;
14265 orig_conv.inner = (void*)(orig & (~1));
14266 orig_conv.is_owned = false;
14267 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
14268 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14269 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14270 long ret_ref = (long)ret_var.inner;
14271 if (ret_var.is_owned) {
14277 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14278 LDKTxCreationKeys this_ptr_conv;
14279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14280 this_ptr_conv.is_owned = false;
14281 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14282 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
14286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14287 LDKTxCreationKeys this_ptr_conv;
14288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14289 this_ptr_conv.is_owned = false;
14290 LDKPublicKey val_ref;
14291 CHECK((*env)->GetArrayLength(env, val) == 33);
14292 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14293 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
14296 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14297 LDKTxCreationKeys this_ptr_conv;
14298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14299 this_ptr_conv.is_owned = false;
14300 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14301 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
14305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14306 LDKTxCreationKeys this_ptr_conv;
14307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14308 this_ptr_conv.is_owned = false;
14309 LDKPublicKey val_ref;
14310 CHECK((*env)->GetArrayLength(env, val) == 33);
14311 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14312 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
14315 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14316 LDKTxCreationKeys this_ptr_conv;
14317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14318 this_ptr_conv.is_owned = false;
14319 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14320 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
14324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14325 LDKTxCreationKeys this_ptr_conv;
14326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14327 this_ptr_conv.is_owned = false;
14328 LDKPublicKey val_ref;
14329 CHECK((*env)->GetArrayLength(env, val) == 33);
14330 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14331 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
14334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14335 LDKTxCreationKeys this_ptr_conv;
14336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14337 this_ptr_conv.is_owned = false;
14338 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14339 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
14343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14344 LDKTxCreationKeys this_ptr_conv;
14345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14346 this_ptr_conv.is_owned = false;
14347 LDKPublicKey val_ref;
14348 CHECK((*env)->GetArrayLength(env, val) == 33);
14349 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14350 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
14353 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14354 LDKTxCreationKeys this_ptr_conv;
14355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14356 this_ptr_conv.is_owned = false;
14357 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14358 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
14362 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) {
14363 LDKTxCreationKeys this_ptr_conv;
14364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14365 this_ptr_conv.is_owned = false;
14366 LDKPublicKey val_ref;
14367 CHECK((*env)->GetArrayLength(env, val) == 33);
14368 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14369 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
14372 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) {
14373 LDKPublicKey per_commitment_point_arg_ref;
14374 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14375 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14376 LDKPublicKey revocation_key_arg_ref;
14377 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
14378 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
14379 LDKPublicKey broadcaster_htlc_key_arg_ref;
14380 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
14381 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
14382 LDKPublicKey countersignatory_htlc_key_arg_ref;
14383 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
14384 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
14385 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
14386 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
14387 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
14388 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);
14389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14391 long ret_ref = (long)ret_var.inner;
14392 if (ret_var.is_owned) {
14398 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14399 LDKTxCreationKeys obj_conv;
14400 obj_conv.inner = (void*)(obj & (~1));
14401 obj_conv.is_owned = false;
14402 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
14403 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14404 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14405 CVec_u8Z_free(arg_var);
14409 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14410 LDKu8slice ser_ref;
14411 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14412 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14413 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
14414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14416 long ret_ref = (long)ret_var.inner;
14417 if (ret_var.is_owned) {
14420 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14425 LDKChannelPublicKeys this_ptr_conv;
14426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14428 ChannelPublicKeys_free(this_ptr_conv);
14431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14432 LDKChannelPublicKeys orig_conv;
14433 orig_conv.inner = (void*)(orig & (~1));
14434 orig_conv.is_owned = false;
14435 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
14436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14438 long ret_ref = (long)ret_var.inner;
14439 if (ret_var.is_owned) {
14445 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14446 LDKChannelPublicKeys this_ptr_conv;
14447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14448 this_ptr_conv.is_owned = false;
14449 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14450 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
14454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14455 LDKChannelPublicKeys this_ptr_conv;
14456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14457 this_ptr_conv.is_owned = false;
14458 LDKPublicKey val_ref;
14459 CHECK((*env)->GetArrayLength(env, val) == 33);
14460 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14461 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
14464 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14465 LDKChannelPublicKeys this_ptr_conv;
14466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14467 this_ptr_conv.is_owned = false;
14468 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14469 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
14473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14474 LDKChannelPublicKeys this_ptr_conv;
14475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14476 this_ptr_conv.is_owned = false;
14477 LDKPublicKey val_ref;
14478 CHECK((*env)->GetArrayLength(env, val) == 33);
14479 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14480 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
14483 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14484 LDKChannelPublicKeys this_ptr_conv;
14485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14486 this_ptr_conv.is_owned = false;
14487 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14488 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
14492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14493 LDKChannelPublicKeys this_ptr_conv;
14494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14495 this_ptr_conv.is_owned = false;
14496 LDKPublicKey val_ref;
14497 CHECK((*env)->GetArrayLength(env, val) == 33);
14498 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14499 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
14502 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14503 LDKChannelPublicKeys this_ptr_conv;
14504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14505 this_ptr_conv.is_owned = false;
14506 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14507 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
14511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14512 LDKChannelPublicKeys this_ptr_conv;
14513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14514 this_ptr_conv.is_owned = false;
14515 LDKPublicKey val_ref;
14516 CHECK((*env)->GetArrayLength(env, val) == 33);
14517 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14518 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
14521 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14522 LDKChannelPublicKeys this_ptr_conv;
14523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14524 this_ptr_conv.is_owned = false;
14525 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14526 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
14530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14531 LDKChannelPublicKeys this_ptr_conv;
14532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14533 this_ptr_conv.is_owned = false;
14534 LDKPublicKey val_ref;
14535 CHECK((*env)->GetArrayLength(env, val) == 33);
14536 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14537 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
14540 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) {
14541 LDKPublicKey funding_pubkey_arg_ref;
14542 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
14543 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
14544 LDKPublicKey revocation_basepoint_arg_ref;
14545 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
14546 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
14547 LDKPublicKey payment_point_arg_ref;
14548 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
14549 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
14550 LDKPublicKey delayed_payment_basepoint_arg_ref;
14551 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
14552 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
14553 LDKPublicKey htlc_basepoint_arg_ref;
14554 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
14555 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
14556 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);
14557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14559 long ret_ref = (long)ret_var.inner;
14560 if (ret_var.is_owned) {
14566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14567 LDKChannelPublicKeys obj_conv;
14568 obj_conv.inner = (void*)(obj & (~1));
14569 obj_conv.is_owned = false;
14570 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
14571 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14572 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14573 CVec_u8Z_free(arg_var);
14577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14578 LDKu8slice ser_ref;
14579 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14580 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14581 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
14582 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14583 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14584 long ret_ref = (long)ret_var.inner;
14585 if (ret_var.is_owned) {
14588 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14592 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) {
14593 LDKPublicKey per_commitment_point_ref;
14594 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14595 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14596 LDKPublicKey broadcaster_delayed_payment_base_ref;
14597 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
14598 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
14599 LDKPublicKey broadcaster_htlc_base_ref;
14600 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
14601 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
14602 LDKPublicKey countersignatory_revocation_base_ref;
14603 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
14604 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
14605 LDKPublicKey countersignatory_htlc_base_ref;
14606 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
14607 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
14608 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14609 *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);
14610 return (long)ret_conv;
14613 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) {
14614 LDKPublicKey per_commitment_point_ref;
14615 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14616 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14617 LDKChannelPublicKeys broadcaster_keys_conv;
14618 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
14619 broadcaster_keys_conv.is_owned = false;
14620 LDKChannelPublicKeys countersignatory_keys_conv;
14621 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
14622 countersignatory_keys_conv.is_owned = false;
14623 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14624 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
14625 return (long)ret_conv;
14628 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) {
14629 LDKPublicKey revocation_key_ref;
14630 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14631 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14632 LDKPublicKey broadcaster_delayed_payment_key_ref;
14633 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14634 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14635 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
14636 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14637 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14638 CVec_u8Z_free(arg_var);
14642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14643 LDKHTLCOutputInCommitment this_ptr_conv;
14644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14646 HTLCOutputInCommitment_free(this_ptr_conv);
14649 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14650 LDKHTLCOutputInCommitment orig_conv;
14651 orig_conv.inner = (void*)(orig & (~1));
14652 orig_conv.is_owned = false;
14653 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
14654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14656 long ret_ref = (long)ret_var.inner;
14657 if (ret_var.is_owned) {
14663 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
14664 LDKHTLCOutputInCommitment this_ptr_conv;
14665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14666 this_ptr_conv.is_owned = false;
14667 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
14671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14672 LDKHTLCOutputInCommitment this_ptr_conv;
14673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14674 this_ptr_conv.is_owned = false;
14675 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
14678 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14679 LDKHTLCOutputInCommitment this_ptr_conv;
14680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14681 this_ptr_conv.is_owned = false;
14682 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
14686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14687 LDKHTLCOutputInCommitment this_ptr_conv;
14688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14689 this_ptr_conv.is_owned = false;
14690 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
14693 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
14694 LDKHTLCOutputInCommitment this_ptr_conv;
14695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14696 this_ptr_conv.is_owned = false;
14697 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
14701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14702 LDKHTLCOutputInCommitment this_ptr_conv;
14703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14704 this_ptr_conv.is_owned = false;
14705 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
14708 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14709 LDKHTLCOutputInCommitment this_ptr_conv;
14710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14711 this_ptr_conv.is_owned = false;
14712 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14713 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
14717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14718 LDKHTLCOutputInCommitment this_ptr_conv;
14719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14720 this_ptr_conv.is_owned = false;
14721 LDKThirtyTwoBytes val_ref;
14722 CHECK((*env)->GetArrayLength(env, val) == 32);
14723 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14724 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
14727 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
14728 LDKHTLCOutputInCommitment obj_conv;
14729 obj_conv.inner = (void*)(obj & (~1));
14730 obj_conv.is_owned = false;
14731 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
14732 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14733 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14734 CVec_u8Z_free(arg_var);
14738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14739 LDKu8slice ser_ref;
14740 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14741 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14742 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
14743 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14744 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14745 long ret_ref = (long)ret_var.inner;
14746 if (ret_var.is_owned) {
14749 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14753 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
14754 LDKHTLCOutputInCommitment htlc_conv;
14755 htlc_conv.inner = (void*)(htlc & (~1));
14756 htlc_conv.is_owned = false;
14757 LDKTxCreationKeys keys_conv;
14758 keys_conv.inner = (void*)(keys & (~1));
14759 keys_conv.is_owned = false;
14760 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
14761 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14762 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14763 CVec_u8Z_free(arg_var);
14767 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
14768 LDKPublicKey broadcaster_ref;
14769 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
14770 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
14771 LDKPublicKey countersignatory_ref;
14772 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
14773 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
14774 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
14775 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14776 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14777 CVec_u8Z_free(arg_var);
14781 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray prev_hash, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) {
14782 unsigned char prev_hash_arr[32];
14783 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
14784 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
14785 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
14786 LDKHTLCOutputInCommitment htlc_conv;
14787 htlc_conv.inner = (void*)(htlc & (~1));
14788 htlc_conv.is_owned = false;
14789 LDKPublicKey broadcaster_delayed_payment_key_ref;
14790 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14791 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14792 LDKPublicKey revocation_key_ref;
14793 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14794 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14795 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
14796 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14797 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14798 Transaction_free(arg_var);
14802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14803 LDKChannelTransactionParameters this_ptr_conv;
14804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14806 ChannelTransactionParameters_free(this_ptr_conv);
14809 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14810 LDKChannelTransactionParameters orig_conv;
14811 orig_conv.inner = (void*)(orig & (~1));
14812 orig_conv.is_owned = false;
14813 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
14814 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14815 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14816 long ret_ref = (long)ret_var.inner;
14817 if (ret_var.is_owned) {
14823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
14824 LDKChannelTransactionParameters this_ptr_conv;
14825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14826 this_ptr_conv.is_owned = false;
14827 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
14828 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14829 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14830 long ret_ref = (long)ret_var.inner;
14831 if (ret_var.is_owned) {
14837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14838 LDKChannelTransactionParameters this_ptr_conv;
14839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14840 this_ptr_conv.is_owned = false;
14841 LDKChannelPublicKeys val_conv;
14842 val_conv.inner = (void*)(val & (~1));
14843 val_conv.is_owned = (val & 1) || (val == 0);
14844 if (val_conv.inner != NULL)
14845 val_conv = ChannelPublicKeys_clone(&val_conv);
14846 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
14849 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14850 LDKChannelTransactionParameters this_ptr_conv;
14851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14852 this_ptr_conv.is_owned = false;
14853 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
14857 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) {
14858 LDKChannelTransactionParameters this_ptr_conv;
14859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14860 this_ptr_conv.is_owned = false;
14861 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
14864 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
14865 LDKChannelTransactionParameters this_ptr_conv;
14866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14867 this_ptr_conv.is_owned = false;
14868 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
14872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14873 LDKChannelTransactionParameters this_ptr_conv;
14874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14875 this_ptr_conv.is_owned = false;
14876 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
14879 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
14880 LDKChannelTransactionParameters this_ptr_conv;
14881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14882 this_ptr_conv.is_owned = false;
14883 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
14884 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14885 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14886 long ret_ref = (long)ret_var.inner;
14887 if (ret_var.is_owned) {
14893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14894 LDKChannelTransactionParameters this_ptr_conv;
14895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14896 this_ptr_conv.is_owned = false;
14897 LDKCounterpartyChannelTransactionParameters val_conv;
14898 val_conv.inner = (void*)(val & (~1));
14899 val_conv.is_owned = (val & 1) || (val == 0);
14900 if (val_conv.inner != NULL)
14901 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
14902 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
14905 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14906 LDKChannelTransactionParameters this_ptr_conv;
14907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14908 this_ptr_conv.is_owned = false;
14909 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
14910 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14911 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14912 long ret_ref = (long)ret_var.inner;
14913 if (ret_var.is_owned) {
14919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14920 LDKChannelTransactionParameters this_ptr_conv;
14921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14922 this_ptr_conv.is_owned = false;
14923 LDKOutPoint val_conv;
14924 val_conv.inner = (void*)(val & (~1));
14925 val_conv.is_owned = (val & 1) || (val == 0);
14926 if (val_conv.inner != NULL)
14927 val_conv = OutPoint_clone(&val_conv);
14928 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
14931 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) {
14932 LDKChannelPublicKeys holder_pubkeys_arg_conv;
14933 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
14934 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
14935 if (holder_pubkeys_arg_conv.inner != NULL)
14936 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
14937 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
14938 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
14939 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
14940 if (counterparty_parameters_arg_conv.inner != NULL)
14941 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
14942 LDKOutPoint funding_outpoint_arg_conv;
14943 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
14944 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
14945 if (funding_outpoint_arg_conv.inner != NULL)
14946 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
14947 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);
14948 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14949 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14950 long ret_ref = (long)ret_var.inner;
14951 if (ret_var.is_owned) {
14957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14958 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14961 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
14964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14965 LDKCounterpartyChannelTransactionParameters orig_conv;
14966 orig_conv.inner = (void*)(orig & (~1));
14967 orig_conv.is_owned = false;
14968 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
14969 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14970 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14971 long ret_ref = (long)ret_var.inner;
14972 if (ret_var.is_owned) {
14978 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
14979 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14981 this_ptr_conv.is_owned = false;
14982 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
14983 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14984 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14985 long ret_ref = (long)ret_var.inner;
14986 if (ret_var.is_owned) {
14992 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14993 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14995 this_ptr_conv.is_owned = false;
14996 LDKChannelPublicKeys val_conv;
14997 val_conv.inner = (void*)(val & (~1));
14998 val_conv.is_owned = (val & 1) || (val == 0);
14999 if (val_conv.inner != NULL)
15000 val_conv = ChannelPublicKeys_clone(&val_conv);
15001 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
15004 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15005 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15007 this_ptr_conv.is_owned = false;
15008 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
15012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15013 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15015 this_ptr_conv.is_owned = false;
15016 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
15019 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) {
15020 LDKChannelPublicKeys pubkeys_arg_conv;
15021 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
15022 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
15023 if (pubkeys_arg_conv.inner != NULL)
15024 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
15025 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
15026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15028 long ret_ref = (long)ret_var.inner;
15029 if (ret_var.is_owned) {
15035 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
15036 LDKChannelTransactionParameters this_arg_conv;
15037 this_arg_conv.inner = (void*)(this_arg & (~1));
15038 this_arg_conv.is_owned = false;
15039 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
15043 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15044 LDKChannelTransactionParameters this_arg_conv;
15045 this_arg_conv.inner = (void*)(this_arg & (~1));
15046 this_arg_conv.is_owned = false;
15047 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
15048 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15049 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15050 long ret_ref = (long)ret_var.inner;
15051 if (ret_var.is_owned) {
15057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15058 LDKChannelTransactionParameters this_arg_conv;
15059 this_arg_conv.inner = (void*)(this_arg & (~1));
15060 this_arg_conv.is_owned = false;
15061 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
15062 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15063 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15064 long ret_ref = (long)ret_var.inner;
15065 if (ret_var.is_owned) {
15071 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15072 LDKCounterpartyChannelTransactionParameters obj_conv;
15073 obj_conv.inner = (void*)(obj & (~1));
15074 obj_conv.is_owned = false;
15075 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
15076 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15077 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15078 CVec_u8Z_free(arg_var);
15082 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15083 LDKu8slice ser_ref;
15084 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15085 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15086 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
15087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15089 long ret_ref = (long)ret_var.inner;
15090 if (ret_var.is_owned) {
15093 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15097 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15098 LDKChannelTransactionParameters obj_conv;
15099 obj_conv.inner = (void*)(obj & (~1));
15100 obj_conv.is_owned = false;
15101 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
15102 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15103 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15104 CVec_u8Z_free(arg_var);
15108 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15109 LDKu8slice ser_ref;
15110 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15111 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15112 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
15113 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15114 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15115 long ret_ref = (long)ret_var.inner;
15116 if (ret_var.is_owned) {
15119 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15124 LDKDirectedChannelTransactionParameters this_ptr_conv;
15125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15127 DirectedChannelTransactionParameters_free(this_ptr_conv);
15130 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15131 LDKDirectedChannelTransactionParameters this_arg_conv;
15132 this_arg_conv.inner = (void*)(this_arg & (~1));
15133 this_arg_conv.is_owned = false;
15134 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
15135 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15136 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15137 long ret_ref = (long)ret_var.inner;
15138 if (ret_var.is_owned) {
15144 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15145 LDKDirectedChannelTransactionParameters this_arg_conv;
15146 this_arg_conv.inner = (void*)(this_arg & (~1));
15147 this_arg_conv.is_owned = false;
15148 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
15149 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15150 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15151 long ret_ref = (long)ret_var.inner;
15152 if (ret_var.is_owned) {
15158 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15159 LDKDirectedChannelTransactionParameters this_arg_conv;
15160 this_arg_conv.inner = (void*)(this_arg & (~1));
15161 this_arg_conv.is_owned = false;
15162 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
15166 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
15167 LDKDirectedChannelTransactionParameters this_arg_conv;
15168 this_arg_conv.inner = (void*)(this_arg & (~1));
15169 this_arg_conv.is_owned = false;
15170 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
15174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
15175 LDKDirectedChannelTransactionParameters this_arg_conv;
15176 this_arg_conv.inner = (void*)(this_arg & (~1));
15177 this_arg_conv.is_owned = false;
15178 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
15179 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15180 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15181 long ret_ref = (long)ret_var.inner;
15182 if (ret_var.is_owned) {
15188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15189 LDKHolderCommitmentTransaction this_ptr_conv;
15190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15192 HolderCommitmentTransaction_free(this_ptr_conv);
15195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15196 LDKHolderCommitmentTransaction orig_conv;
15197 orig_conv.inner = (void*)(orig & (~1));
15198 orig_conv.is_owned = false;
15199 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
15200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15202 long ret_ref = (long)ret_var.inner;
15203 if (ret_var.is_owned) {
15209 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
15210 LDKHolderCommitmentTransaction this_ptr_conv;
15211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15212 this_ptr_conv.is_owned = false;
15213 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15214 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
15218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15219 LDKHolderCommitmentTransaction this_ptr_conv;
15220 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15221 this_ptr_conv.is_owned = false;
15222 LDKSignature val_ref;
15223 CHECK((*env)->GetArrayLength(env, val) == 64);
15224 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15225 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
15228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15229 LDKHolderCommitmentTransaction this_ptr_conv;
15230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15231 this_ptr_conv.is_owned = false;
15232 LDKCVec_SignatureZ val_constr;
15233 val_constr.datalen = (*env)->GetArrayLength(env, val);
15234 if (val_constr.datalen > 0)
15235 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15237 val_constr.data = NULL;
15238 for (size_t i = 0; i < val_constr.datalen; i++) {
15239 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
15240 LDKSignature arr_conv_8_ref;
15241 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15242 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15243 val_constr.data[i] = arr_conv_8_ref;
15245 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
15248 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15249 LDKHolderCommitmentTransaction obj_conv;
15250 obj_conv.inner = (void*)(obj & (~1));
15251 obj_conv.is_owned = false;
15252 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
15253 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15254 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15255 CVec_u8Z_free(arg_var);
15259 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15260 LDKu8slice ser_ref;
15261 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15262 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15263 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
15264 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15265 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15266 long ret_ref = (long)ret_var.inner;
15267 if (ret_var.is_owned) {
15270 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15274 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) {
15275 LDKCommitmentTransaction commitment_tx_conv;
15276 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
15277 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
15278 if (commitment_tx_conv.inner != NULL)
15279 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
15280 LDKSignature counterparty_sig_ref;
15281 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
15282 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
15283 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
15284 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
15285 if (counterparty_htlc_sigs_constr.datalen > 0)
15286 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15288 counterparty_htlc_sigs_constr.data = NULL;
15289 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
15290 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
15291 LDKSignature arr_conv_8_ref;
15292 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15293 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15294 counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref;
15296 LDKPublicKey holder_funding_key_ref;
15297 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
15298 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
15299 LDKPublicKey counterparty_funding_key_ref;
15300 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
15301 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
15302 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
15303 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15304 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15305 long ret_ref = (long)ret_var.inner;
15306 if (ret_var.is_owned) {
15312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15313 LDKBuiltCommitmentTransaction this_ptr_conv;
15314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15316 BuiltCommitmentTransaction_free(this_ptr_conv);
15319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15320 LDKBuiltCommitmentTransaction orig_conv;
15321 orig_conv.inner = (void*)(orig & (~1));
15322 orig_conv.is_owned = false;
15323 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
15324 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15325 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15326 long ret_ref = (long)ret_var.inner;
15327 if (ret_var.is_owned) {
15333 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
15334 LDKBuiltCommitmentTransaction this_ptr_conv;
15335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15336 this_ptr_conv.is_owned = false;
15337 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
15338 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15339 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15340 Transaction_free(arg_var);
15344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15345 LDKBuiltCommitmentTransaction this_ptr_conv;
15346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15347 this_ptr_conv.is_owned = false;
15348 LDKTransaction val_ref;
15349 val_ref.datalen = (*env)->GetArrayLength(env, val);
15350 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
15351 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
15352 val_ref.data_is_owned = true;
15353 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
15356 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
15357 LDKBuiltCommitmentTransaction this_ptr_conv;
15358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15359 this_ptr_conv.is_owned = false;
15360 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15361 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
15365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15366 LDKBuiltCommitmentTransaction this_ptr_conv;
15367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15368 this_ptr_conv.is_owned = false;
15369 LDKThirtyTwoBytes val_ref;
15370 CHECK((*env)->GetArrayLength(env, val) == 32);
15371 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15372 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
15375 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
15376 LDKTransaction transaction_arg_ref;
15377 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
15378 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
15379 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
15380 transaction_arg_ref.data_is_owned = true;
15381 LDKThirtyTwoBytes txid_arg_ref;
15382 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
15383 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
15384 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
15385 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15386 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15387 long ret_ref = (long)ret_var.inner;
15388 if (ret_var.is_owned) {
15394 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15395 LDKBuiltCommitmentTransaction obj_conv;
15396 obj_conv.inner = (void*)(obj & (~1));
15397 obj_conv.is_owned = false;
15398 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
15399 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15400 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15401 CVec_u8Z_free(arg_var);
15405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15406 LDKu8slice ser_ref;
15407 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15408 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15409 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
15410 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15411 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15412 long ret_ref = (long)ret_var.inner;
15413 if (ret_var.is_owned) {
15416 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15420 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) {
15421 LDKBuiltCommitmentTransaction this_arg_conv;
15422 this_arg_conv.inner = (void*)(this_arg & (~1));
15423 this_arg_conv.is_owned = false;
15424 LDKu8slice funding_redeemscript_ref;
15425 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15426 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15427 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15428 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
15429 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15433 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) {
15434 LDKBuiltCommitmentTransaction this_arg_conv;
15435 this_arg_conv.inner = (void*)(this_arg & (~1));
15436 this_arg_conv.is_owned = false;
15437 unsigned char funding_key_arr[32];
15438 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
15439 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
15440 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
15441 LDKu8slice funding_redeemscript_ref;
15442 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15443 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15444 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15445 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
15446 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15451 LDKCommitmentTransaction this_ptr_conv;
15452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15454 CommitmentTransaction_free(this_ptr_conv);
15457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15458 LDKCommitmentTransaction orig_conv;
15459 orig_conv.inner = (void*)(orig & (~1));
15460 orig_conv.is_owned = false;
15461 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
15462 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15463 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15464 long ret_ref = (long)ret_var.inner;
15465 if (ret_var.is_owned) {
15471 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15472 LDKCommitmentTransaction obj_conv;
15473 obj_conv.inner = (void*)(obj & (~1));
15474 obj_conv.is_owned = false;
15475 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
15476 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15477 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15478 CVec_u8Z_free(arg_var);
15482 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15483 LDKu8slice ser_ref;
15484 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15485 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15486 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
15487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15489 long ret_ref = (long)ret_var.inner;
15490 if (ret_var.is_owned) {
15493 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15497 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
15498 LDKCommitmentTransaction this_arg_conv;
15499 this_arg_conv.inner = (void*)(this_arg & (~1));
15500 this_arg_conv.is_owned = false;
15501 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
15505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15506 LDKCommitmentTransaction this_arg_conv;
15507 this_arg_conv.inner = (void*)(this_arg & (~1));
15508 this_arg_conv.is_owned = false;
15509 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
15513 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15514 LDKCommitmentTransaction this_arg_conv;
15515 this_arg_conv.inner = (void*)(this_arg & (~1));
15516 this_arg_conv.is_owned = false;
15517 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
15521 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
15522 LDKCommitmentTransaction this_arg_conv;
15523 this_arg_conv.inner = (void*)(this_arg & (~1));
15524 this_arg_conv.is_owned = false;
15525 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
15529 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
15530 LDKCommitmentTransaction this_arg_conv;
15531 this_arg_conv.inner = (void*)(this_arg & (~1));
15532 this_arg_conv.is_owned = false;
15533 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
15534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15536 long ret_ref = (long)ret_var.inner;
15537 if (ret_var.is_owned) {
15543 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) {
15544 LDKCommitmentTransaction this_arg_conv;
15545 this_arg_conv.inner = (void*)(this_arg & (~1));
15546 this_arg_conv.is_owned = false;
15547 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15548 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15549 channel_parameters_conv.is_owned = false;
15550 LDKChannelPublicKeys broadcaster_keys_conv;
15551 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
15552 broadcaster_keys_conv.is_owned = false;
15553 LDKChannelPublicKeys countersignatory_keys_conv;
15554 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
15555 countersignatory_keys_conv.is_owned = false;
15556 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15557 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
15558 return (long)ret_conv;
15561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15562 LDKTrustedCommitmentTransaction this_ptr_conv;
15563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15565 TrustedCommitmentTransaction_free(this_ptr_conv);
15568 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
15569 LDKTrustedCommitmentTransaction this_arg_conv;
15570 this_arg_conv.inner = (void*)(this_arg & (~1));
15571 this_arg_conv.is_owned = false;
15572 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15573 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
15577 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
15578 LDKTrustedCommitmentTransaction this_arg_conv;
15579 this_arg_conv.inner = (void*)(this_arg & (~1));
15580 this_arg_conv.is_owned = false;
15581 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
15582 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15583 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15584 long ret_ref = (long)ret_var.inner;
15585 if (ret_var.is_owned) {
15591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
15592 LDKTrustedCommitmentTransaction this_arg_conv;
15593 this_arg_conv.inner = (void*)(this_arg & (~1));
15594 this_arg_conv.is_owned = false;
15595 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
15596 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15597 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15598 long ret_ref = (long)ret_var.inner;
15599 if (ret_var.is_owned) {
15605 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) {
15606 LDKTrustedCommitmentTransaction this_arg_conv;
15607 this_arg_conv.inner = (void*)(this_arg & (~1));
15608 this_arg_conv.is_owned = false;
15609 unsigned char htlc_base_key_arr[32];
15610 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
15611 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
15612 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
15613 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15614 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15615 channel_parameters_conv.is_owned = false;
15616 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15617 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
15618 return (long)ret_conv;
15621 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) {
15622 LDKPublicKey broadcaster_payment_basepoint_ref;
15623 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
15624 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
15625 LDKPublicKey countersignatory_payment_basepoint_ref;
15626 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
15627 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
15628 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
15632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15633 LDKInitFeatures this_ptr_conv;
15634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15636 InitFeatures_free(this_ptr_conv);
15639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15640 LDKNodeFeatures this_ptr_conv;
15641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15643 NodeFeatures_free(this_ptr_conv);
15646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15647 LDKChannelFeatures this_ptr_conv;
15648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15650 ChannelFeatures_free(this_ptr_conv);
15653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15654 LDKRouteHop this_ptr_conv;
15655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15657 RouteHop_free(this_ptr_conv);
15660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15661 LDKRouteHop orig_conv;
15662 orig_conv.inner = (void*)(orig & (~1));
15663 orig_conv.is_owned = false;
15664 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
15665 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15666 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15667 long ret_ref = (long)ret_var.inner;
15668 if (ret_var.is_owned) {
15674 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15675 LDKRouteHop this_ptr_conv;
15676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15677 this_ptr_conv.is_owned = false;
15678 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
15679 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
15683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15684 LDKRouteHop this_ptr_conv;
15685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15686 this_ptr_conv.is_owned = false;
15687 LDKPublicKey val_ref;
15688 CHECK((*env)->GetArrayLength(env, val) == 33);
15689 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15690 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
15693 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15694 LDKRouteHop this_ptr_conv;
15695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15696 this_ptr_conv.is_owned = false;
15697 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
15698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15700 long ret_ref = (long)ret_var.inner;
15701 if (ret_var.is_owned) {
15707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15708 LDKRouteHop this_ptr_conv;
15709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15710 this_ptr_conv.is_owned = false;
15711 LDKNodeFeatures val_conv;
15712 val_conv.inner = (void*)(val & (~1));
15713 val_conv.is_owned = (val & 1) || (val == 0);
15714 // Warning: we may need a move here but can't clone!
15715 RouteHop_set_node_features(&this_ptr_conv, val_conv);
15718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15719 LDKRouteHop this_ptr_conv;
15720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15721 this_ptr_conv.is_owned = false;
15722 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
15726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15727 LDKRouteHop this_ptr_conv;
15728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15729 this_ptr_conv.is_owned = false;
15730 RouteHop_set_short_channel_id(&this_ptr_conv, val);
15733 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15734 LDKRouteHop this_ptr_conv;
15735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15736 this_ptr_conv.is_owned = false;
15737 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
15738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15740 long ret_ref = (long)ret_var.inner;
15741 if (ret_var.is_owned) {
15747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15748 LDKRouteHop this_ptr_conv;
15749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15750 this_ptr_conv.is_owned = false;
15751 LDKChannelFeatures val_conv;
15752 val_conv.inner = (void*)(val & (~1));
15753 val_conv.is_owned = (val & 1) || (val == 0);
15754 // Warning: we may need a move here but can't clone!
15755 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
15758 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15759 LDKRouteHop this_ptr_conv;
15760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15761 this_ptr_conv.is_owned = false;
15762 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
15766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15767 LDKRouteHop this_ptr_conv;
15768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15769 this_ptr_conv.is_owned = false;
15770 RouteHop_set_fee_msat(&this_ptr_conv, val);
15773 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15774 LDKRouteHop this_ptr_conv;
15775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15776 this_ptr_conv.is_owned = false;
15777 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
15781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15782 LDKRouteHop this_ptr_conv;
15783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15784 this_ptr_conv.is_owned = false;
15785 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
15788 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) {
15789 LDKPublicKey pubkey_arg_ref;
15790 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
15791 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
15792 LDKNodeFeatures node_features_arg_conv;
15793 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
15794 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
15795 // Warning: we may need a move here but can't clone!
15796 LDKChannelFeatures channel_features_arg_conv;
15797 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
15798 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
15799 // Warning: we may need a move here but can't clone!
15800 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);
15801 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15802 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15803 long ret_ref = (long)ret_var.inner;
15804 if (ret_var.is_owned) {
15810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15811 LDKRoute this_ptr_conv;
15812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15814 Route_free(this_ptr_conv);
15817 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15818 LDKRoute orig_conv;
15819 orig_conv.inner = (void*)(orig & (~1));
15820 orig_conv.is_owned = false;
15821 LDKRoute ret_var = Route_clone(&orig_conv);
15822 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15823 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15824 long ret_ref = (long)ret_var.inner;
15825 if (ret_var.is_owned) {
15831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15832 LDKRoute this_ptr_conv;
15833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15834 this_ptr_conv.is_owned = false;
15835 LDKCVec_CVec_RouteHopZZ val_constr;
15836 val_constr.datalen = (*env)->GetArrayLength(env, val);
15837 if (val_constr.datalen > 0)
15838 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15840 val_constr.data = NULL;
15841 for (size_t m = 0; m < val_constr.datalen; m++) {
15842 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
15843 LDKCVec_RouteHopZ arr_conv_12_constr;
15844 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15845 if (arr_conv_12_constr.datalen > 0)
15846 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15848 arr_conv_12_constr.data = NULL;
15849 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15850 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15851 int64_t arr_conv_10 = arr_conv_12_vals[k];
15852 LDKRouteHop arr_conv_10_conv;
15853 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15854 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15855 if (arr_conv_10_conv.inner != NULL)
15856 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15857 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15859 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15860 val_constr.data[m] = arr_conv_12_constr;
15862 Route_set_paths(&this_ptr_conv, val_constr);
15865 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
15866 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
15867 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
15868 if (paths_arg_constr.datalen > 0)
15869 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15871 paths_arg_constr.data = NULL;
15872 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
15873 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
15874 LDKCVec_RouteHopZ arr_conv_12_constr;
15875 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15876 if (arr_conv_12_constr.datalen > 0)
15877 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15879 arr_conv_12_constr.data = NULL;
15880 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15881 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15882 int64_t arr_conv_10 = arr_conv_12_vals[k];
15883 LDKRouteHop arr_conv_10_conv;
15884 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15885 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15886 if (arr_conv_10_conv.inner != NULL)
15887 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15888 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15890 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15891 paths_arg_constr.data[m] = arr_conv_12_constr;
15893 LDKRoute ret_var = Route_new(paths_arg_constr);
15894 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15895 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15896 long ret_ref = (long)ret_var.inner;
15897 if (ret_var.is_owned) {
15903 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
15905 obj_conv.inner = (void*)(obj & (~1));
15906 obj_conv.is_owned = false;
15907 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
15908 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15909 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15910 CVec_u8Z_free(arg_var);
15914 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15915 LDKu8slice ser_ref;
15916 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15917 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15918 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15919 *ret_conv = Route_read(ser_ref);
15920 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15921 return (long)ret_conv;
15924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15925 LDKRouteHint this_ptr_conv;
15926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15928 RouteHint_free(this_ptr_conv);
15931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15932 LDKRouteHint orig_conv;
15933 orig_conv.inner = (void*)(orig & (~1));
15934 orig_conv.is_owned = false;
15935 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
15936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15938 long ret_ref = (long)ret_var.inner;
15939 if (ret_var.is_owned) {
15945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15946 LDKRouteHint this_ptr_conv;
15947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15948 this_ptr_conv.is_owned = false;
15949 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
15950 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
15954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15955 LDKRouteHint this_ptr_conv;
15956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15957 this_ptr_conv.is_owned = false;
15958 LDKPublicKey val_ref;
15959 CHECK((*env)->GetArrayLength(env, val) == 33);
15960 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15961 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
15964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15965 LDKRouteHint this_ptr_conv;
15966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15967 this_ptr_conv.is_owned = false;
15968 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
15972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15973 LDKRouteHint this_ptr_conv;
15974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15975 this_ptr_conv.is_owned = false;
15976 RouteHint_set_short_channel_id(&this_ptr_conv, val);
15979 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
15980 LDKRouteHint this_ptr_conv;
15981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15982 this_ptr_conv.is_owned = false;
15983 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
15984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15986 long ret_ref = (long)ret_var.inner;
15987 if (ret_var.is_owned) {
15993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15994 LDKRouteHint this_ptr_conv;
15995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15996 this_ptr_conv.is_owned = false;
15997 LDKRoutingFees val_conv;
15998 val_conv.inner = (void*)(val & (~1));
15999 val_conv.is_owned = (val & 1) || (val == 0);
16000 if (val_conv.inner != NULL)
16001 val_conv = RoutingFees_clone(&val_conv);
16002 RouteHint_set_fees(&this_ptr_conv, val_conv);
16005 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16006 LDKRouteHint this_ptr_conv;
16007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16008 this_ptr_conv.is_owned = false;
16009 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
16013 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16014 LDKRouteHint this_ptr_conv;
16015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16016 this_ptr_conv.is_owned = false;
16017 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
16020 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16021 LDKRouteHint this_ptr_conv;
16022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16023 this_ptr_conv.is_owned = false;
16024 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
16028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16029 LDKRouteHint this_ptr_conv;
16030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16031 this_ptr_conv.is_owned = false;
16032 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
16035 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv *env, jclass clz, int8_tArray src_node_id_arg, int64_t short_channel_id_arg, int64_t fees_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg) {
16036 LDKPublicKey src_node_id_arg_ref;
16037 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
16038 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
16039 LDKRoutingFees fees_arg_conv;
16040 fees_arg_conv.inner = (void*)(fees_arg & (~1));
16041 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
16042 if (fees_arg_conv.inner != NULL)
16043 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
16044 LDKRouteHint ret_var = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
16045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16047 long ret_ref = (long)ret_var.inner;
16048 if (ret_var.is_owned) {
16054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray target, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
16055 LDKPublicKey our_node_id_ref;
16056 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
16057 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
16058 LDKNetworkGraph network_conv;
16059 network_conv.inner = (void*)(network & (~1));
16060 network_conv.is_owned = false;
16061 LDKPublicKey target_ref;
16062 CHECK((*env)->GetArrayLength(env, target) == 33);
16063 (*env)->GetByteArrayRegion(env, target, 0, 33, target_ref.compressed_form);
16064 LDKCVec_ChannelDetailsZ first_hops_constr;
16065 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
16066 if (first_hops_constr.datalen > 0)
16067 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16069 first_hops_constr.data = NULL;
16070 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
16071 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
16072 int64_t arr_conv_16 = first_hops_vals[q];
16073 LDKChannelDetails arr_conv_16_conv;
16074 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
16075 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
16076 first_hops_constr.data[q] = arr_conv_16_conv;
16078 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
16079 LDKCVec_RouteHintZ last_hops_constr;
16080 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
16081 if (last_hops_constr.datalen > 0)
16082 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16084 last_hops_constr.data = NULL;
16085 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
16086 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
16087 int64_t arr_conv_11 = last_hops_vals[l];
16088 LDKRouteHint arr_conv_11_conv;
16089 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
16090 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
16091 if (arr_conv_11_conv.inner != NULL)
16092 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
16093 last_hops_constr.data[l] = arr_conv_11_conv;
16095 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
16096 LDKLogger logger_conv = *(LDKLogger*)logger;
16097 if (logger_conv.free == LDKLogger_JCalls_free) {
16098 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16099 LDKLogger_JCalls_clone(logger_conv.this_arg);
16101 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16102 *ret_conv = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
16103 FREE(first_hops_constr.data);
16104 return (long)ret_conv;
16107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16108 LDKNetworkGraph this_ptr_conv;
16109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16110 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16111 NetworkGraph_free(this_ptr_conv);
16114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16115 LDKLockedNetworkGraph this_ptr_conv;
16116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16117 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16118 LockedNetworkGraph_free(this_ptr_conv);
16121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16122 LDKNetGraphMsgHandler this_ptr_conv;
16123 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16124 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16125 NetGraphMsgHandler_free(this_ptr_conv);
16128 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) {
16129 LDKThirtyTwoBytes genesis_hash_ref;
16130 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
16131 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
16132 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16133 LDKLogger logger_conv = *(LDKLogger*)logger;
16134 if (logger_conv.free == LDKLogger_JCalls_free) {
16135 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16136 LDKLogger_JCalls_clone(logger_conv.this_arg);
16138 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
16139 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16140 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16141 long ret_ref = (long)ret_var.inner;
16142 if (ret_var.is_owned) {
16148 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) {
16149 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16150 LDKLogger logger_conv = *(LDKLogger*)logger;
16151 if (logger_conv.free == LDKLogger_JCalls_free) {
16152 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16153 LDKLogger_JCalls_clone(logger_conv.this_arg);
16155 LDKNetworkGraph network_graph_conv;
16156 network_graph_conv.inner = (void*)(network_graph & (~1));
16157 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
16158 // Warning: we may need a move here but can't clone!
16159 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
16160 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16161 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16162 long ret_ref = (long)ret_var.inner;
16163 if (ret_var.is_owned) {
16169 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16170 LDKNetGraphMsgHandler this_arg_conv;
16171 this_arg_conv.inner = (void*)(this_arg & (~1));
16172 this_arg_conv.is_owned = false;
16173 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
16174 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16175 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16176 long ret_ref = (long)ret_var.inner;
16177 if (ret_var.is_owned) {
16183 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16184 LDKLockedNetworkGraph this_arg_conv;
16185 this_arg_conv.inner = (void*)(this_arg & (~1));
16186 this_arg_conv.is_owned = false;
16187 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
16188 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16189 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16190 long ret_ref = (long)ret_var.inner;
16191 if (ret_var.is_owned) {
16197 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16198 LDKNetGraphMsgHandler this_arg_conv;
16199 this_arg_conv.inner = (void*)(this_arg & (~1));
16200 this_arg_conv.is_owned = false;
16201 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16202 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
16206 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16207 LDKNetGraphMsgHandler this_arg_conv;
16208 this_arg_conv.inner = (void*)(this_arg & (~1));
16209 this_arg_conv.is_owned = false;
16210 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16211 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
16215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16216 LDKDirectionalChannelInfo this_ptr_conv;
16217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16218 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16219 DirectionalChannelInfo_free(this_ptr_conv);
16222 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16223 LDKDirectionalChannelInfo this_ptr_conv;
16224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16225 this_ptr_conv.is_owned = false;
16226 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
16230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16231 LDKDirectionalChannelInfo this_ptr_conv;
16232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16233 this_ptr_conv.is_owned = false;
16234 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
16237 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
16238 LDKDirectionalChannelInfo this_ptr_conv;
16239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16240 this_ptr_conv.is_owned = false;
16241 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
16245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16246 LDKDirectionalChannelInfo this_ptr_conv;
16247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16248 this_ptr_conv.is_owned = false;
16249 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
16252 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16253 LDKDirectionalChannelInfo this_ptr_conv;
16254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16255 this_ptr_conv.is_owned = false;
16256 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
16260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16261 LDKDirectionalChannelInfo this_ptr_conv;
16262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16263 this_ptr_conv.is_owned = false;
16264 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
16267 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16268 LDKDirectionalChannelInfo this_ptr_conv;
16269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16270 this_ptr_conv.is_owned = false;
16271 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
16275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16276 LDKDirectionalChannelInfo this_ptr_conv;
16277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16278 this_ptr_conv.is_owned = false;
16279 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
16282 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16283 LDKDirectionalChannelInfo this_ptr_conv;
16284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16285 this_ptr_conv.is_owned = false;
16286 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
16287 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16288 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16289 long ret_ref = (long)ret_var.inner;
16290 if (ret_var.is_owned) {
16296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16297 LDKDirectionalChannelInfo this_ptr_conv;
16298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16299 this_ptr_conv.is_owned = false;
16300 LDKRoutingFees val_conv;
16301 val_conv.inner = (void*)(val & (~1));
16302 val_conv.is_owned = (val & 1) || (val == 0);
16303 if (val_conv.inner != NULL)
16304 val_conv = RoutingFees_clone(&val_conv);
16305 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
16308 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16309 LDKDirectionalChannelInfo this_ptr_conv;
16310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16311 this_ptr_conv.is_owned = false;
16312 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
16313 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16314 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16315 long ret_ref = (long)ret_var.inner;
16316 if (ret_var.is_owned) {
16322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16323 LDKDirectionalChannelInfo this_ptr_conv;
16324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16325 this_ptr_conv.is_owned = false;
16326 LDKChannelUpdate val_conv;
16327 val_conv.inner = (void*)(val & (~1));
16328 val_conv.is_owned = (val & 1) || (val == 0);
16329 if (val_conv.inner != NULL)
16330 val_conv = ChannelUpdate_clone(&val_conv);
16331 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
16334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16335 LDKDirectionalChannelInfo obj_conv;
16336 obj_conv.inner = (void*)(obj & (~1));
16337 obj_conv.is_owned = false;
16338 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
16339 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16340 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16341 CVec_u8Z_free(arg_var);
16345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16346 LDKu8slice ser_ref;
16347 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16348 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16349 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
16350 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16351 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16352 long ret_ref = (long)ret_var.inner;
16353 if (ret_var.is_owned) {
16356 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16361 LDKChannelInfo this_ptr_conv;
16362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16364 ChannelInfo_free(this_ptr_conv);
16367 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16368 LDKChannelInfo this_ptr_conv;
16369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16370 this_ptr_conv.is_owned = false;
16371 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
16372 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16373 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16374 long ret_ref = (long)ret_var.inner;
16375 if (ret_var.is_owned) {
16381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16382 LDKChannelInfo this_ptr_conv;
16383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16384 this_ptr_conv.is_owned = false;
16385 LDKChannelFeatures val_conv;
16386 val_conv.inner = (void*)(val & (~1));
16387 val_conv.is_owned = (val & 1) || (val == 0);
16388 // Warning: we may need a move here but can't clone!
16389 ChannelInfo_set_features(&this_ptr_conv, val_conv);
16392 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16393 LDKChannelInfo this_ptr_conv;
16394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16395 this_ptr_conv.is_owned = false;
16396 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16397 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
16401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16402 LDKChannelInfo this_ptr_conv;
16403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16404 this_ptr_conv.is_owned = false;
16405 LDKPublicKey val_ref;
16406 CHECK((*env)->GetArrayLength(env, val) == 33);
16407 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16408 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
16411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
16412 LDKChannelInfo this_ptr_conv;
16413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16414 this_ptr_conv.is_owned = false;
16415 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
16416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16418 long ret_ref = (long)ret_var.inner;
16419 if (ret_var.is_owned) {
16425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16426 LDKChannelInfo this_ptr_conv;
16427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16428 this_ptr_conv.is_owned = false;
16429 LDKDirectionalChannelInfo val_conv;
16430 val_conv.inner = (void*)(val & (~1));
16431 val_conv.is_owned = (val & 1) || (val == 0);
16432 // Warning: we may need a move here but can't clone!
16433 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
16436 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
16437 LDKChannelInfo this_ptr_conv;
16438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16439 this_ptr_conv.is_owned = false;
16440 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16441 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
16445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16446 LDKChannelInfo this_ptr_conv;
16447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16448 this_ptr_conv.is_owned = false;
16449 LDKPublicKey val_ref;
16450 CHECK((*env)->GetArrayLength(env, val) == 33);
16451 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16452 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
16455 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16456 LDKChannelInfo this_ptr_conv;
16457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16458 this_ptr_conv.is_owned = false;
16459 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
16460 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16461 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16462 long ret_ref = (long)ret_var.inner;
16463 if (ret_var.is_owned) {
16469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16470 LDKChannelInfo this_ptr_conv;
16471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16472 this_ptr_conv.is_owned = false;
16473 LDKDirectionalChannelInfo val_conv;
16474 val_conv.inner = (void*)(val & (~1));
16475 val_conv.is_owned = (val & 1) || (val == 0);
16476 // Warning: we may need a move here but can't clone!
16477 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
16480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16481 LDKChannelInfo this_ptr_conv;
16482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16483 this_ptr_conv.is_owned = false;
16484 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
16485 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16486 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16487 long ret_ref = (long)ret_var.inner;
16488 if (ret_var.is_owned) {
16494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16495 LDKChannelInfo this_ptr_conv;
16496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16497 this_ptr_conv.is_owned = false;
16498 LDKChannelAnnouncement val_conv;
16499 val_conv.inner = (void*)(val & (~1));
16500 val_conv.is_owned = (val & 1) || (val == 0);
16501 if (val_conv.inner != NULL)
16502 val_conv = ChannelAnnouncement_clone(&val_conv);
16503 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
16506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16507 LDKChannelInfo obj_conv;
16508 obj_conv.inner = (void*)(obj & (~1));
16509 obj_conv.is_owned = false;
16510 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
16511 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16512 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16513 CVec_u8Z_free(arg_var);
16517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16518 LDKu8slice ser_ref;
16519 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16520 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16521 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
16522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16524 long ret_ref = (long)ret_var.inner;
16525 if (ret_var.is_owned) {
16528 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16533 LDKRoutingFees this_ptr_conv;
16534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16536 RoutingFees_free(this_ptr_conv);
16539 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16540 LDKRoutingFees orig_conv;
16541 orig_conv.inner = (void*)(orig & (~1));
16542 orig_conv.is_owned = false;
16543 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
16544 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16545 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16546 long ret_ref = (long)ret_var.inner;
16547 if (ret_var.is_owned) {
16553 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16554 LDKRoutingFees this_ptr_conv;
16555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16556 this_ptr_conv.is_owned = false;
16557 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
16561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16562 LDKRoutingFees this_ptr_conv;
16563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16564 this_ptr_conv.is_owned = false;
16565 RoutingFees_set_base_msat(&this_ptr_conv, val);
16568 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
16569 LDKRoutingFees this_ptr_conv;
16570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16571 this_ptr_conv.is_owned = false;
16572 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
16576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16577 LDKRoutingFees this_ptr_conv;
16578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16579 this_ptr_conv.is_owned = false;
16580 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
16583 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) {
16584 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
16585 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16586 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16587 long ret_ref = (long)ret_var.inner;
16588 if (ret_var.is_owned) {
16594 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16595 LDKu8slice ser_ref;
16596 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16597 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16598 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16599 *ret_conv = RoutingFees_read(ser_ref);
16600 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16601 return (long)ret_conv;
16604 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
16605 LDKRoutingFees obj_conv;
16606 obj_conv.inner = (void*)(obj & (~1));
16607 obj_conv.is_owned = false;
16608 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
16609 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16610 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16611 CVec_u8Z_free(arg_var);
16615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16616 LDKNodeAnnouncementInfo this_ptr_conv;
16617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16619 NodeAnnouncementInfo_free(this_ptr_conv);
16622 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16623 LDKNodeAnnouncementInfo this_ptr_conv;
16624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16625 this_ptr_conv.is_owned = false;
16626 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
16627 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16628 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16629 long ret_ref = (long)ret_var.inner;
16630 if (ret_var.is_owned) {
16636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16637 LDKNodeAnnouncementInfo this_ptr_conv;
16638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16639 this_ptr_conv.is_owned = false;
16640 LDKNodeFeatures val_conv;
16641 val_conv.inner = (void*)(val & (~1));
16642 val_conv.is_owned = (val & 1) || (val == 0);
16643 // Warning: we may need a move here but can't clone!
16644 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
16647 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16648 LDKNodeAnnouncementInfo this_ptr_conv;
16649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16650 this_ptr_conv.is_owned = false;
16651 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
16655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16656 LDKNodeAnnouncementInfo this_ptr_conv;
16657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16658 this_ptr_conv.is_owned = false;
16659 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
16662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
16663 LDKNodeAnnouncementInfo this_ptr_conv;
16664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16665 this_ptr_conv.is_owned = false;
16666 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
16667 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
16671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16672 LDKNodeAnnouncementInfo this_ptr_conv;
16673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16674 this_ptr_conv.is_owned = false;
16675 LDKThreeBytes val_ref;
16676 CHECK((*env)->GetArrayLength(env, val) == 3);
16677 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
16678 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
16681 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
16682 LDKNodeAnnouncementInfo this_ptr_conv;
16683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16684 this_ptr_conv.is_owned = false;
16685 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16686 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
16690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16691 LDKNodeAnnouncementInfo this_ptr_conv;
16692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16693 this_ptr_conv.is_owned = false;
16694 LDKThirtyTwoBytes val_ref;
16695 CHECK((*env)->GetArrayLength(env, val) == 32);
16696 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16697 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
16700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16701 LDKNodeAnnouncementInfo this_ptr_conv;
16702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16703 this_ptr_conv.is_owned = false;
16704 LDKCVec_NetAddressZ val_constr;
16705 val_constr.datalen = (*env)->GetArrayLength(env, val);
16706 if (val_constr.datalen > 0)
16707 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16709 val_constr.data = NULL;
16710 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16711 for (size_t m = 0; m < val_constr.datalen; m++) {
16712 int64_t arr_conv_12 = val_vals[m];
16713 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
16714 FREE((void*)arr_conv_12);
16715 val_constr.data[m] = arr_conv_12_conv;
16717 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16718 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
16721 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16722 LDKNodeAnnouncementInfo this_ptr_conv;
16723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16724 this_ptr_conv.is_owned = false;
16725 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
16726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16728 long ret_ref = (long)ret_var.inner;
16729 if (ret_var.is_owned) {
16735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16736 LDKNodeAnnouncementInfo this_ptr_conv;
16737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16738 this_ptr_conv.is_owned = false;
16739 LDKNodeAnnouncement val_conv;
16740 val_conv.inner = (void*)(val & (~1));
16741 val_conv.is_owned = (val & 1) || (val == 0);
16742 if (val_conv.inner != NULL)
16743 val_conv = NodeAnnouncement_clone(&val_conv);
16744 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
16747 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) {
16748 LDKNodeFeatures features_arg_conv;
16749 features_arg_conv.inner = (void*)(features_arg & (~1));
16750 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16751 // Warning: we may need a move here but can't clone!
16752 LDKThreeBytes rgb_arg_ref;
16753 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
16754 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
16755 LDKThirtyTwoBytes alias_arg_ref;
16756 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
16757 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
16758 LDKCVec_NetAddressZ addresses_arg_constr;
16759 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
16760 if (addresses_arg_constr.datalen > 0)
16761 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16763 addresses_arg_constr.data = NULL;
16764 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
16765 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
16766 int64_t arr_conv_12 = addresses_arg_vals[m];
16767 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
16768 FREE((void*)arr_conv_12);
16769 addresses_arg_constr.data[m] = arr_conv_12_conv;
16771 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
16772 LDKNodeAnnouncement announcement_message_arg_conv;
16773 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
16774 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
16775 if (announcement_message_arg_conv.inner != NULL)
16776 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
16777 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
16778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16780 long ret_ref = (long)ret_var.inner;
16781 if (ret_var.is_owned) {
16787 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16788 LDKNodeAnnouncementInfo obj_conv;
16789 obj_conv.inner = (void*)(obj & (~1));
16790 obj_conv.is_owned = false;
16791 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
16792 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16793 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16794 CVec_u8Z_free(arg_var);
16798 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16799 LDKu8slice ser_ref;
16800 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16801 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16802 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16803 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
16804 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16805 return (long)ret_conv;
16808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16809 LDKNodeInfo this_ptr_conv;
16810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16812 NodeInfo_free(this_ptr_conv);
16815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16816 LDKNodeInfo this_ptr_conv;
16817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16818 this_ptr_conv.is_owned = false;
16819 LDKCVec_u64Z val_constr;
16820 val_constr.datalen = (*env)->GetArrayLength(env, val);
16821 if (val_constr.datalen > 0)
16822 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16824 val_constr.data = NULL;
16825 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16826 for (size_t g = 0; g < val_constr.datalen; g++) {
16827 int64_t arr_conv_6 = val_vals[g];
16828 val_constr.data[g] = arr_conv_6;
16830 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16831 NodeInfo_set_channels(&this_ptr_conv, val_constr);
16834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16835 LDKNodeInfo this_ptr_conv;
16836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16837 this_ptr_conv.is_owned = false;
16838 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
16839 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16840 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16841 long ret_ref = (long)ret_var.inner;
16842 if (ret_var.is_owned) {
16848 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) {
16849 LDKNodeInfo this_ptr_conv;
16850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16851 this_ptr_conv.is_owned = false;
16852 LDKRoutingFees val_conv;
16853 val_conv.inner = (void*)(val & (~1));
16854 val_conv.is_owned = (val & 1) || (val == 0);
16855 if (val_conv.inner != NULL)
16856 val_conv = RoutingFees_clone(&val_conv);
16857 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
16860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
16861 LDKNodeInfo this_ptr_conv;
16862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16863 this_ptr_conv.is_owned = false;
16864 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
16865 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16866 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16867 long ret_ref = (long)ret_var.inner;
16868 if (ret_var.is_owned) {
16874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16875 LDKNodeInfo this_ptr_conv;
16876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16877 this_ptr_conv.is_owned = false;
16878 LDKNodeAnnouncementInfo val_conv;
16879 val_conv.inner = (void*)(val & (~1));
16880 val_conv.is_owned = (val & 1) || (val == 0);
16881 // Warning: we may need a move here but can't clone!
16882 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
16885 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) {
16886 LDKCVec_u64Z channels_arg_constr;
16887 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
16888 if (channels_arg_constr.datalen > 0)
16889 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16891 channels_arg_constr.data = NULL;
16892 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
16893 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
16894 int64_t arr_conv_6 = channels_arg_vals[g];
16895 channels_arg_constr.data[g] = arr_conv_6;
16897 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
16898 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
16899 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
16900 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
16901 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
16902 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
16903 LDKNodeAnnouncementInfo announcement_info_arg_conv;
16904 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
16905 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
16906 // Warning: we may need a move here but can't clone!
16907 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
16908 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16909 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16910 long ret_ref = (long)ret_var.inner;
16911 if (ret_var.is_owned) {
16917 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16918 LDKNodeInfo obj_conv;
16919 obj_conv.inner = (void*)(obj & (~1));
16920 obj_conv.is_owned = false;
16921 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
16922 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16923 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16924 CVec_u8Z_free(arg_var);
16928 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16929 LDKu8slice ser_ref;
16930 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16931 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16932 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16933 *ret_conv = NodeInfo_read(ser_ref);
16934 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16935 return (long)ret_conv;
16938 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
16939 LDKNetworkGraph obj_conv;
16940 obj_conv.inner = (void*)(obj & (~1));
16941 obj_conv.is_owned = false;
16942 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
16943 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16944 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16945 CVec_u8Z_free(arg_var);
16949 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16950 LDKu8slice ser_ref;
16951 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16952 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16953 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16954 *ret_conv = NetworkGraph_read(ser_ref);
16955 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16956 return (long)ret_conv;
16959 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
16960 LDKThirtyTwoBytes genesis_hash_ref;
16961 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
16962 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
16963 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
16964 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16965 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16966 long ret_ref = (long)ret_var.inner;
16967 if (ret_var.is_owned) {
16973 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) {
16974 LDKNetworkGraph this_arg_conv;
16975 this_arg_conv.inner = (void*)(this_arg & (~1));
16976 this_arg_conv.is_owned = false;
16977 LDKNodeAnnouncement msg_conv;
16978 msg_conv.inner = (void*)(msg & (~1));
16979 msg_conv.is_owned = false;
16980 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16981 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
16982 return (long)ret_conv;
16985 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) {
16986 LDKNetworkGraph this_arg_conv;
16987 this_arg_conv.inner = (void*)(this_arg & (~1));
16988 this_arg_conv.is_owned = false;
16989 LDKUnsignedNodeAnnouncement msg_conv;
16990 msg_conv.inner = (void*)(msg & (~1));
16991 msg_conv.is_owned = false;
16992 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16993 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
16994 return (long)ret_conv;
16997 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) {
16998 LDKNetworkGraph this_arg_conv;
16999 this_arg_conv.inner = (void*)(this_arg & (~1));
17000 this_arg_conv.is_owned = false;
17001 LDKChannelAnnouncement msg_conv;
17002 msg_conv.inner = (void*)(msg & (~1));
17003 msg_conv.is_owned = false;
17004 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17005 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17006 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17007 return (long)ret_conv;
17010 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) {
17011 LDKNetworkGraph this_arg_conv;
17012 this_arg_conv.inner = (void*)(this_arg & (~1));
17013 this_arg_conv.is_owned = false;
17014 LDKUnsignedChannelAnnouncement msg_conv;
17015 msg_conv.inner = (void*)(msg & (~1));
17016 msg_conv.is_owned = false;
17017 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17018 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17019 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17020 return (long)ret_conv;
17023 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) {
17024 LDKNetworkGraph this_arg_conv;
17025 this_arg_conv.inner = (void*)(this_arg & (~1));
17026 this_arg_conv.is_owned = false;
17027 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
17030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17031 LDKNetworkGraph this_arg_conv;
17032 this_arg_conv.inner = (void*)(this_arg & (~1));
17033 this_arg_conv.is_owned = false;
17034 LDKChannelUpdate msg_conv;
17035 msg_conv.inner = (void*)(msg & (~1));
17036 msg_conv.is_owned = false;
17037 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17038 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
17039 return (long)ret_conv;
17042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17043 LDKNetworkGraph this_arg_conv;
17044 this_arg_conv.inner = (void*)(this_arg & (~1));
17045 this_arg_conv.is_owned = false;
17046 LDKUnsignedChannelUpdate msg_conv;
17047 msg_conv.inner = (void*)(msg & (~1));
17048 msg_conv.is_owned = false;
17049 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17050 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
17051 return (long)ret_conv;