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 static inline LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const LDKC2Tuple_u32TxOutZ *orig) {
1309 LDKC2Tuple_u32TxOutZ ret = {
1311 .b = TxOut_clone(&orig->b),
1315 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1316 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
1319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1320 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
1321 long b_ref = (long)&tuple->b;
1324 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1325 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1326 ret->datalen = (*env)->GetArrayLength(env, elems);
1327 if (ret->datalen == 0) {
1330 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1331 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1332 for (size_t i = 0; i < ret->datalen; i++) {
1333 int64_t arr_elem = java_elems[i];
1334 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)arr_elem;
1335 FREE((void*)arr_elem);
1336 ret->data[i] = arr_elem_conv;
1338 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1342 static inline LDKCVec_C2Tuple_u32TxOutZZ CVec_C2Tuple_u32TxOutZZ_clone(const LDKCVec_C2Tuple_u32TxOutZZ *orig) {
1343 LDKCVec_C2Tuple_u32TxOutZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * orig->datalen, "LDKCVec_C2Tuple_u32TxOutZZ clone bytes"), .datalen = orig->datalen };
1344 for (size_t i = 0; i < ret.datalen; i++) {
1345 ret.data[i] = C2Tuple_u32TxOutZ_clone(&orig->data[i]);
1349 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
1350 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1351 LDKThirtyTwoBytes a_ref;
1352 CHECK((*env)->GetArrayLength(env, a) == 32);
1353 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1355 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1356 b_constr.datalen = (*env)->GetArrayLength(env, b);
1357 if (b_constr.datalen > 0)
1358 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1360 b_constr.data = NULL;
1361 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
1362 for (size_t a = 0; a < b_constr.datalen; a++) {
1363 int64_t arr_conv_26 = b_vals[a];
1364 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
1365 FREE((void*)arr_conv_26);
1366 b_constr.data[a] = arr_conv_26_conv;
1368 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
1372 static inline LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *orig) {
1373 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ ret = {
1374 .a = ThirtyTwoBytes_clone(&orig->a),
1375 .b = CVec_C2Tuple_u32TxOutZZ_clone(&orig->b),
1379 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1380 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
1381 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1382 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1385 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1386 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
1387 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1388 int64_tArray b_arr = (*env)->NewLongArray(env, b_var.datalen);
1389 int64_t *b_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, b_arr, NULL);
1390 for (size_t a = 0; a < b_var.datalen; a++) {
1391 long arr_conv_26_ref = (long)&b_var.data[a];
1392 b_arr_ptr[a] = arr_conv_26_ref;
1394 (*env)->ReleasePrimitiveArrayCritical(env, b_arr, b_arr_ptr, 0);
1397 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
1398 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1399 ret->datalen = (*env)->GetArrayLength(env, elems);
1400 if (ret->datalen == 0) {
1403 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1404 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1405 for (size_t i = 0; i < ret->datalen; i++) {
1406 int64_t arr_elem = java_elems[i];
1407 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_elem;
1408 FREE((void*)arr_elem);
1409 ret->data[i] = arr_elem_conv;
1411 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1415 static inline LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_clone(const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *orig) {
1416 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * orig->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ clone bytes"), .datalen = orig->datalen };
1417 for (size_t i = 0; i < ret.datalen; i++) {
1418 ret.data[i] = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(&orig->data[i]);
1422 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
1423 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1425 CHECK((*env)->GetArrayLength(env, a) == 64);
1426 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
1428 LDKCVec_SignatureZ b_constr;
1429 b_constr.datalen = (*env)->GetArrayLength(env, b);
1430 if (b_constr.datalen > 0)
1431 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1433 b_constr.data = NULL;
1434 for (size_t i = 0; i < b_constr.datalen; i++) {
1435 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
1436 LDKSignature arr_conv_8_ref;
1437 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
1438 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
1439 b_constr.data[i] = arr_conv_8_ref;
1444 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1445 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
1446 int8_tArray a_arr = (*env)->NewByteArray(env, 64);
1447 (*env)->SetByteArrayRegion(env, a_arr, 0, 64, tuple->a.compact_form);
1450 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1451 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
1452 LDKCVec_SignatureZ b_var = tuple->b;
1453 jobjectArray b_arr = (*env)->NewObjectArray(env, b_var.datalen, arr_of_B_clz, NULL);
1455 for (size_t i = 0; i < b_var.datalen; i++) {
1456 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
1457 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
1458 (*env)->SetObjectArrayElement(env, b_arr, i, arr_conv_8_arr);
1462 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1463 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1465 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1466 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
1467 CHECK(val->result_ok);
1468 long res_ref = (long)&(*val->contents.result);
1471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1472 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
1473 CHECK(!val->result_ok);
1474 return *val->contents.err;
1476 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1477 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1479 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1480 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
1481 CHECK(val->result_ok);
1482 int8_tArray res_arr = (*env)->NewByteArray(env, 64);
1483 (*env)->SetByteArrayRegion(env, res_arr, 0, 64, (*val->contents.result).compact_form);
1486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1487 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
1488 CHECK(!val->result_ok);
1489 return *val->contents.err;
1491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1492 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1494 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1495 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
1496 CHECK(val->result_ok);
1497 LDKCVec_SignatureZ res_var = (*val->contents.result);
1498 jobjectArray res_arr = (*env)->NewObjectArray(env, res_var.datalen, arr_of_B_clz, NULL);
1500 for (size_t i = 0; i < res_var.datalen; i++) {
1501 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 64);
1502 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1503 (*env)->SetObjectArrayElement(env, res_arr, i, arr_conv_8_arr);
1507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
1508 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
1509 CHECK(!val->result_ok);
1510 return *val->contents.err;
1512 typedef struct LDKChannelKeys_JCalls {
1513 atomic_size_t refcnt;
1516 jmethodID get_per_commitment_point_meth;
1517 jmethodID release_commitment_secret_meth;
1518 jmethodID key_derivation_params_meth;
1519 jmethodID sign_counterparty_commitment_meth;
1520 jmethodID sign_holder_commitment_meth;
1521 jmethodID sign_holder_commitment_htlc_transactions_meth;
1522 jmethodID sign_justice_transaction_meth;
1523 jmethodID sign_counterparty_htlc_transaction_meth;
1524 jmethodID sign_closing_transaction_meth;
1525 jmethodID sign_channel_announcement_meth;
1526 jmethodID ready_channel_meth;
1527 jmethodID write_meth;
1528 } LDKChannelKeys_JCalls;
1529 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1530 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1531 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1533 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1534 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1538 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1539 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1541 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1542 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1544 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1545 LDKPublicKey arg_ref;
1546 CHECK((*env)->GetArrayLength(env, arg) == 33);
1547 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
1550 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1551 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1553 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1554 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1556 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1557 LDKThirtyTwoBytes arg_ref;
1558 CHECK((*env)->GetArrayLength(env, arg) == 32);
1559 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
1562 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1563 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1565 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1566 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1568 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1569 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1570 ret_conv = C2Tuple_u64u64Z_clone((LDKC2Tuple_u64u64Z*)ret);
1573 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const LDKCommitmentTransaction * commitment_tx) {
1574 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1576 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1577 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1578 if (commitment_tx->inner != NULL)
1579 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1580 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1581 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1582 long commitment_tx_ref = (long)commitment_tx_var.inner;
1583 if (commitment_tx_var.is_owned) {
1584 commitment_tx_ref |= 1;
1586 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1588 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1589 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1590 ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret);
1593 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1594 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1596 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1597 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1598 if (commitment_tx->inner != NULL)
1599 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1600 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1601 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1602 long commitment_tx_ref = (long)commitment_tx_var.inner;
1603 if (commitment_tx_var.is_owned) {
1604 commitment_tx_ref |= 1;
1606 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1608 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
1609 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1610 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1613 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
1614 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1616 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1617 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1618 if (commitment_tx->inner != NULL)
1619 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1620 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1621 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1622 long commitment_tx_ref = (long)commitment_tx_var.inner;
1623 if (commitment_tx_var.is_owned) {
1624 commitment_tx_ref |= 1;
1626 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1628 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, commitment_tx_ref);
1629 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1630 ret_conv = CResult_CVec_SignatureZNoneZ_clone((LDKCResult_CVec_SignatureZNoneZ*)ret);
1633 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) {
1634 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1636 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1637 LDKTransaction justice_tx_var = justice_tx;
1638 int8_tArray justice_tx_arr = (*env)->NewByteArray(env, justice_tx_var.datalen);
1639 (*env)->SetByteArrayRegion(env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1640 Transaction_free(justice_tx_var);
1641 int8_tArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1642 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1643 LDKHTLCOutputInCommitment htlc_var = *htlc;
1644 if (htlc->inner != NULL)
1645 htlc_var = HTLCOutputInCommitment_clone(htlc);
1646 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1647 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1648 long htlc_ref = (long)htlc_var.inner;
1649 if (htlc_var.is_owned) {
1652 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1654 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);
1655 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1656 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1659 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) {
1660 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1662 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1663 LDKTransaction htlc_tx_var = htlc_tx;
1664 int8_tArray htlc_tx_arr = (*env)->NewByteArray(env, htlc_tx_var.datalen);
1665 (*env)->SetByteArrayRegion(env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
1666 Transaction_free(htlc_tx_var);
1667 int8_tArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1668 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1669 LDKHTLCOutputInCommitment htlc_var = *htlc;
1670 if (htlc->inner != NULL)
1671 htlc_var = HTLCOutputInCommitment_clone(htlc);
1672 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1673 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1674 long htlc_ref = (long)htlc_var.inner;
1675 if (htlc_var.is_owned) {
1678 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1680 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);
1681 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1682 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1685 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1686 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1688 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1689 LDKTransaction closing_tx_var = closing_tx;
1690 int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
1691 (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
1692 Transaction_free(closing_tx_var);
1693 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1695 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
1696 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1697 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1700 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement * msg) {
1701 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1703 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1704 LDKUnsignedChannelAnnouncement msg_var = *msg;
1705 if (msg->inner != NULL)
1706 msg_var = UnsignedChannelAnnouncement_clone(msg);
1707 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1708 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1709 long msg_ref = (long)msg_var.inner;
1710 if (msg_var.is_owned) {
1713 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1715 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
1716 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1717 ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)ret);
1720 void ready_channel_jcall(void* this_arg, const LDKChannelTransactionParameters * channel_parameters) {
1721 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1723 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1724 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1725 if (channel_parameters->inner != NULL)
1726 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1727 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1728 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1729 long channel_parameters_ref = (long)channel_parameters_var.inner;
1730 if (channel_parameters_var.is_owned) {
1731 channel_parameters_ref |= 1;
1733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1735 return (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
1737 LDKCVec_u8Z write_jcall(const void* this_arg) {
1738 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1741 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1743 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
1744 LDKCVec_u8Z arg_ref;
1745 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
1746 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1747 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
1750 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1751 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1752 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1753 return (void*) this_arg;
1755 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1756 jclass c = (*env)->GetObjectClass(env, o);
1758 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1759 atomic_init(&calls->refcnt, 1);
1760 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1761 calls->o = (*env)->NewWeakGlobalRef(env, o);
1762 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1763 CHECK(calls->get_per_commitment_point_meth != NULL);
1764 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1765 CHECK(calls->release_commitment_secret_meth != NULL);
1766 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1767 CHECK(calls->key_derivation_params_meth != NULL);
1768 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
1769 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1770 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1771 CHECK(calls->sign_holder_commitment_meth != NULL);
1772 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1773 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1774 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
1775 CHECK(calls->sign_justice_transaction_meth != NULL);
1776 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
1777 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1778 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
1779 CHECK(calls->sign_closing_transaction_meth != NULL);
1780 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1781 CHECK(calls->sign_channel_announcement_meth != NULL);
1782 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
1783 CHECK(calls->ready_channel_meth != NULL);
1784 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
1785 CHECK(calls->write_meth != NULL);
1787 LDKChannelPublicKeys pubkeys_conv;
1788 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1789 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1790 if (pubkeys_conv.inner != NULL)
1791 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1793 LDKChannelKeys ret = {
1794 .this_arg = (void*) calls,
1795 .get_per_commitment_point = get_per_commitment_point_jcall,
1796 .release_commitment_secret = release_commitment_secret_jcall,
1797 .key_derivation_params = key_derivation_params_jcall,
1798 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1799 .sign_holder_commitment = sign_holder_commitment_jcall,
1800 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1801 .sign_justice_transaction = sign_justice_transaction_jcall,
1802 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1803 .sign_closing_transaction = sign_closing_transaction_jcall,
1804 .sign_channel_announcement = sign_channel_announcement_jcall,
1805 .ready_channel = ready_channel_jcall,
1806 .clone = LDKChannelKeys_JCalls_clone,
1807 .write = write_jcall,
1808 .free = LDKChannelKeys_JCalls_free,
1809 .pubkeys = pubkeys_conv,
1810 .set_pubkeys = NULL,
1814 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new(JNIEnv *env, jclass clz, jobject o, int64_t pubkeys) {
1815 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1816 *res_ptr = LDKChannelKeys_init(env, clz, o, pubkeys);
1817 return (long)res_ptr;
1819 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) {
1820 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1821 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
1822 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1826 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx) {
1827 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1828 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
1829 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1833 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv *env, jclass clz, int64_t this_arg) {
1834 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1835 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1836 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1837 return (long)ret_ref;
1840 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) {
1841 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1842 LDKCommitmentTransaction commitment_tx_conv;
1843 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1844 commitment_tx_conv.is_owned = false;
1845 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1846 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1847 return (long)ret_conv;
1850 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) {
1851 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1852 LDKHolderCommitmentTransaction commitment_tx_conv;
1853 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1854 commitment_tx_conv.is_owned = false;
1855 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1856 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1857 return (long)ret_conv;
1860 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) {
1861 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1862 LDKHolderCommitmentTransaction commitment_tx_conv;
1863 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1864 commitment_tx_conv.is_owned = false;
1865 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1866 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &commitment_tx_conv);
1867 return (long)ret_conv;
1870 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) {
1871 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1872 LDKTransaction justice_tx_ref;
1873 justice_tx_ref.datalen = (*env)->GetArrayLength(env, justice_tx);
1874 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1875 (*env)->GetByteArrayRegion(env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
1876 justice_tx_ref.data_is_owned = true;
1877 unsigned char per_commitment_key_arr[32];
1878 CHECK((*env)->GetArrayLength(env, per_commitment_key) == 32);
1879 (*env)->GetByteArrayRegion(env, per_commitment_key, 0, 32, per_commitment_key_arr);
1880 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1881 LDKHTLCOutputInCommitment htlc_conv;
1882 htlc_conv.inner = (void*)(htlc & (~1));
1883 htlc_conv.is_owned = false;
1884 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1885 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1886 return (long)ret_conv;
1889 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) {
1890 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1891 LDKTransaction htlc_tx_ref;
1892 htlc_tx_ref.datalen = (*env)->GetArrayLength(env, htlc_tx);
1893 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1894 (*env)->GetByteArrayRegion(env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
1895 htlc_tx_ref.data_is_owned = true;
1896 LDKPublicKey per_commitment_point_ref;
1897 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
1898 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1899 LDKHTLCOutputInCommitment htlc_conv;
1900 htlc_conv.inner = (void*)(htlc & (~1));
1901 htlc_conv.is_owned = false;
1902 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1903 *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);
1904 return (long)ret_conv;
1907 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) {
1908 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1909 LDKTransaction closing_tx_ref;
1910 closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
1911 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1912 (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
1913 closing_tx_ref.data_is_owned = true;
1914 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1915 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1916 return (long)ret_conv;
1919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
1920 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1921 LDKUnsignedChannelAnnouncement msg_conv;
1922 msg_conv.inner = (void*)(msg & (~1));
1923 msg_conv.is_owned = false;
1924 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1925 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1926 return (long)ret_conv;
1929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t channel_parameters) {
1930 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1931 LDKChannelTransactionParameters channel_parameters_conv;
1932 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1933 channel_parameters_conv.is_owned = false;
1934 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1937 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
1938 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1939 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1940 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
1941 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
1942 CVec_u8Z_free(arg_var);
1946 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1947 if (this_arg->set_pubkeys != NULL)
1948 this_arg->set_pubkeys(this_arg);
1949 return this_arg->pubkeys;
1951 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
1952 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1953 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1956 long ret_ref = (long)ret_var.inner;
1957 if (ret_var.is_owned) {
1963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
1964 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1965 LDKThirtyTwoBytes a_ref;
1966 CHECK((*env)->GetArrayLength(env, a) == 32);
1967 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
1969 LDKChannelMonitor b_conv;
1970 b_conv.inner = (void*)(b & (~1));
1971 b_conv.is_owned = (b & 1) || (b == 0);
1972 // Warning: we may need a move here but can't clone!
1976 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
1977 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1978 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
1979 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
1982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
1983 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1984 LDKChannelMonitor b_var = tuple->b;
1985 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1986 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1987 long b_ref = (long)b_var.inner & ~1;
1990 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1991 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1993 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
1994 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1995 CHECK(val->result_ok);
1996 long res_ref = (long)&(*val->contents.result);
1999 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2000 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
2001 CHECK(!val->result_ok);
2002 LDKDecodeError err_var = (*val->contents.err);
2003 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2004 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2005 long err_ref = (long)err_var.inner & ~1;
2008 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2009 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
2011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2012 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
2013 CHECK(val->result_ok);
2014 long res_ref = (long)&(*val->contents.result);
2017 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2018 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
2019 CHECK(!val->result_ok);
2020 LDKDecodeError err_var = (*val->contents.err);
2021 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2022 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2023 long err_ref = (long)err_var.inner & ~1;
2026 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2027 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
2029 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2030 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
2031 CHECK(val->result_ok);
2032 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2033 *ret = (*val->contents.result);
2036 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2037 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
2038 CHECK(!val->result_ok);
2039 LDKDecodeError err_var = (*val->contents.err);
2040 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2041 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2042 long err_ref = (long)err_var.inner & ~1;
2045 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2046 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
2048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2049 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
2050 CHECK(val->result_ok);
2051 LDKInMemoryChannelKeys res_var = (*val->contents.result);
2052 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2053 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2054 long res_ref = (long)res_var.inner & ~1;
2057 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2058 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
2059 CHECK(!val->result_ok);
2060 LDKDecodeError err_var = (*val->contents.err);
2061 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2062 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2063 long err_ref = (long)err_var.inner & ~1;
2066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2067 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2069 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2070 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
2071 CHECK(val->result_ok);
2072 long res_ref = (long)&(*val->contents.result);
2073 return (long)res_ref;
2075 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2076 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
2077 CHECK(!val->result_ok);
2078 jclass err_conv = LDKAccessError_to_java(env, (*val->contents.err));
2081 static inline LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const LDKCResult_TxOutAccessErrorZ *orig) {
2082 LDKCResult_TxOutAccessErrorZ res = { .result_ok = orig->result_ok };
2083 if (orig->result_ok) {
2084 LDKTxOut* contents = MALLOC(sizeof(LDKTxOut), "LDKTxOut result OK clone");
2085 *contents = TxOut_clone(orig->contents.result);
2086 res.contents.result = contents;
2088 LDKAccessError* contents = MALLOC(sizeof(LDKAccessError), "LDKAccessError result Err clone");
2089 *contents = AccessError_clone(orig->contents.err);
2090 res.contents.err = contents;
2094 static jclass LDKAPIError_APIMisuseError_class = NULL;
2095 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2096 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2097 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2098 static jclass LDKAPIError_RouteError_class = NULL;
2099 static jmethodID LDKAPIError_RouteError_meth = NULL;
2100 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2101 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2102 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2103 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) {
2105 LDKAPIError_APIMisuseError_class =
2106 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2107 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2108 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2109 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2110 LDKAPIError_FeeRateTooHigh_class =
2111 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2112 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2113 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2114 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2115 LDKAPIError_RouteError_class =
2116 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2117 CHECK(LDKAPIError_RouteError_class != NULL);
2118 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2119 CHECK(LDKAPIError_RouteError_meth != NULL);
2120 LDKAPIError_ChannelUnavailable_class =
2121 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2122 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2123 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2124 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2125 LDKAPIError_MonitorUpdateFailed_class =
2126 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2127 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2128 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2129 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2131 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2132 LDKAPIError *obj = (LDKAPIError*)ptr;
2134 case LDKAPIError_APIMisuseError: {
2135 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2136 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2137 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2138 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2140 case LDKAPIError_FeeRateTooHigh: {
2141 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2142 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2143 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2144 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2146 case LDKAPIError_RouteError: {
2147 LDKStr err_str = obj->route_error.err;
2148 jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
2149 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2151 case LDKAPIError_ChannelUnavailable: {
2152 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2153 int8_tArray err_arr = (*env)->NewByteArray(env, err_var.datalen);
2154 (*env)->SetByteArrayRegion(env, err_arr, 0, err_var.datalen, err_var.data);
2155 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2157 case LDKAPIError_MonitorUpdateFailed: {
2158 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2163 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2164 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2167 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
2168 CHECK(val->result_ok);
2169 return *val->contents.result;
2171 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2172 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
2173 CHECK(!val->result_ok);
2174 long err_ref = (long)&(*val->contents.err);
2177 static inline LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const LDKCResult_NoneAPIErrorZ *orig) {
2178 LDKCResult_NoneAPIErrorZ res = { .result_ok = orig->result_ok };
2179 if (orig->result_ok) {
2180 res.contents.result = NULL;
2182 LDKAPIError* contents = MALLOC(sizeof(LDKAPIError), "LDKAPIError result Err clone");
2183 *contents = APIError_clone(orig->contents.err);
2184 res.contents.err = contents;
2188 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2189 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2190 ret->datalen = (*env)->GetArrayLength(env, elems);
2191 if (ret->datalen == 0) {
2194 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2195 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2196 for (size_t i = 0; i < ret->datalen; i++) {
2197 int64_t arr_elem = java_elems[i];
2198 LDKChannelDetails arr_elem_conv;
2199 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2200 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2201 if (arr_elem_conv.inner != NULL)
2202 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2203 ret->data[i] = arr_elem_conv;
2205 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2209 static inline LDKCVec_ChannelDetailsZ CVec_ChannelDetailsZ_clone(const LDKCVec_ChannelDetailsZ *orig) {
2210 LDKCVec_ChannelDetailsZ ret = { .data = MALLOC(sizeof(LDKChannelDetails) * orig->datalen, "LDKCVec_ChannelDetailsZ clone bytes"), .datalen = orig->datalen };
2211 for (size_t i = 0; i < ret.datalen; i++) {
2212 ret.data[i] = ChannelDetails_clone(&orig->data[i]);
2216 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2217 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2220 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
2221 CHECK(val->result_ok);
2222 return *val->contents.result;
2224 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2225 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
2226 CHECK(!val->result_ok);
2227 LDKPaymentSendFailure err_var = (*val->contents.err);
2228 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2229 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2230 long err_ref = (long)err_var.inner & ~1;
2233 static jclass LDKNetAddress_IPv4_class = NULL;
2234 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2235 static jclass LDKNetAddress_IPv6_class = NULL;
2236 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2237 static jclass LDKNetAddress_OnionV2_class = NULL;
2238 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2239 static jclass LDKNetAddress_OnionV3_class = NULL;
2240 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) {
2242 LDKNetAddress_IPv4_class =
2243 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2244 CHECK(LDKNetAddress_IPv4_class != NULL);
2245 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2246 CHECK(LDKNetAddress_IPv4_meth != NULL);
2247 LDKNetAddress_IPv6_class =
2248 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2249 CHECK(LDKNetAddress_IPv6_class != NULL);
2250 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2251 CHECK(LDKNetAddress_IPv6_meth != NULL);
2252 LDKNetAddress_OnionV2_class =
2253 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2254 CHECK(LDKNetAddress_OnionV2_class != NULL);
2255 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2256 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2257 LDKNetAddress_OnionV3_class =
2258 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2259 CHECK(LDKNetAddress_OnionV3_class != NULL);
2260 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2261 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2263 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
2264 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2266 case LDKNetAddress_IPv4: {
2267 int8_tArray addr_arr = (*env)->NewByteArray(env, 4);
2268 (*env)->SetByteArrayRegion(env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2269 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2271 case LDKNetAddress_IPv6: {
2272 int8_tArray addr_arr = (*env)->NewByteArray(env, 16);
2273 (*env)->SetByteArrayRegion(env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2274 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2276 case LDKNetAddress_OnionV2: {
2277 int8_tArray addr_arr = (*env)->NewByteArray(env, 10);
2278 (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2279 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2281 case LDKNetAddress_OnionV3: {
2282 int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2283 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2284 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);
2289 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2290 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2291 ret->datalen = (*env)->GetArrayLength(env, elems);
2292 if (ret->datalen == 0) {
2295 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2296 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2297 for (size_t i = 0; i < ret->datalen; i++) {
2298 int64_t arr_elem = java_elems[i];
2299 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2300 FREE((void*)arr_elem);
2301 ret->data[i] = arr_elem_conv;
2303 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2307 static inline LDKCVec_NetAddressZ CVec_NetAddressZ_clone(const LDKCVec_NetAddressZ *orig) {
2308 LDKCVec_NetAddressZ ret = { .data = MALLOC(sizeof(LDKNetAddress) * orig->datalen, "LDKCVec_NetAddressZ clone bytes"), .datalen = orig->datalen };
2309 for (size_t i = 0; i < ret.datalen; i++) {
2310 ret.data[i] = NetAddress_clone(&orig->data[i]);
2314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2315 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2316 ret->datalen = (*env)->GetArrayLength(env, elems);
2317 if (ret->datalen == 0) {
2320 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2321 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2322 for (size_t i = 0; i < ret->datalen; i++) {
2323 int64_t arr_elem = java_elems[i];
2324 LDKChannelMonitor arr_elem_conv;
2325 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2326 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2327 // Warning: we may need a move here but can't clone!
2328 ret->data[i] = arr_elem_conv;
2330 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2334 typedef struct LDKWatch_JCalls {
2335 atomic_size_t refcnt;
2338 jmethodID watch_channel_meth;
2339 jmethodID update_channel_meth;
2340 jmethodID release_pending_monitor_events_meth;
2342 static void LDKWatch_JCalls_free(void* this_arg) {
2343 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2344 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2346 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2347 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2351 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2352 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2354 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2355 LDKOutPoint funding_txo_var = funding_txo;
2356 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2357 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2358 long funding_txo_ref = (long)funding_txo_var.inner;
2359 if (funding_txo_var.is_owned) {
2360 funding_txo_ref |= 1;
2362 LDKChannelMonitor monitor_var = monitor;
2363 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2364 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2365 long monitor_ref = (long)monitor_var.inner;
2366 if (monitor_var.is_owned) {
2369 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2371 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2372 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2373 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2376 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2377 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2379 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2380 LDKOutPoint funding_txo_var = funding_txo;
2381 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2382 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2383 long funding_txo_ref = (long)funding_txo_var.inner;
2384 if (funding_txo_var.is_owned) {
2385 funding_txo_ref |= 1;
2387 LDKChannelMonitorUpdate update_var = update;
2388 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2389 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2390 long update_ref = (long)update_var.inner;
2391 if (update_var.is_owned) {
2394 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2396 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2397 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2398 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
2401 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2402 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2404 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2405 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2407 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2408 LDKCVec_MonitorEventZ arg_constr;
2409 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
2410 if (arg_constr.datalen > 0)
2411 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2413 arg_constr.data = NULL;
2414 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
2415 for (size_t o = 0; o < arg_constr.datalen; o++) {
2416 int64_t arr_conv_14 = arg_vals[o];
2417 LDKMonitorEvent arr_conv_14_conv;
2418 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2419 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2420 if (arr_conv_14_conv.inner != NULL)
2421 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2422 arg_constr.data[o] = arr_conv_14_conv;
2424 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
2427 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2428 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2429 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2430 return (void*) this_arg;
2432 static inline LDKWatch LDKWatch_init (JNIEnv *env, jclass clz, jobject o) {
2433 jclass c = (*env)->GetObjectClass(env, o);
2435 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2436 atomic_init(&calls->refcnt, 1);
2437 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2438 calls->o = (*env)->NewWeakGlobalRef(env, o);
2439 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2440 CHECK(calls->watch_channel_meth != NULL);
2441 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2442 CHECK(calls->update_channel_meth != NULL);
2443 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2444 CHECK(calls->release_pending_monitor_events_meth != NULL);
2447 .this_arg = (void*) calls,
2448 .watch_channel = watch_channel_jcall,
2449 .update_channel = update_channel_jcall,
2450 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2451 .free = LDKWatch_JCalls_free,
2455 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new(JNIEnv *env, jclass clz, jobject o) {
2456 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2457 *res_ptr = LDKWatch_init(env, clz, o);
2458 return (long)res_ptr;
2460 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) {
2461 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2462 LDKOutPoint funding_txo_conv;
2463 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2464 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2465 if (funding_txo_conv.inner != NULL)
2466 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2467 LDKChannelMonitor monitor_conv;
2468 monitor_conv.inner = (void*)(monitor & (~1));
2469 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2470 // Warning: we may need a move here but can't clone!
2471 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2472 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2473 return (long)ret_conv;
2476 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) {
2477 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2478 LDKOutPoint funding_txo_conv;
2479 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2480 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2481 if (funding_txo_conv.inner != NULL)
2482 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2483 LDKChannelMonitorUpdate update_conv;
2484 update_conv.inner = (void*)(update & (~1));
2485 update_conv.is_owned = (update & 1) || (update == 0);
2486 if (update_conv.inner != NULL)
2487 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2488 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2489 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2490 return (long)ret_conv;
2493 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
2494 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2495 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2496 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
2497 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
2498 for (size_t o = 0; o < ret_var.datalen; o++) {
2499 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2500 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2501 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2502 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2503 if (arr_conv_14_var.is_owned) {
2504 arr_conv_14_ref |= 1;
2506 ret_arr_ptr[o] = arr_conv_14_ref;
2508 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
2513 typedef struct LDKBroadcasterInterface_JCalls {
2514 atomic_size_t refcnt;
2517 jmethodID broadcast_transaction_meth;
2518 } LDKBroadcasterInterface_JCalls;
2519 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2520 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2521 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2523 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2524 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2528 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2529 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2531 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2532 LDKTransaction tx_var = tx;
2533 int8_tArray tx_arr = (*env)->NewByteArray(env, tx_var.datalen);
2534 (*env)->SetByteArrayRegion(env, tx_arr, 0, tx_var.datalen, tx_var.data);
2535 Transaction_free(tx_var);
2536 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2538 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2540 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2541 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2542 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2543 return (void*) this_arg;
2545 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv *env, jclass clz, jobject o) {
2546 jclass c = (*env)->GetObjectClass(env, o);
2548 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2549 atomic_init(&calls->refcnt, 1);
2550 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2551 calls->o = (*env)->NewWeakGlobalRef(env, o);
2552 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2553 CHECK(calls->broadcast_transaction_meth != NULL);
2555 LDKBroadcasterInterface ret = {
2556 .this_arg = (void*) calls,
2557 .broadcast_transaction = broadcast_transaction_jcall,
2558 .free = LDKBroadcasterInterface_JCalls_free,
2562 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2563 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2564 *res_ptr = LDKBroadcasterInterface_init(env, clz, o);
2565 return (long)res_ptr;
2567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray tx) {
2568 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2569 LDKTransaction tx_ref;
2570 tx_ref.datalen = (*env)->GetArrayLength(env, tx);
2571 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2572 (*env)->GetByteArrayRegion(env, tx, 0, tx_ref.datalen, tx_ref.data);
2573 tx_ref.data_is_owned = true;
2574 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2577 typedef struct LDKKeysInterface_JCalls {
2578 atomic_size_t refcnt;
2581 jmethodID get_node_secret_meth;
2582 jmethodID get_destination_script_meth;
2583 jmethodID get_shutdown_pubkey_meth;
2584 jmethodID get_channel_keys_meth;
2585 jmethodID get_secure_random_bytes_meth;
2586 jmethodID read_chan_signer_meth;
2587 } LDKKeysInterface_JCalls;
2588 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2589 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2590 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2592 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2593 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2597 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2598 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2600 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2601 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2603 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2604 LDKSecretKey arg_ref;
2605 CHECK((*env)->GetArrayLength(env, arg) == 32);
2606 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.bytes);
2609 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2610 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2612 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2613 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2615 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth);
2616 LDKCVec_u8Z arg_ref;
2617 arg_ref.datalen = (*env)->GetArrayLength(env, arg);
2618 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2619 (*env)->GetByteArrayRegion(env, arg, 0, arg_ref.datalen, arg_ref.data);
2622 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2623 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2625 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2626 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2628 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2629 LDKPublicKey arg_ref;
2630 CHECK((*env)->GetArrayLength(env, arg) == 33);
2631 (*env)->GetByteArrayRegion(env, arg, 0, 33, arg_ref.compressed_form);
2634 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2635 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2637 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2638 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2640 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2641 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2642 ret_conv = ChannelKeys_clone(ret);
2645 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2646 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2648 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2649 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2651 int8_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2652 LDKThirtyTwoBytes arg_ref;
2653 CHECK((*env)->GetArrayLength(env, arg) == 32);
2654 (*env)->GetByteArrayRegion(env, arg, 0, 32, arg_ref.data);
2657 LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, LDKu8slice reader) {
2658 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2660 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2661 LDKu8slice reader_var = reader;
2662 int8_tArray reader_arr = (*env)->NewByteArray(env, reader_var.datalen);
2663 (*env)->SetByteArrayRegion(env, reader_arr, 0, reader_var.datalen, reader_var.data);
2664 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2666 LDKCResult_ChanKeySignerDecodeErrorZ* ret = (LDKCResult_ChanKeySignerDecodeErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr);
2667 LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)ret;
2668 // Warning: we may need a move here but can't do a full clone!
2671 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2672 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2673 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2674 return (void*) this_arg;
2676 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, jobject o) {
2677 jclass c = (*env)->GetObjectClass(env, o);
2679 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2680 atomic_init(&calls->refcnt, 1);
2681 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2682 calls->o = (*env)->NewWeakGlobalRef(env, o);
2683 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2684 CHECK(calls->get_node_secret_meth != NULL);
2685 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2686 CHECK(calls->get_destination_script_meth != NULL);
2687 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2688 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2689 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2690 CHECK(calls->get_channel_keys_meth != NULL);
2691 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2692 CHECK(calls->get_secure_random_bytes_meth != NULL);
2693 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
2694 CHECK(calls->read_chan_signer_meth != NULL);
2696 LDKKeysInterface ret = {
2697 .this_arg = (void*) calls,
2698 .get_node_secret = get_node_secret_jcall,
2699 .get_destination_script = get_destination_script_jcall,
2700 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2701 .get_channel_keys = get_channel_keys_jcall,
2702 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2703 .read_chan_signer = read_chan_signer_jcall,
2704 .free = LDKKeysInterface_JCalls_free,
2708 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new(JNIEnv *env, jclass clz, jobject o) {
2709 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2710 *res_ptr = LDKKeysInterface_init(env, clz, o);
2711 return (long)res_ptr;
2713 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
2714 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2715 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2716 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2720 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
2721 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2722 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2723 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
2724 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
2725 CVec_u8Z_free(arg_var);
2729 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg) {
2730 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2731 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
2732 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2736 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) {
2737 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2738 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2739 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
2744 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2745 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
2746 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2750 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray reader) {
2751 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2752 LDKu8slice reader_ref;
2753 reader_ref.datalen = (*env)->GetArrayLength(env, reader);
2754 reader_ref.data = (*env)->GetByteArrayElements (env, reader, NULL);
2755 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
2756 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2757 (*env)->ReleaseByteArrayElements(env, reader, (int8_t*)reader_ref.data, 0);
2758 return (long)ret_conv;
2761 typedef struct LDKFeeEstimator_JCalls {
2762 atomic_size_t refcnt;
2765 jmethodID get_est_sat_per_1000_weight_meth;
2766 } LDKFeeEstimator_JCalls;
2767 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2768 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2769 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2771 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2772 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2776 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2777 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2779 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2780 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2781 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2783 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2785 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2786 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2787 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2788 return (void*) this_arg;
2790 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv *env, jclass clz, jobject o) {
2791 jclass c = (*env)->GetObjectClass(env, o);
2793 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2794 atomic_init(&calls->refcnt, 1);
2795 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2796 calls->o = (*env)->NewWeakGlobalRef(env, o);
2797 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2798 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2800 LDKFeeEstimator ret = {
2801 .this_arg = (void*) calls,
2802 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2803 .free = LDKFeeEstimator_JCalls_free,
2807 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new(JNIEnv *env, jclass clz, jobject o) {
2808 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2809 *res_ptr = LDKFeeEstimator_init(env, clz, o);
2810 return (long)res_ptr;
2812 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) {
2813 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2814 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(env, confirmation_target);
2815 int32_t ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2819 typedef struct LDKLogger_JCalls {
2820 atomic_size_t refcnt;
2825 static void LDKLogger_JCalls_free(void* this_arg) {
2826 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2827 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2829 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2830 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2834 void log_jcall(const void* this_arg, const char* record) {
2835 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2837 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2838 const char* record_str = record;
2839 jstring record_conv = str_ref_to_java(env, record_str, strlen(record_str));
2840 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2842 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
2844 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2845 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2846 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2847 return (void*) this_arg;
2849 static inline LDKLogger LDKLogger_init (JNIEnv *env, jclass clz, jobject o) {
2850 jclass c = (*env)->GetObjectClass(env, o);
2852 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2853 atomic_init(&calls->refcnt, 1);
2854 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2855 calls->o = (*env)->NewWeakGlobalRef(env, o);
2856 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
2857 CHECK(calls->log_meth != NULL);
2860 .this_arg = (void*) calls,
2862 .free = LDKLogger_JCalls_free,
2866 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new(JNIEnv *env, jclass clz, jobject o) {
2867 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2868 *res_ptr = LDKLogger_init(env, clz, o);
2869 return (long)res_ptr;
2871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
2872 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2873 LDKThirtyTwoBytes a_ref;
2874 CHECK((*env)->GetArrayLength(env, a) == 32);
2875 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
2877 LDKChannelManager b_conv;
2878 b_conv.inner = (void*)(b & (~1));
2879 b_conv.is_owned = (b & 1) || (b == 0);
2880 // Warning: we may need a move here but can't clone!
2884 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
2885 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2886 int8_tArray a_arr = (*env)->NewByteArray(env, 32);
2887 (*env)->SetByteArrayRegion(env, a_arr, 0, 32, tuple->a.data);
2890 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
2891 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2892 LDKChannelManager b_var = tuple->b;
2893 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2894 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2895 long b_ref = (long)b_var.inner & ~1;
2898 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2899 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2901 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2902 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2903 CHECK(val->result_ok);
2904 long res_ref = (long)&(*val->contents.result);
2907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2908 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2909 CHECK(!val->result_ok);
2910 LDKDecodeError err_var = (*val->contents.err);
2911 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2912 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2913 long err_ref = (long)err_var.inner & ~1;
2916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2917 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2919 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2920 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2921 CHECK(val->result_ok);
2922 long res_ref = (long)&(*val->contents.result);
2925 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2926 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2927 CHECK(!val->result_ok);
2928 return *val->contents.err;
2930 static inline LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_clone(const LDKCResult_NetAddressu8Z *orig) {
2931 LDKCResult_NetAddressu8Z res = { .result_ok = orig->result_ok };
2932 if (orig->result_ok) {
2933 LDKNetAddress* contents = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress result OK clone");
2934 *contents = NetAddress_clone(orig->contents.result);
2935 res.contents.result = contents;
2937 int8_t* contents = MALLOC(sizeof(int8_t), "int8_t result Err clone");
2938 *contents = *orig->contents.err;
2939 res.contents.err = contents;
2943 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2944 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
2947 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2948 CHECK(val->result_ok);
2949 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2950 *res_conv = (*val->contents.result);
2951 *res_conv = CResult_NetAddressu8Z_clone(res_conv);
2952 return (long)res_conv;
2954 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
2955 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2956 CHECK(!val->result_ok);
2957 LDKDecodeError err_var = (*val->contents.err);
2958 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2959 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2960 long err_ref = (long)err_var.inner & ~1;
2963 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2964 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2965 ret->datalen = (*env)->GetArrayLength(env, elems);
2966 if (ret->datalen == 0) {
2969 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2970 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2971 for (size_t i = 0; i < ret->datalen; i++) {
2972 ret->data[i] = java_elems[i];
2974 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2978 static inline LDKCVec_u64Z CVec_u64Z_clone(const LDKCVec_u64Z *orig) {
2979 LDKCVec_u64Z ret = { .data = MALLOC(sizeof(int64_t) * orig->datalen, "LDKCVec_u64Z clone bytes"), .datalen = orig->datalen };
2980 memcpy(ret.data, orig->data, sizeof(int64_t) * ret.datalen);
2983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
2984 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2985 ret->datalen = (*env)->GetArrayLength(env, elems);
2986 if (ret->datalen == 0) {
2989 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2990 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2991 for (size_t i = 0; i < ret->datalen; i++) {
2992 int64_t arr_elem = java_elems[i];
2993 LDKUpdateAddHTLC arr_elem_conv;
2994 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2995 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2996 if (arr_elem_conv.inner != NULL)
2997 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2998 ret->data[i] = arr_elem_conv;
3000 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3004 static inline LDKCVec_UpdateAddHTLCZ CVec_UpdateAddHTLCZ_clone(const LDKCVec_UpdateAddHTLCZ *orig) {
3005 LDKCVec_UpdateAddHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateAddHTLC) * orig->datalen, "LDKCVec_UpdateAddHTLCZ clone bytes"), .datalen = orig->datalen };
3006 for (size_t i = 0; i < ret.datalen; i++) {
3007 ret.data[i] = UpdateAddHTLC_clone(&orig->data[i]);
3011 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3012 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
3013 ret->datalen = (*env)->GetArrayLength(env, elems);
3014 if (ret->datalen == 0) {
3017 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
3018 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3019 for (size_t i = 0; i < ret->datalen; i++) {
3020 int64_t arr_elem = java_elems[i];
3021 LDKUpdateFulfillHTLC arr_elem_conv;
3022 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3023 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3024 if (arr_elem_conv.inner != NULL)
3025 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3026 ret->data[i] = arr_elem_conv;
3028 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3032 static inline LDKCVec_UpdateFulfillHTLCZ CVec_UpdateFulfillHTLCZ_clone(const LDKCVec_UpdateFulfillHTLCZ *orig) {
3033 LDKCVec_UpdateFulfillHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * orig->datalen, "LDKCVec_UpdateFulfillHTLCZ clone bytes"), .datalen = orig->datalen };
3034 for (size_t i = 0; i < ret.datalen; i++) {
3035 ret.data[i] = UpdateFulfillHTLC_clone(&orig->data[i]);
3039 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3040 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3041 ret->datalen = (*env)->GetArrayLength(env, elems);
3042 if (ret->datalen == 0) {
3045 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3046 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3047 for (size_t i = 0; i < ret->datalen; i++) {
3048 int64_t arr_elem = java_elems[i];
3049 LDKUpdateFailHTLC arr_elem_conv;
3050 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3051 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3052 if (arr_elem_conv.inner != NULL)
3053 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3054 ret->data[i] = arr_elem_conv;
3056 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3060 static inline LDKCVec_UpdateFailHTLCZ CVec_UpdateFailHTLCZ_clone(const LDKCVec_UpdateFailHTLCZ *orig) {
3061 LDKCVec_UpdateFailHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailHTLC) * orig->datalen, "LDKCVec_UpdateFailHTLCZ clone bytes"), .datalen = orig->datalen };
3062 for (size_t i = 0; i < ret.datalen; i++) {
3063 ret.data[i] = UpdateFailHTLC_clone(&orig->data[i]);
3067 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3068 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3069 ret->datalen = (*env)->GetArrayLength(env, elems);
3070 if (ret->datalen == 0) {
3073 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3074 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3075 for (size_t i = 0; i < ret->datalen; i++) {
3076 int64_t arr_elem = java_elems[i];
3077 LDKUpdateFailMalformedHTLC arr_elem_conv;
3078 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3079 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3080 if (arr_elem_conv.inner != NULL)
3081 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3082 ret->data[i] = arr_elem_conv;
3084 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3088 static inline LDKCVec_UpdateFailMalformedHTLCZ CVec_UpdateFailMalformedHTLCZ_clone(const LDKCVec_UpdateFailMalformedHTLCZ *orig) {
3089 LDKCVec_UpdateFailMalformedHTLCZ ret = { .data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * orig->datalen, "LDKCVec_UpdateFailMalformedHTLCZ clone bytes"), .datalen = orig->datalen };
3090 for (size_t i = 0; i < ret.datalen; i++) {
3091 ret.data[i] = UpdateFailMalformedHTLC_clone(&orig->data[i]);
3095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3096 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3099 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3100 CHECK(val->result_ok);
3101 return *val->contents.result;
3103 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3104 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3105 CHECK(!val->result_ok);
3106 LDKLightningError err_var = (*val->contents.err);
3107 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3108 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3109 long err_ref = (long)err_var.inner & ~1;
3112 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) {
3113 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3114 LDKChannelAnnouncement a_conv;
3115 a_conv.inner = (void*)(a & (~1));
3116 a_conv.is_owned = (a & 1) || (a == 0);
3117 if (a_conv.inner != NULL)
3118 a_conv = ChannelAnnouncement_clone(&a_conv);
3120 LDKChannelUpdate b_conv;
3121 b_conv.inner = (void*)(b & (~1));
3122 b_conv.is_owned = (b & 1) || (b == 0);
3123 if (b_conv.inner != NULL)
3124 b_conv = ChannelUpdate_clone(&b_conv);
3126 LDKChannelUpdate c_conv;
3127 c_conv.inner = (void*)(c & (~1));
3128 c_conv.is_owned = (c & 1) || (c == 0);
3129 if (c_conv.inner != NULL)
3130 c_conv = ChannelUpdate_clone(&c_conv);
3134 static inline LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *orig) {
3135 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret = {
3136 .a = ChannelAnnouncement_clone(&orig->a),
3137 .b = ChannelUpdate_clone(&orig->b),
3138 .c = ChannelUpdate_clone(&orig->c),
3142 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
3143 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3144 LDKChannelAnnouncement a_var = tuple->a;
3145 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3146 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3147 long a_ref = (long)a_var.inner & ~1;
3150 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
3151 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3152 LDKChannelUpdate b_var = tuple->b;
3153 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3154 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3155 long b_ref = (long)b_var.inner & ~1;
3158 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *env, jclass clz, int64_t ptr) {
3159 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3160 LDKChannelUpdate c_var = tuple->c;
3161 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3162 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3163 long c_ref = (long)c_var.inner & ~1;
3166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3167 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3168 ret->datalen = (*env)->GetArrayLength(env, elems);
3169 if (ret->datalen == 0) {
3172 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
3173 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3174 for (size_t i = 0; i < ret->datalen; i++) {
3175 int64_t arr_elem = java_elems[i];
3176 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_elem;
3177 FREE((void*)arr_elem);
3178 ret->data[i] = arr_elem_conv;
3180 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3184 static inline LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *orig) {
3185 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret = { .data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * orig->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ clone bytes"), .datalen = orig->datalen };
3186 for (size_t i = 0; i < ret.datalen; i++) {
3187 ret.data[i] = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(&orig->data[i]);
3191 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3192 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3193 ret->datalen = (*env)->GetArrayLength(env, elems);
3194 if (ret->datalen == 0) {
3197 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
3198 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3199 for (size_t i = 0; i < ret->datalen; i++) {
3200 int64_t arr_elem = java_elems[i];
3201 LDKNodeAnnouncement arr_elem_conv;
3202 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3203 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3204 if (arr_elem_conv.inner != NULL)
3205 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3206 ret->data[i] = arr_elem_conv;
3208 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3212 static inline LDKCVec_NodeAnnouncementZ CVec_NodeAnnouncementZ_clone(const LDKCVec_NodeAnnouncementZ *orig) {
3213 LDKCVec_NodeAnnouncementZ ret = { .data = MALLOC(sizeof(LDKNodeAnnouncement) * orig->datalen, "LDKCVec_NodeAnnouncementZ clone bytes"), .datalen = orig->datalen };
3214 for (size_t i = 0; i < ret.datalen; i++) {
3215 ret.data[i] = NodeAnnouncement_clone(&orig->data[i]);
3219 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3220 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3223 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
3224 CHECK(val->result_ok);
3225 return *val->contents.result;
3227 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3228 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
3229 CHECK(!val->result_ok);
3230 LDKLightningError err_var = (*val->contents.err);
3231 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3232 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3233 long err_ref = (long)err_var.inner & ~1;
3236 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3237 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3239 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3240 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
3241 CHECK(val->result_ok);
3242 LDKChannelReestablish res_var = (*val->contents.result);
3243 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3244 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3245 long res_ref = (long)res_var.inner & ~1;
3248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3249 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
3250 CHECK(!val->result_ok);
3251 LDKDecodeError err_var = (*val->contents.err);
3252 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3253 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3254 long err_ref = (long)err_var.inner & ~1;
3257 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3258 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3260 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3261 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
3262 CHECK(val->result_ok);
3263 LDKInit res_var = (*val->contents.result);
3264 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3265 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3266 long res_ref = (long)res_var.inner & ~1;
3269 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3270 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
3271 CHECK(!val->result_ok);
3272 LDKDecodeError err_var = (*val->contents.err);
3273 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3274 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3275 long err_ref = (long)err_var.inner & ~1;
3278 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3279 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3281 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3282 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
3283 CHECK(val->result_ok);
3284 LDKPing res_var = (*val->contents.result);
3285 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3286 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3287 long res_ref = (long)res_var.inner & ~1;
3290 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3291 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
3292 CHECK(!val->result_ok);
3293 LDKDecodeError err_var = (*val->contents.err);
3294 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3295 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3296 long err_ref = (long)err_var.inner & ~1;
3299 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3300 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3302 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3303 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
3304 CHECK(val->result_ok);
3305 LDKPong res_var = (*val->contents.result);
3306 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3307 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3308 long res_ref = (long)res_var.inner & ~1;
3311 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3312 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
3313 CHECK(!val->result_ok);
3314 LDKDecodeError err_var = (*val->contents.err);
3315 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3316 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3317 long err_ref = (long)err_var.inner & ~1;
3320 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3321 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3323 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3324 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
3325 CHECK(val->result_ok);
3326 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3327 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3328 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3329 long res_ref = (long)res_var.inner & ~1;
3332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3333 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
3334 CHECK(!val->result_ok);
3335 LDKDecodeError err_var = (*val->contents.err);
3336 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3337 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3338 long err_ref = (long)err_var.inner & ~1;
3341 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3342 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3344 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3345 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
3346 CHECK(val->result_ok);
3347 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3348 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3349 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3350 long res_ref = (long)res_var.inner & ~1;
3353 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3354 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
3355 CHECK(!val->result_ok);
3356 LDKDecodeError err_var = (*val->contents.err);
3357 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3358 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3359 long err_ref = (long)err_var.inner & ~1;
3362 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3363 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3365 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3366 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
3367 CHECK(val->result_ok);
3368 LDKErrorMessage res_var = (*val->contents.result);
3369 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3370 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3371 long res_ref = (long)res_var.inner & ~1;
3374 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3375 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
3376 CHECK(!val->result_ok);
3377 LDKDecodeError err_var = (*val->contents.err);
3378 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3379 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3380 long err_ref = (long)err_var.inner & ~1;
3383 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3384 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3386 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3387 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
3388 CHECK(val->result_ok);
3389 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3390 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3391 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3392 long res_ref = (long)res_var.inner & ~1;
3395 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3396 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
3397 CHECK(!val->result_ok);
3398 LDKDecodeError err_var = (*val->contents.err);
3399 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3400 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3401 long err_ref = (long)err_var.inner & ~1;
3404 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3405 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3407 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3408 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
3409 CHECK(val->result_ok);
3410 LDKQueryShortChannelIds res_var = (*val->contents.result);
3411 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3412 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3413 long res_ref = (long)res_var.inner & ~1;
3416 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3417 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
3418 CHECK(!val->result_ok);
3419 LDKDecodeError err_var = (*val->contents.err);
3420 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3421 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3422 long err_ref = (long)err_var.inner & ~1;
3425 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3426 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3428 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3429 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
3430 CHECK(val->result_ok);
3431 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3432 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3433 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3434 long res_ref = (long)res_var.inner & ~1;
3437 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3438 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
3439 CHECK(!val->result_ok);
3440 LDKDecodeError err_var = (*val->contents.err);
3441 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3442 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3443 long err_ref = (long)err_var.inner & ~1;
3446 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3447 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3449 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3450 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
3451 CHECK(val->result_ok);
3452 LDKQueryChannelRange res_var = (*val->contents.result);
3453 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3454 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3455 long res_ref = (long)res_var.inner & ~1;
3458 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3459 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
3460 CHECK(!val->result_ok);
3461 LDKDecodeError err_var = (*val->contents.err);
3462 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3463 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3464 long err_ref = (long)err_var.inner & ~1;
3467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3468 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3471 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
3472 CHECK(val->result_ok);
3473 LDKReplyChannelRange res_var = (*val->contents.result);
3474 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3475 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3476 long res_ref = (long)res_var.inner & ~1;
3479 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3480 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
3481 CHECK(!val->result_ok);
3482 LDKDecodeError 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_1GossipTimestampFilterDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3489 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3492 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
3493 CHECK(val->result_ok);
3494 LDKGossipTimestampFilter res_var = (*val->contents.result);
3495 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3496 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3497 long res_ref = (long)res_var.inner & ~1;
3500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3501 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
3502 CHECK(!val->result_ok);
3503 LDKDecodeError err_var = (*val->contents.err);
3504 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3505 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3506 long err_ref = (long)err_var.inner & ~1;
3509 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3510 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3512 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3513 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3514 CHECK(val->result_ok);
3515 LDKCVec_u8Z res_var = (*val->contents.result);
3516 int8_tArray res_arr = (*env)->NewByteArray(env, res_var.datalen);
3517 (*env)->SetByteArrayRegion(env, res_arr, 0, res_var.datalen, res_var.data);
3520 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3521 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3522 CHECK(!val->result_ok);
3523 LDKPeerHandleError err_var = (*val->contents.err);
3524 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3525 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3526 long err_ref = (long)err_var.inner & ~1;
3529 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3530 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3533 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
3534 CHECK(val->result_ok);
3535 return *val->contents.result;
3537 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3538 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
3539 CHECK(!val->result_ok);
3540 LDKPeerHandleError err_var = (*val->contents.err);
3541 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3542 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3543 long err_ref = (long)err_var.inner & ~1;
3546 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3547 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3549 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3550 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3551 CHECK(val->result_ok);
3552 return *val->contents.result;
3554 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3555 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3556 CHECK(!val->result_ok);
3557 LDKPeerHandleError err_var = (*val->contents.err);
3558 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3559 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3560 long err_ref = (long)err_var.inner & ~1;
3563 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3564 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3566 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3567 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3568 CHECK(val->result_ok);
3569 int8_tArray res_arr = (*env)->NewByteArray(env, 32);
3570 (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).bytes);
3573 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3574 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3575 CHECK(!val->result_ok);
3576 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3580 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3582 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3583 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3584 CHECK(val->result_ok);
3585 int8_tArray res_arr = (*env)->NewByteArray(env, 33);
3586 (*env)->SetByteArrayRegion(env, res_arr, 0, 33, (*val->contents.result).compressed_form);
3589 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3590 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3591 CHECK(!val->result_ok);
3592 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3595 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3596 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3599 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3600 CHECK(val->result_ok);
3601 LDKTxCreationKeys res_var = (*val->contents.result);
3602 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3603 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3604 long res_ref = (long)res_var.inner & ~1;
3607 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3608 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3609 CHECK(!val->result_ok);
3610 jclass err_conv = LDKSecp256k1Error_to_java(env, (*val->contents.err));
3613 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3614 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
3616 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3617 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
3618 CHECK(val->result_ok);
3619 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
3620 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3621 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3622 long res_ref = (long)res_var.inner & ~1;
3625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3626 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
3627 CHECK(!val->result_ok);
3628 return *val->contents.err;
3630 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3631 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3632 ret->datalen = (*env)->GetArrayLength(env, elems);
3633 if (ret->datalen == 0) {
3636 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3637 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3638 for (size_t i = 0; i < ret->datalen; i++) {
3639 int64_t arr_elem = java_elems[i];
3640 LDKRouteHop arr_elem_conv;
3641 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3642 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3643 if (arr_elem_conv.inner != NULL)
3644 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3645 ret->data[i] = arr_elem_conv;
3647 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3651 static inline LDKCVec_RouteHopZ CVec_RouteHopZ_clone(const LDKCVec_RouteHopZ *orig) {
3652 LDKCVec_RouteHopZ ret = { .data = MALLOC(sizeof(LDKRouteHop) * orig->datalen, "LDKCVec_RouteHopZ clone bytes"), .datalen = orig->datalen };
3653 for (size_t i = 0; i < ret.datalen; i++) {
3654 ret.data[i] = RouteHop_clone(&orig->data[i]);
3658 static inline LDKCVec_CVec_RouteHopZZ CVec_CVec_RouteHopZZ_clone(const LDKCVec_CVec_RouteHopZZ *orig) {
3659 LDKCVec_CVec_RouteHopZZ ret = { .data = MALLOC(sizeof(LDKCVec_RouteHopZ) * orig->datalen, "LDKCVec_CVec_RouteHopZZ clone bytes"), .datalen = orig->datalen };
3660 for (size_t i = 0; i < ret.datalen; i++) {
3661 ret.data[i] = CVec_RouteHopZ_clone(&orig->data[i]);
3665 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3666 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3668 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3669 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
3670 CHECK(val->result_ok);
3671 LDKRoute res_var = (*val->contents.result);
3672 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3673 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3674 long res_ref = (long)res_var.inner & ~1;
3677 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3678 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
3679 CHECK(!val->result_ok);
3680 LDKDecodeError err_var = (*val->contents.err);
3681 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3682 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3683 long err_ref = (long)err_var.inner & ~1;
3686 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
3687 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3688 ret->datalen = (*env)->GetArrayLength(env, elems);
3689 if (ret->datalen == 0) {
3692 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3693 int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3694 for (size_t i = 0; i < ret->datalen; i++) {
3695 int64_t arr_elem = java_elems[i];
3696 LDKRouteHint arr_elem_conv;
3697 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3698 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3699 if (arr_elem_conv.inner != NULL)
3700 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3701 ret->data[i] = arr_elem_conv;
3703 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3707 static inline LDKCVec_RouteHintZ CVec_RouteHintZ_clone(const LDKCVec_RouteHintZ *orig) {
3708 LDKCVec_RouteHintZ ret = { .data = MALLOC(sizeof(LDKRouteHint) * orig->datalen, "LDKCVec_RouteHintZ clone bytes"), .datalen = orig->datalen };
3709 for (size_t i = 0; i < ret.datalen; i++) {
3710 ret.data[i] = RouteHint_clone(&orig->data[i]);
3714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3715 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3717 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3718 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3719 CHECK(val->result_ok);
3720 LDKRoute res_var = (*val->contents.result);
3721 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3722 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3723 long res_ref = (long)res_var.inner & ~1;
3726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3727 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3728 CHECK(!val->result_ok);
3729 LDKLightningError err_var = (*val->contents.err);
3730 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3731 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3732 long err_ref = (long)err_var.inner & ~1;
3735 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3736 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3739 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
3740 CHECK(val->result_ok);
3741 LDKRoutingFees res_var = (*val->contents.result);
3742 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3743 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3744 long res_ref = (long)res_var.inner & ~1;
3747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3748 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
3749 CHECK(!val->result_ok);
3750 LDKDecodeError err_var = (*val->contents.err);
3751 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3752 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3753 long err_ref = (long)err_var.inner & ~1;
3756 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3757 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3759 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3760 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
3761 CHECK(val->result_ok);
3762 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3763 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3764 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3765 long res_ref = (long)res_var.inner & ~1;
3768 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3769 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
3770 CHECK(!val->result_ok);
3771 LDKDecodeError err_var = (*val->contents.err);
3772 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3773 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3774 long err_ref = (long)err_var.inner & ~1;
3777 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3778 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3781 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3782 CHECK(val->result_ok);
3783 LDKNodeInfo res_var = (*val->contents.result);
3784 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3785 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3786 long res_ref = (long)res_var.inner & ~1;
3789 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3790 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3791 CHECK(!val->result_ok);
3792 LDKDecodeError err_var = (*val->contents.err);
3793 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3794 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3795 long err_ref = (long)err_var.inner & ~1;
3798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3799 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3801 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
3802 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3803 CHECK(val->result_ok);
3804 LDKNetworkGraph res_var = (*val->contents.result);
3805 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3806 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3807 long res_ref = (long)res_var.inner & ~1;
3810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
3811 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3812 CHECK(!val->result_ok);
3813 LDKDecodeError err_var = (*val->contents.err);
3814 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3815 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3816 long err_ref = (long)err_var.inner & ~1;
3819 typedef struct LDKMessageSendEventsProvider_JCalls {
3820 atomic_size_t refcnt;
3823 jmethodID get_and_clear_pending_msg_events_meth;
3824 } LDKMessageSendEventsProvider_JCalls;
3825 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3826 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3827 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3829 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3830 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3834 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3835 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3837 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3838 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3840 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
3841 LDKCVec_MessageSendEventZ arg_constr;
3842 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3843 if (arg_constr.datalen > 0)
3844 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3846 arg_constr.data = NULL;
3847 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3848 for (size_t s = 0; s < arg_constr.datalen; s++) {
3849 int64_t arr_conv_18 = arg_vals[s];
3850 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
3851 FREE((void*)arr_conv_18);
3852 arg_constr.data[s] = arr_conv_18_conv;
3854 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3857 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3858 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3859 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3860 return (void*) this_arg;
3862 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3863 jclass c = (*env)->GetObjectClass(env, o);
3865 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3866 atomic_init(&calls->refcnt, 1);
3867 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3868 calls->o = (*env)->NewWeakGlobalRef(env, o);
3869 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
3870 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
3872 LDKMessageSendEventsProvider ret = {
3873 .this_arg = (void*) calls,
3874 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3875 .free = LDKMessageSendEventsProvider_JCalls_free,
3879 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3880 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3881 *res_ptr = LDKMessageSendEventsProvider_init(env, clz, o);
3882 return (long)res_ptr;
3884 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3885 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3886 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3887 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3888 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3889 for (size_t s = 0; s < ret_var.datalen; s++) {
3890 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3891 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
3892 long arr_conv_18_ref = (long)arr_conv_18_copy;
3893 ret_arr_ptr[s] = arr_conv_18_ref;
3895 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3900 typedef struct LDKEventsProvider_JCalls {
3901 atomic_size_t refcnt;
3904 jmethodID get_and_clear_pending_events_meth;
3905 } LDKEventsProvider_JCalls;
3906 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3907 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3908 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3910 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3911 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3915 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3916 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3918 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3919 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3921 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
3922 LDKCVec_EventZ arg_constr;
3923 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
3924 if (arg_constr.datalen > 0)
3925 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3927 arg_constr.data = NULL;
3928 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
3929 for (size_t h = 0; h < arg_constr.datalen; h++) {
3930 int64_t arr_conv_7 = arg_vals[h];
3931 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
3932 FREE((void*)arr_conv_7);
3933 arg_constr.data[h] = arr_conv_7_conv;
3935 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
3938 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3939 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3940 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3941 return (void*) this_arg;
3943 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
3944 jclass c = (*env)->GetObjectClass(env, o);
3946 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3947 atomic_init(&calls->refcnt, 1);
3948 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3949 calls->o = (*env)->NewWeakGlobalRef(env, o);
3950 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
3951 CHECK(calls->get_and_clear_pending_events_meth != NULL);
3953 LDKEventsProvider ret = {
3954 .this_arg = (void*) calls,
3955 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3956 .free = LDKEventsProvider_JCalls_free,
3960 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new(JNIEnv *env, jclass clz, jobject o) {
3961 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3962 *res_ptr = LDKEventsProvider_init(env, clz, o);
3963 return (long)res_ptr;
3965 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
3966 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3967 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3968 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
3969 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
3970 for (size_t h = 0; h < ret_var.datalen; h++) {
3971 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3972 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
3973 long arr_conv_7_ref = (long)arr_conv_7_copy;
3974 ret_arr_ptr[h] = arr_conv_7_ref;
3976 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
3981 typedef struct LDKAccess_JCalls {
3982 atomic_size_t refcnt;
3985 jmethodID get_utxo_meth;
3987 static void LDKAccess_JCalls_free(void* this_arg) {
3988 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3989 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3991 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3992 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3996 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
3997 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3999 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4000 int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
4001 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
4002 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4004 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
4005 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
4006 ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)ret);
4009 static void* LDKAccess_JCalls_clone(const void* this_arg) {
4010 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
4011 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4012 return (void*) this_arg;
4014 static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
4015 jclass c = (*env)->GetObjectClass(env, o);
4017 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
4018 atomic_init(&calls->refcnt, 1);
4019 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4020 calls->o = (*env)->NewWeakGlobalRef(env, o);
4021 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
4022 CHECK(calls->get_utxo_meth != NULL);
4025 .this_arg = (void*) calls,
4026 .get_utxo = get_utxo_jcall,
4027 .free = LDKAccess_JCalls_free,
4031 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
4032 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4033 *res_ptr = LDKAccess_init(env, clz, o);
4034 return (long)res_ptr;
4036 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) {
4037 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
4038 unsigned char genesis_hash_arr[32];
4039 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
4040 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
4041 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4042 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4043 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4044 return (long)ret_conv;
4047 typedef struct LDKFilter_JCalls {
4048 atomic_size_t refcnt;
4051 jmethodID register_tx_meth;
4052 jmethodID register_output_meth;
4054 static void LDKFilter_JCalls_free(void* this_arg) {
4055 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4056 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4058 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4059 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4063 void register_tx_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
4064 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4066 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4067 int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
4068 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
4069 LDKu8slice script_pubkey_var = script_pubkey;
4070 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4071 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4072 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4074 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4076 void register_output_jcall(const void* this_arg, const LDKOutPoint * outpoint, LDKu8slice script_pubkey) {
4077 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4079 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4080 LDKOutPoint outpoint_var = *outpoint;
4081 if (outpoint->inner != NULL)
4082 outpoint_var = OutPoint_clone(outpoint);
4083 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4084 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4085 long outpoint_ref = (long)outpoint_var.inner;
4086 if (outpoint_var.is_owned) {
4089 LDKu8slice script_pubkey_var = script_pubkey;
4090 int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
4091 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4092 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4094 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4096 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4097 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4098 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4099 return (void*) this_arg;
4101 static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
4102 jclass c = (*env)->GetObjectClass(env, o);
4104 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4105 atomic_init(&calls->refcnt, 1);
4106 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4107 calls->o = (*env)->NewWeakGlobalRef(env, o);
4108 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
4109 CHECK(calls->register_tx_meth != NULL);
4110 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
4111 CHECK(calls->register_output_meth != NULL);
4114 .this_arg = (void*) calls,
4115 .register_tx = register_tx_jcall,
4116 .register_output = register_output_jcall,
4117 .free = LDKFilter_JCalls_free,
4121 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
4122 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4123 *res_ptr = LDKFilter_init(env, clz, o);
4124 return (long)res_ptr;
4126 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) {
4127 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4128 unsigned char txid_arr[32];
4129 CHECK((*env)->GetArrayLength(env, txid) == 32);
4130 (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
4131 unsigned char (*txid_ref)[32] = &txid_arr;
4132 LDKu8slice script_pubkey_ref;
4133 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4134 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4135 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4136 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4139 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) {
4140 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4141 LDKOutPoint outpoint_conv;
4142 outpoint_conv.inner = (void*)(outpoint & (~1));
4143 outpoint_conv.is_owned = false;
4144 LDKu8slice script_pubkey_ref;
4145 script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
4146 script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
4147 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4148 (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4151 typedef struct LDKPersist_JCalls {
4152 atomic_size_t refcnt;
4155 jmethodID persist_new_channel_meth;
4156 jmethodID update_persisted_channel_meth;
4157 } LDKPersist_JCalls;
4158 static void LDKPersist_JCalls_free(void* this_arg) {
4159 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4160 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4162 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4163 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4167 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
4168 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4170 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4171 LDKOutPoint id_var = id;
4172 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4173 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4174 long id_ref = (long)id_var.inner;
4175 if (id_var.is_owned) {
4178 LDKChannelMonitor data_var = *data;
4179 // Warning: we may need a move here but can't clone!
4180 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4181 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4182 long data_ref = (long)data_var.inner;
4183 if (data_var.is_owned) {
4186 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4188 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
4189 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
4190 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4193 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
4194 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4196 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4197 LDKOutPoint id_var = id;
4198 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4199 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4200 long id_ref = (long)id_var.inner;
4201 if (id_var.is_owned) {
4204 LDKChannelMonitorUpdate update_var = *update;
4205 if (update->inner != NULL)
4206 update_var = ChannelMonitorUpdate_clone(update);
4207 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4208 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4209 long update_ref = (long)update_var.inner;
4210 if (update_var.is_owned) {
4213 LDKChannelMonitor data_var = *data;
4214 // Warning: we may need a move here but can't clone!
4215 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4216 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4217 long data_ref = (long)data_var.inner;
4218 if (data_var.is_owned) {
4221 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4223 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4224 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
4225 ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)ret);
4228 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4229 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4230 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4231 return (void*) this_arg;
4233 static inline LDKPersist LDKPersist_init (JNIEnv *env, jclass clz, jobject o) {
4234 jclass c = (*env)->GetObjectClass(env, o);
4236 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4237 atomic_init(&calls->refcnt, 1);
4238 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4239 calls->o = (*env)->NewWeakGlobalRef(env, o);
4240 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
4241 CHECK(calls->persist_new_channel_meth != NULL);
4242 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
4243 CHECK(calls->update_persisted_channel_meth != NULL);
4246 .this_arg = (void*) calls,
4247 .persist_new_channel = persist_new_channel_jcall,
4248 .update_persisted_channel = update_persisted_channel_jcall,
4249 .free = LDKPersist_JCalls_free,
4253 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new(JNIEnv *env, jclass clz, jobject o) {
4254 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4255 *res_ptr = LDKPersist_init(env, clz, o);
4256 return (long)res_ptr;
4258 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) {
4259 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4260 LDKOutPoint id_conv;
4261 id_conv.inner = (void*)(id & (~1));
4262 id_conv.is_owned = (id & 1) || (id == 0);
4263 if (id_conv.inner != NULL)
4264 id_conv = OutPoint_clone(&id_conv);
4265 LDKChannelMonitor data_conv;
4266 data_conv.inner = (void*)(data & (~1));
4267 data_conv.is_owned = false;
4268 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4269 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4270 return (long)ret_conv;
4273 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) {
4274 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4275 LDKOutPoint id_conv;
4276 id_conv.inner = (void*)(id & (~1));
4277 id_conv.is_owned = (id & 1) || (id == 0);
4278 if (id_conv.inner != NULL)
4279 id_conv = OutPoint_clone(&id_conv);
4280 LDKChannelMonitorUpdate update_conv;
4281 update_conv.inner = (void*)(update & (~1));
4282 update_conv.is_owned = false;
4283 LDKChannelMonitor data_conv;
4284 data_conv.inner = (void*)(data & (~1));
4285 data_conv.is_owned = false;
4286 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4287 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4288 return (long)ret_conv;
4291 typedef struct LDKChannelMessageHandler_JCalls {
4292 atomic_size_t refcnt;
4295 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4296 jmethodID handle_open_channel_meth;
4297 jmethodID handle_accept_channel_meth;
4298 jmethodID handle_funding_created_meth;
4299 jmethodID handle_funding_signed_meth;
4300 jmethodID handle_funding_locked_meth;
4301 jmethodID handle_shutdown_meth;
4302 jmethodID handle_closing_signed_meth;
4303 jmethodID handle_update_add_htlc_meth;
4304 jmethodID handle_update_fulfill_htlc_meth;
4305 jmethodID handle_update_fail_htlc_meth;
4306 jmethodID handle_update_fail_malformed_htlc_meth;
4307 jmethodID handle_commitment_signed_meth;
4308 jmethodID handle_revoke_and_ack_meth;
4309 jmethodID handle_update_fee_meth;
4310 jmethodID handle_announcement_signatures_meth;
4311 jmethodID peer_disconnected_meth;
4312 jmethodID peer_connected_meth;
4313 jmethodID handle_channel_reestablish_meth;
4314 jmethodID handle_error_meth;
4315 } LDKChannelMessageHandler_JCalls;
4316 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4317 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4318 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4320 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4321 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4325 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel * msg) {
4326 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4328 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4329 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4330 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4331 LDKInitFeatures their_features_var = their_features;
4332 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4333 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4334 long their_features_ref = (long)their_features_var.inner;
4335 if (their_features_var.is_owned) {
4336 their_features_ref |= 1;
4338 LDKOpenChannel msg_var = *msg;
4339 if (msg->inner != NULL)
4340 msg_var = OpenChannel_clone(msg);
4341 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4342 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4343 long msg_ref = (long)msg_var.inner;
4344 if (msg_var.is_owned) {
4347 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4349 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4351 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel * msg) {
4352 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4354 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4355 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4356 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4357 LDKInitFeatures their_features_var = their_features;
4358 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4359 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4360 long their_features_ref = (long)their_features_var.inner;
4361 if (their_features_var.is_owned) {
4362 their_features_ref |= 1;
4364 LDKAcceptChannel msg_var = *msg;
4365 if (msg->inner != NULL)
4366 msg_var = AcceptChannel_clone(msg);
4367 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4368 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4369 long msg_ref = (long)msg_var.inner;
4370 if (msg_var.is_owned) {
4373 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4375 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4377 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated * msg) {
4378 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4380 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4381 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4382 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4383 LDKFundingCreated msg_var = *msg;
4384 if (msg->inner != NULL)
4385 msg_var = FundingCreated_clone(msg);
4386 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4387 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4388 long msg_ref = (long)msg_var.inner;
4389 if (msg_var.is_owned) {
4392 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4394 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4396 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned * msg) {
4397 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4399 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4400 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4401 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4402 LDKFundingSigned msg_var = *msg;
4403 if (msg->inner != NULL)
4404 msg_var = FundingSigned_clone(msg);
4405 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4406 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4407 long msg_ref = (long)msg_var.inner;
4408 if (msg_var.is_owned) {
4411 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4413 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4415 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked * msg) {
4416 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4418 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4419 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4420 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4421 LDKFundingLocked msg_var = *msg;
4422 if (msg->inner != NULL)
4423 msg_var = FundingLocked_clone(msg);
4424 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4425 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4426 long msg_ref = (long)msg_var.inner;
4427 if (msg_var.is_owned) {
4430 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4432 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4434 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown * msg) {
4435 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4437 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4438 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4439 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4440 LDKShutdown msg_var = *msg;
4441 if (msg->inner != NULL)
4442 msg_var = Shutdown_clone(msg);
4443 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4444 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4445 long msg_ref = (long)msg_var.inner;
4446 if (msg_var.is_owned) {
4449 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4451 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
4453 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned * msg) {
4454 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4456 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4457 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4458 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4459 LDKClosingSigned msg_var = *msg;
4460 if (msg->inner != NULL)
4461 msg_var = ClosingSigned_clone(msg);
4462 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4463 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4464 long msg_ref = (long)msg_var.inner;
4465 if (msg_var.is_owned) {
4468 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4470 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4472 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC * msg) {
4473 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4475 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4476 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4477 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4478 LDKUpdateAddHTLC msg_var = *msg;
4479 if (msg->inner != NULL)
4480 msg_var = UpdateAddHTLC_clone(msg);
4481 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4482 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4483 long msg_ref = (long)msg_var.inner;
4484 if (msg_var.is_owned) {
4487 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4489 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4491 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC * msg) {
4492 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4494 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4495 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4496 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4497 LDKUpdateFulfillHTLC msg_var = *msg;
4498 if (msg->inner != NULL)
4499 msg_var = UpdateFulfillHTLC_clone(msg);
4500 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4501 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4502 long msg_ref = (long)msg_var.inner;
4503 if (msg_var.is_owned) {
4506 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4508 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4510 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC * msg) {
4511 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4513 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4514 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4515 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4516 LDKUpdateFailHTLC msg_var = *msg;
4517 if (msg->inner != NULL)
4518 msg_var = UpdateFailHTLC_clone(msg);
4519 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4520 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4521 long msg_ref = (long)msg_var.inner;
4522 if (msg_var.is_owned) {
4525 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4527 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4529 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC * msg) {
4530 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4532 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4533 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4534 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4535 LDKUpdateFailMalformedHTLC msg_var = *msg;
4536 if (msg->inner != NULL)
4537 msg_var = UpdateFailMalformedHTLC_clone(msg);
4538 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4539 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4540 long msg_ref = (long)msg_var.inner;
4541 if (msg_var.is_owned) {
4544 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4546 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4548 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned * msg) {
4549 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4551 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4552 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4553 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4554 LDKCommitmentSigned msg_var = *msg;
4555 if (msg->inner != NULL)
4556 msg_var = CommitmentSigned_clone(msg);
4557 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4558 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4559 long msg_ref = (long)msg_var.inner;
4560 if (msg_var.is_owned) {
4563 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4565 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4567 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK * msg) {
4568 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4570 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4571 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4572 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4573 LDKRevokeAndACK msg_var = *msg;
4574 if (msg->inner != NULL)
4575 msg_var = RevokeAndACK_clone(msg);
4576 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4577 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4578 long msg_ref = (long)msg_var.inner;
4579 if (msg_var.is_owned) {
4582 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4584 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4586 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee * msg) {
4587 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4589 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4590 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4591 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4592 LDKUpdateFee msg_var = *msg;
4593 if (msg->inner != NULL)
4594 msg_var = UpdateFee_clone(msg);
4595 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4596 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4597 long msg_ref = (long)msg_var.inner;
4598 if (msg_var.is_owned) {
4601 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4603 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4605 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures * msg) {
4606 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4608 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4609 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4610 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4611 LDKAnnouncementSignatures msg_var = *msg;
4612 if (msg->inner != NULL)
4613 msg_var = AnnouncementSignatures_clone(msg);
4614 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4615 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4616 long msg_ref = (long)msg_var.inner;
4617 if (msg_var.is_owned) {
4620 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4622 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4624 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
4625 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4627 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4628 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4629 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4630 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4632 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4634 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * msg) {
4635 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4637 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4638 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4639 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4640 LDKInit msg_var = *msg;
4641 if (msg->inner != NULL)
4642 msg_var = Init_clone(msg);
4643 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4644 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4645 long msg_ref = (long)msg_var.inner;
4646 if (msg_var.is_owned) {
4649 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4651 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4653 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish * msg) {
4654 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4656 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4657 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4658 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4659 LDKChannelReestablish msg_var = *msg;
4660 if (msg->inner != NULL)
4661 msg_var = ChannelReestablish_clone(msg);
4662 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4663 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4664 long msg_ref = (long)msg_var.inner;
4665 if (msg_var.is_owned) {
4668 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4670 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4672 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage * msg) {
4673 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4675 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4676 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
4677 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4678 LDKErrorMessage msg_var = *msg;
4679 if (msg->inner != NULL)
4680 msg_var = ErrorMessage_clone(msg);
4681 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4682 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4683 long msg_ref = (long)msg_var.inner;
4684 if (msg_var.is_owned) {
4687 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
4689 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4691 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4692 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4693 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4694 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4695 return (void*) this_arg;
4697 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4698 jclass c = (*env)->GetObjectClass(env, o);
4700 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4701 atomic_init(&calls->refcnt, 1);
4702 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4703 calls->o = (*env)->NewWeakGlobalRef(env, o);
4704 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
4705 CHECK(calls->handle_open_channel_meth != NULL);
4706 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
4707 CHECK(calls->handle_accept_channel_meth != NULL);
4708 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
4709 CHECK(calls->handle_funding_created_meth != NULL);
4710 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
4711 CHECK(calls->handle_funding_signed_meth != NULL);
4712 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
4713 CHECK(calls->handle_funding_locked_meth != NULL);
4714 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
4715 CHECK(calls->handle_shutdown_meth != NULL);
4716 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
4717 CHECK(calls->handle_closing_signed_meth != NULL);
4718 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
4719 CHECK(calls->handle_update_add_htlc_meth != NULL);
4720 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
4721 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
4722 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
4723 CHECK(calls->handle_update_fail_htlc_meth != NULL);
4724 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
4725 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
4726 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
4727 CHECK(calls->handle_commitment_signed_meth != NULL);
4728 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
4729 CHECK(calls->handle_revoke_and_ack_meth != NULL);
4730 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
4731 CHECK(calls->handle_update_fee_meth != NULL);
4732 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
4733 CHECK(calls->handle_announcement_signatures_meth != NULL);
4734 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
4735 CHECK(calls->peer_disconnected_meth != NULL);
4736 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
4737 CHECK(calls->peer_connected_meth != NULL);
4738 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
4739 CHECK(calls->handle_channel_reestablish_meth != NULL);
4740 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
4741 CHECK(calls->handle_error_meth != NULL);
4743 LDKChannelMessageHandler ret = {
4744 .this_arg = (void*) calls,
4745 .handle_open_channel = handle_open_channel_jcall,
4746 .handle_accept_channel = handle_accept_channel_jcall,
4747 .handle_funding_created = handle_funding_created_jcall,
4748 .handle_funding_signed = handle_funding_signed_jcall,
4749 .handle_funding_locked = handle_funding_locked_jcall,
4750 .handle_shutdown = handle_shutdown_jcall,
4751 .handle_closing_signed = handle_closing_signed_jcall,
4752 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4753 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4754 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4755 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4756 .handle_commitment_signed = handle_commitment_signed_jcall,
4757 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4758 .handle_update_fee = handle_update_fee_jcall,
4759 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4760 .peer_disconnected = peer_disconnected_jcall,
4761 .peer_connected = peer_connected_jcall,
4762 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4763 .handle_error = handle_error_jcall,
4764 .free = LDKChannelMessageHandler_JCalls_free,
4765 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
4767 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4770 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
4771 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4772 *res_ptr = LDKChannelMessageHandler_init(env, clz, o, MessageSendEventsProvider);
4773 return (long)res_ptr;
4775 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) {
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 LDKInitFeatures their_features_conv;
4781 their_features_conv.inner = (void*)(their_features & (~1));
4782 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4783 // Warning: we may need a move here but can't clone!
4784 LDKOpenChannel msg_conv;
4785 msg_conv.inner = (void*)(msg & (~1));
4786 msg_conv.is_owned = false;
4787 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4790 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) {
4791 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4792 LDKPublicKey their_node_id_ref;
4793 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4794 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4795 LDKInitFeatures their_features_conv;
4796 their_features_conv.inner = (void*)(their_features & (~1));
4797 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4798 // Warning: we may need a move here but can't clone!
4799 LDKAcceptChannel msg_conv;
4800 msg_conv.inner = (void*)(msg & (~1));
4801 msg_conv.is_owned = false;
4802 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4805 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) {
4806 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4807 LDKPublicKey their_node_id_ref;
4808 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4809 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4810 LDKFundingCreated msg_conv;
4811 msg_conv.inner = (void*)(msg & (~1));
4812 msg_conv.is_owned = false;
4813 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4816 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) {
4817 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4818 LDKPublicKey their_node_id_ref;
4819 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4820 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4821 LDKFundingSigned msg_conv;
4822 msg_conv.inner = (void*)(msg & (~1));
4823 msg_conv.is_owned = false;
4824 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4827 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) {
4828 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4829 LDKPublicKey their_node_id_ref;
4830 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4831 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4832 LDKFundingLocked msg_conv;
4833 msg_conv.inner = (void*)(msg & (~1));
4834 msg_conv.is_owned = false;
4835 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4838 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) {
4839 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4840 LDKPublicKey their_node_id_ref;
4841 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4842 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4843 LDKShutdown msg_conv;
4844 msg_conv.inner = (void*)(msg & (~1));
4845 msg_conv.is_owned = false;
4846 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4849 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) {
4850 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4851 LDKPublicKey their_node_id_ref;
4852 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4853 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4854 LDKClosingSigned msg_conv;
4855 msg_conv.inner = (void*)(msg & (~1));
4856 msg_conv.is_owned = false;
4857 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4860 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) {
4861 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4862 LDKPublicKey their_node_id_ref;
4863 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4864 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4865 LDKUpdateAddHTLC msg_conv;
4866 msg_conv.inner = (void*)(msg & (~1));
4867 msg_conv.is_owned = false;
4868 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4871 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) {
4872 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4873 LDKPublicKey their_node_id_ref;
4874 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4875 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4876 LDKUpdateFulfillHTLC msg_conv;
4877 msg_conv.inner = (void*)(msg & (~1));
4878 msg_conv.is_owned = false;
4879 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4882 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) {
4883 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4884 LDKPublicKey their_node_id_ref;
4885 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4886 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4887 LDKUpdateFailHTLC msg_conv;
4888 msg_conv.inner = (void*)(msg & (~1));
4889 msg_conv.is_owned = false;
4890 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4893 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) {
4894 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4895 LDKPublicKey their_node_id_ref;
4896 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4897 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4898 LDKUpdateFailMalformedHTLC msg_conv;
4899 msg_conv.inner = (void*)(msg & (~1));
4900 msg_conv.is_owned = false;
4901 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4904 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) {
4905 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4906 LDKPublicKey their_node_id_ref;
4907 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4908 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4909 LDKCommitmentSigned msg_conv;
4910 msg_conv.inner = (void*)(msg & (~1));
4911 msg_conv.is_owned = false;
4912 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4915 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) {
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);
4920 LDKRevokeAndACK msg_conv;
4921 msg_conv.inner = (void*)(msg & (~1));
4922 msg_conv.is_owned = false;
4923 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4926 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) {
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 LDKUpdateFee msg_conv;
4932 msg_conv.inner = (void*)(msg & (~1));
4933 msg_conv.is_owned = false;
4934 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4937 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) {
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 LDKAnnouncementSignatures msg_conv;
4943 msg_conv.inner = (void*)(msg & (~1));
4944 msg_conv.is_owned = false;
4945 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4948 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) {
4949 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4950 LDKPublicKey their_node_id_ref;
4951 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4952 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4953 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4956 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) {
4957 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4958 LDKPublicKey their_node_id_ref;
4959 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4960 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4962 msg_conv.inner = (void*)(msg & (~1));
4963 msg_conv.is_owned = false;
4964 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4967 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) {
4968 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4969 LDKPublicKey their_node_id_ref;
4970 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4971 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4972 LDKChannelReestablish msg_conv;
4973 msg_conv.inner = (void*)(msg & (~1));
4974 msg_conv.is_owned = false;
4975 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4978 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) {
4979 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4980 LDKPublicKey their_node_id_ref;
4981 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
4982 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4983 LDKErrorMessage msg_conv;
4984 msg_conv.inner = (void*)(msg & (~1));
4985 msg_conv.is_owned = false;
4986 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4989 typedef struct LDKRoutingMessageHandler_JCalls {
4990 atomic_size_t refcnt;
4993 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4994 jmethodID handle_node_announcement_meth;
4995 jmethodID handle_channel_announcement_meth;
4996 jmethodID handle_channel_update_meth;
4997 jmethodID handle_htlc_fail_channel_update_meth;
4998 jmethodID get_next_channel_announcements_meth;
4999 jmethodID get_next_node_announcements_meth;
5000 jmethodID sync_routing_table_meth;
5001 jmethodID handle_reply_channel_range_meth;
5002 jmethodID handle_reply_short_channel_ids_end_meth;
5003 jmethodID handle_query_channel_range_meth;
5004 jmethodID handle_query_short_channel_ids_meth;
5005 } LDKRoutingMessageHandler_JCalls;
5006 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5007 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5008 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5010 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5011 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5015 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement * msg) {
5016 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5018 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5019 LDKNodeAnnouncement msg_var = *msg;
5020 if (msg->inner != NULL)
5021 msg_var = NodeAnnouncement_clone(msg);
5022 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5023 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5024 long msg_ref = (long)msg_var.inner;
5025 if (msg_var.is_owned) {
5028 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5030 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref);
5031 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5032 // Warning: we may need a move here but can't do a full clone!
5035 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement * msg) {
5036 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5038 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5039 LDKChannelAnnouncement msg_var = *msg;
5040 if (msg->inner != NULL)
5041 msg_var = ChannelAnnouncement_clone(msg);
5042 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5043 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5044 long msg_ref = (long)msg_var.inner;
5045 if (msg_var.is_owned) {
5048 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5050 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
5051 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5052 // Warning: we may need a move here but can't do a full clone!
5055 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate * msg) {
5056 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5058 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5059 LDKChannelUpdate msg_var = *msg;
5060 if (msg->inner != NULL)
5061 msg_var = ChannelUpdate_clone(msg);
5062 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5063 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5064 long msg_ref = (long)msg_var.inner;
5065 if (msg_var.is_owned) {
5068 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5070 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref);
5071 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5072 // Warning: we may need a move here but can't do a full clone!
5075 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
5076 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5078 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5079 long ret_update = (long)update;
5080 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5082 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5084 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5085 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5087 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5088 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5090 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5091 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
5092 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
5093 if (arg_constr.datalen > 0)
5094 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5096 arg_constr.data = NULL;
5097 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
5098 for (size_t l = 0; l < arg_constr.datalen; l++) {
5099 int64_t arr_conv_63 = arg_vals[l];
5100 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5101 FREE((void*)arr_conv_63);
5102 arg_constr.data[l] = arr_conv_63_conv;
5104 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
5107 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
5108 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5110 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5111 int8_tArray starting_point_arr = (*env)->NewByteArray(env, 33);
5112 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
5113 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5115 int64_tArray arg = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5116 LDKCVec_NodeAnnouncementZ arg_constr;
5117 arg_constr.datalen = (*env)->GetArrayLength(env, arg);
5118 if (arg_constr.datalen > 0)
5119 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5121 arg_constr.data = NULL;
5122 int64_t* arg_vals = (*env)->GetLongArrayElements (env, arg, NULL);
5123 for (size_t s = 0; s < arg_constr.datalen; s++) {
5124 int64_t arr_conv_18 = arg_vals[s];
5125 LDKNodeAnnouncement arr_conv_18_conv;
5126 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5127 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5128 if (arr_conv_18_conv.inner != NULL)
5129 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
5130 arg_constr.data[s] = arr_conv_18_conv;
5132 (*env)->ReleaseLongArrayElements(env, arg, arg_vals, 0);
5135 void sync_routing_table_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit * init) {
5136 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5138 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5139 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5140 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5141 LDKInit init_var = *init;
5142 if (init->inner != NULL)
5143 init_var = Init_clone(init);
5144 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5145 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5146 long init_ref = (long)init_var.inner;
5147 if (init_var.is_owned) {
5150 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5152 return (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5154 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyChannelRange msg) {
5155 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5157 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5158 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5159 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5160 LDKReplyChannelRange msg_var = msg;
5161 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5162 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5163 long msg_ref = (long)msg_var.inner;
5164 if (msg_var.is_owned) {
5167 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5169 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5170 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5171 // Warning: we may need a move here but can't do a full clone!
5174 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKReplyShortChannelIdsEnd msg) {
5175 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5177 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5178 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5179 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5180 LDKReplyShortChannelIdsEnd msg_var = msg;
5181 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5182 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5183 long msg_ref = (long)msg_var.inner;
5184 if (msg_var.is_owned) {
5187 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5189 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5190 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5191 // Warning: we may need a move here but can't do a full clone!
5194 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryChannelRange msg) {
5195 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5197 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5198 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5199 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5200 LDKQueryChannelRange msg_var = msg;
5201 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5202 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5203 long msg_ref = (long)msg_var.inner;
5204 if (msg_var.is_owned) {
5207 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5209 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5210 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5211 // Warning: we may need a move here but can't do a full clone!
5214 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKQueryShortChannelIds msg) {
5215 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5217 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5218 int8_tArray their_node_id_arr = (*env)->NewByteArray(env, 33);
5219 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5220 LDKQueryShortChannelIds msg_var = msg;
5221 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5222 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5223 long msg_ref = (long)msg_var.inner;
5224 if (msg_var.is_owned) {
5227 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5229 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5230 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5231 // Warning: we may need a move here but can't do a full clone!
5234 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5235 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5236 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5237 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5238 return (void*) this_arg;
5240 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5241 jclass c = (*env)->GetObjectClass(env, o);
5243 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5244 atomic_init(&calls->refcnt, 1);
5245 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5246 calls->o = (*env)->NewWeakGlobalRef(env, o);
5247 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
5248 CHECK(calls->handle_node_announcement_meth != NULL);
5249 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
5250 CHECK(calls->handle_channel_announcement_meth != NULL);
5251 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
5252 CHECK(calls->handle_channel_update_meth != NULL);
5253 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
5254 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
5255 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
5256 CHECK(calls->get_next_channel_announcements_meth != NULL);
5257 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
5258 CHECK(calls->get_next_node_announcements_meth != NULL);
5259 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
5260 CHECK(calls->sync_routing_table_meth != NULL);
5261 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
5262 CHECK(calls->handle_reply_channel_range_meth != NULL);
5263 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
5264 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
5265 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
5266 CHECK(calls->handle_query_channel_range_meth != NULL);
5267 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
5268 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
5270 LDKRoutingMessageHandler ret = {
5271 .this_arg = (void*) calls,
5272 .handle_node_announcement = handle_node_announcement_jcall,
5273 .handle_channel_announcement = handle_channel_announcement_jcall,
5274 .handle_channel_update = handle_channel_update_jcall,
5275 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
5276 .get_next_channel_announcements = get_next_channel_announcements_jcall,
5277 .get_next_node_announcements = get_next_node_announcements_jcall,
5278 .sync_routing_table = sync_routing_table_jcall,
5279 .handle_reply_channel_range = handle_reply_channel_range_jcall,
5280 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
5281 .handle_query_channel_range = handle_query_channel_range_jcall,
5282 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5283 .free = LDKRoutingMessageHandler_JCalls_free,
5284 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, clz, MessageSendEventsProvider),
5286 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5289 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject MessageSendEventsProvider) {
5290 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5291 *res_ptr = LDKRoutingMessageHandler_init(env, clz, o, MessageSendEventsProvider);
5292 return (long)res_ptr;
5294 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5295 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5296 LDKNodeAnnouncement msg_conv;
5297 msg_conv.inner = (void*)(msg & (~1));
5298 msg_conv.is_owned = false;
5299 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5300 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5301 return (long)ret_conv;
5304 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5305 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5306 LDKChannelAnnouncement msg_conv;
5307 msg_conv.inner = (void*)(msg & (~1));
5308 msg_conv.is_owned = false;
5309 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5310 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5311 return (long)ret_conv;
5314 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
5315 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5316 LDKChannelUpdate msg_conv;
5317 msg_conv.inner = (void*)(msg & (~1));
5318 msg_conv.is_owned = false;
5319 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5320 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5321 return (long)ret_conv;
5324 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) {
5325 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5326 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5327 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5330 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) {
5331 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5332 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5333 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5334 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5335 for (size_t l = 0; l < ret_var.datalen; l++) {
5336 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5337 *arr_conv_63_ref = ret_var.data[l];
5338 arr_conv_63_ref->a = ChannelAnnouncement_clone(&arr_conv_63_ref->a);
5339 arr_conv_63_ref->b = ChannelUpdate_clone(&arr_conv_63_ref->b);
5340 arr_conv_63_ref->c = ChannelUpdate_clone(&arr_conv_63_ref->c);
5341 ret_arr_ptr[l] = (long)arr_conv_63_ref;
5343 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5348 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) {
5349 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5350 LDKPublicKey starting_point_ref;
5351 CHECK((*env)->GetArrayLength(env, starting_point) == 33);
5352 (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
5353 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5354 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
5355 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
5356 for (size_t s = 0; s < ret_var.datalen; s++) {
5357 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
5358 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5359 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5360 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
5361 if (arr_conv_18_var.is_owned) {
5362 arr_conv_18_ref |= 1;
5364 ret_arr_ptr[s] = arr_conv_18_ref;
5366 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
5371 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) {
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);
5377 init_conv.inner = (void*)(init & (~1));
5378 init_conv.is_owned = false;
5379 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5382 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) {
5383 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5384 LDKPublicKey their_node_id_ref;
5385 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5386 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5387 LDKReplyChannelRange msg_conv;
5388 msg_conv.inner = (void*)(msg & (~1));
5389 msg_conv.is_owned = (msg & 1) || (msg == 0);
5390 if (msg_conv.inner != NULL)
5391 msg_conv = ReplyChannelRange_clone(&msg_conv);
5392 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5393 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5394 return (long)ret_conv;
5397 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) {
5398 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5399 LDKPublicKey their_node_id_ref;
5400 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5401 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5402 LDKReplyShortChannelIdsEnd msg_conv;
5403 msg_conv.inner = (void*)(msg & (~1));
5404 msg_conv.is_owned = (msg & 1) || (msg == 0);
5405 if (msg_conv.inner != NULL)
5406 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5407 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5408 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5409 return (long)ret_conv;
5412 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) {
5413 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5414 LDKPublicKey their_node_id_ref;
5415 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5416 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5417 LDKQueryChannelRange msg_conv;
5418 msg_conv.inner = (void*)(msg & (~1));
5419 msg_conv.is_owned = (msg & 1) || (msg == 0);
5420 if (msg_conv.inner != NULL)
5421 msg_conv = QueryChannelRange_clone(&msg_conv);
5422 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5423 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5424 return (long)ret_conv;
5427 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) {
5428 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5429 LDKPublicKey their_node_id_ref;
5430 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
5431 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5432 LDKQueryShortChannelIds msg_conv;
5433 msg_conv.inner = (void*)(msg & (~1));
5434 msg_conv.is_owned = (msg & 1) || (msg == 0);
5435 if (msg_conv.inner != NULL)
5436 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5437 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5438 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5439 return (long)ret_conv;
5442 typedef struct LDKSocketDescriptor_JCalls {
5443 atomic_size_t refcnt;
5446 jmethodID send_data_meth;
5447 jmethodID disconnect_socket_meth;
5449 jmethodID hash_meth;
5450 } LDKSocketDescriptor_JCalls;
5451 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5452 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5453 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5455 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5456 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5460 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
5461 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5463 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5464 LDKu8slice data_var = data;
5465 int8_tArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
5466 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
5467 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5469 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
5471 void disconnect_socket_jcall(void* this_arg) {
5472 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5474 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5475 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5477 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
5479 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor * other_arg) {
5480 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5482 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5483 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5484 *other_arg_clone = SocketDescriptor_clone(other_arg);
5485 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5487 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (long)other_arg_clone);
5489 uint64_t hash_jcall(const void* this_arg) {
5490 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5492 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5493 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
5495 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
5497 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5498 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5499 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5500 return (void*) this_arg;
5502 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv *env, jclass clz, jobject o) {
5503 jclass c = (*env)->GetObjectClass(env, o);
5505 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5506 atomic_init(&calls->refcnt, 1);
5507 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5508 calls->o = (*env)->NewWeakGlobalRef(env, o);
5509 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
5510 CHECK(calls->send_data_meth != NULL);
5511 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
5512 CHECK(calls->disconnect_socket_meth != NULL);
5513 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
5514 CHECK(calls->eq_meth != NULL);
5515 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
5516 CHECK(calls->hash_meth != NULL);
5518 LDKSocketDescriptor ret = {
5519 .this_arg = (void*) calls,
5520 .send_data = send_data_jcall,
5521 .disconnect_socket = disconnect_socket_jcall,
5524 .clone = LDKSocketDescriptor_JCalls_clone,
5525 .free = LDKSocketDescriptor_JCalls_free,
5529 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new(JNIEnv *env, jclass clz, jobject o) {
5530 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5531 *res_ptr = LDKSocketDescriptor_init(env, clz, o);
5532 return (long)res_ptr;
5534 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) {
5535 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5536 LDKu8slice data_ref;
5537 data_ref.datalen = (*env)->GetArrayLength(env, data);
5538 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
5539 intptr_t ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5540 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
5544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv *env, jclass clz, int64_t this_arg) {
5545 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5546 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv *env, jclass clz, int64_t this_arg) {
5550 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5551 int64_t ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
5556 LDKTransaction _res_ref;
5557 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
5558 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5559 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
5560 _res_ref.data_is_owned = true;
5561 Transaction_free(_res_ref);
5564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv *env, jclass clz, int64_t _res) {
5565 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5567 TxOut_free(_res_conv);
5570 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv *env, jclass clz, int64_t orig) {
5571 LDKTxOut* orig_conv = (LDKTxOut*)orig;
5572 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5573 *ret_ref = TxOut_clone(orig_conv);
5574 return (long)ret_ref;
5577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5578 LDKCVec_SpendableOutputDescriptorZ _res_constr;
5579 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5580 if (_res_constr.datalen > 0)
5581 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5583 _res_constr.data = NULL;
5584 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5585 for (size_t b = 0; b < _res_constr.datalen; b++) {
5586 int64_t arr_conv_27 = _res_vals[b];
5587 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5588 FREE((void*)arr_conv_27);
5589 _res_constr.data[b] = arr_conv_27_conv;
5591 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5592 CVec_SpendableOutputDescriptorZ_free(_res_constr);
5595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5596 LDKCVec_MessageSendEventZ _res_constr;
5597 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5598 if (_res_constr.datalen > 0)
5599 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5601 _res_constr.data = NULL;
5602 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5603 for (size_t s = 0; s < _res_constr.datalen; s++) {
5604 int64_t arr_conv_18 = _res_vals[s];
5605 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5606 FREE((void*)arr_conv_18);
5607 _res_constr.data[s] = arr_conv_18_conv;
5609 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5610 CVec_MessageSendEventZ_free(_res_constr);
5613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5614 LDKCVec_EventZ _res_constr;
5615 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5616 if (_res_constr.datalen > 0)
5617 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5619 _res_constr.data = NULL;
5620 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5621 for (size_t h = 0; h < _res_constr.datalen; h++) {
5622 int64_t arr_conv_7 = _res_vals[h];
5623 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5624 FREE((void*)arr_conv_7);
5625 _res_constr.data[h] = arr_conv_7_conv;
5627 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5628 CVec_EventZ_free(_res_constr);
5631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5632 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)_res;
5634 C2Tuple_usizeTransactionZ_free(_res_conv);
5637 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv *env, jclass clz, intptr_t a, int8_tArray b) {
5638 LDKTransaction b_ref;
5639 b_ref.datalen = (*env)->GetArrayLength(env, b);
5640 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5641 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5642 b_ref.data_is_owned = true;
5643 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5644 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5645 // XXX: We likely need to clone here, but no _clone fn is available for byte[]
5646 return (long)ret_ref;
5649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5650 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
5651 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5652 if (_res_constr.datalen > 0)
5653 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5655 _res_constr.data = NULL;
5656 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5657 for (size_t y = 0; y < _res_constr.datalen; y++) {
5658 int64_t arr_conv_24 = _res_vals[y];
5659 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5660 FREE((void*)arr_conv_24);
5661 _res_constr.data[y] = arr_conv_24_conv;
5663 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5664 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
5667 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv *env, jclass clz) {
5668 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5669 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5670 return (long)ret_conv;
5673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv *env, jclass clz, jclass e) {
5674 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(env, e);
5675 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5676 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
5677 return (long)ret_conv;
5680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5681 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)_res;
5683 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
5686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5687 LDKCVec_MonitorEventZ _res_constr;
5688 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5689 if (_res_constr.datalen > 0)
5690 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5692 _res_constr.data = NULL;
5693 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5694 for (size_t o = 0; o < _res_constr.datalen; o++) {
5695 int64_t arr_conv_14 = _res_vals[o];
5696 LDKMonitorEvent arr_conv_14_conv;
5697 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5698 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5699 _res_constr.data[o] = arr_conv_14_conv;
5701 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5702 CVec_MonitorEventZ_free(_res_constr);
5705 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5706 LDKChannelMonitorUpdate o_conv;
5707 o_conv.inner = (void*)(o & (~1));
5708 o_conv.is_owned = (o & 1) || (o == 0);
5709 if (o_conv.inner != NULL)
5710 o_conv = ChannelMonitorUpdate_clone(&o_conv);
5711 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5712 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
5713 return (long)ret_conv;
5716 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5717 LDKDecodeError e_conv;
5718 e_conv.inner = (void*)(e & (~1));
5719 e_conv.is_owned = (e & 1) || (e == 0);
5720 // Warning: we may need a move here but can't clone!
5721 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5722 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
5723 return (long)ret_conv;
5726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5727 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)_res;
5729 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
5732 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) {
5733 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5734 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5735 return (long)ret_conv;
5738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5739 LDKMonitorUpdateError e_conv;
5740 e_conv.inner = (void*)(e & (~1));
5741 e_conv.is_owned = (e & 1) || (e == 0);
5742 // Warning: we may need a move here but can't clone!
5743 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5744 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
5745 return (long)ret_conv;
5748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5749 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)_res;
5751 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
5754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5755 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)_res;
5757 C2Tuple_OutPointScriptZ_free(_res_conv);
5760 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv *env, jclass clz, int64_t a, int8_tArray b) {
5762 a_conv.inner = (void*)(a & (~1));
5763 a_conv.is_owned = (a & 1) || (a == 0);
5764 if (a_conv.inner != NULL)
5765 a_conv = OutPoint_clone(&a_conv);
5767 b_ref.datalen = (*env)->GetArrayLength(env, b);
5768 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5769 (*env)->GetByteArrayRegion(env, b, 0, b_ref.datalen, b_ref.data);
5770 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5771 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5772 ret_ref->a = OutPoint_clone(&ret_ref->a);
5773 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
5774 return (long)ret_ref;
5777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5778 LDKCVec_TransactionZ _res_constr;
5779 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5780 if (_res_constr.datalen > 0)
5781 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5783 _res_constr.data = NULL;
5784 for (size_t i = 0; i < _res_constr.datalen; i++) {
5785 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5786 LDKTransaction arr_conv_8_ref;
5787 arr_conv_8_ref.datalen = (*env)->GetArrayLength(env, arr_conv_8);
5788 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5789 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5790 arr_conv_8_ref.data_is_owned = true;
5791 _res_constr.data[i] = arr_conv_8_ref;
5793 CVec_TransactionZ_free(_res_constr);
5796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5797 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)_res;
5799 C2Tuple_u32TxOutZ_free(_res_conv);
5802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
5803 LDKTxOut b_conv = *(LDKTxOut*)b;
5805 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5806 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
5807 ret_ref->b = TxOut_clone(&ret_ref->b);
5808 return (long)ret_ref;
5811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5812 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
5813 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5814 if (_res_constr.datalen > 0)
5815 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5817 _res_constr.data = NULL;
5818 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5819 for (size_t a = 0; a < _res_constr.datalen; a++) {
5820 int64_t arr_conv_26 = _res_vals[a];
5821 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
5822 FREE((void*)arr_conv_26);
5823 _res_constr.data[a] = arr_conv_26_conv;
5825 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5826 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
5829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5830 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)_res;
5832 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
5835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_tArray b) {
5836 LDKThirtyTwoBytes a_ref;
5837 CHECK((*env)->GetArrayLength(env, a) == 32);
5838 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5839 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5840 b_constr.datalen = (*env)->GetArrayLength(env, b);
5841 if (b_constr.datalen > 0)
5842 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5844 b_constr.data = NULL;
5845 int64_t* b_vals = (*env)->GetLongArrayElements (env, b, NULL);
5846 for (size_t a = 0; a < b_constr.datalen; a++) {
5847 int64_t arr_conv_26 = b_vals[a];
5848 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
5849 FREE((void*)arr_conv_26);
5850 b_constr.data[a] = arr_conv_26_conv;
5852 (*env)->ReleaseLongArrayElements(env, b, b_vals, 0);
5853 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5854 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
5855 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
5856 ret_ref->b = CVec_C2Tuple_u32TxOutZZ_clone(&ret_ref->b);
5857 return (long)ret_ref;
5860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
5861 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
5862 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5863 if (_res_constr.datalen > 0)
5864 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
5866 _res_constr.data = NULL;
5867 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
5868 for (size_t u = 0; u < _res_constr.datalen; u++) {
5869 int64_t arr_conv_46 = _res_vals[u];
5870 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_conv_46;
5871 FREE((void*)arr_conv_46);
5872 _res_constr.data[u] = arr_conv_46_conv;
5874 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
5875 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
5878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5879 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)_res;
5881 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
5884 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
5885 LDKThirtyTwoBytes a_ref;
5886 CHECK((*env)->GetArrayLength(env, a) == 32);
5887 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
5888 LDKChannelMonitor b_conv;
5889 b_conv.inner = (void*)(b & (~1));
5890 b_conv.is_owned = (b & 1) || (b == 0);
5891 // Warning: we may need a move here but can't clone!
5892 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5893 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
5894 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
5895 // XXX: We likely need to clone here, but no _clone fn is available for ChannelMonitor
5896 return (long)ret_ref;
5899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5900 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)o;
5902 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5903 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
5904 return (long)ret_conv;
5907 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5908 LDKDecodeError e_conv;
5909 e_conv.inner = (void*)(e & (~1));
5910 e_conv.is_owned = (e & 1) || (e == 0);
5911 // Warning: we may need a move here but can't clone!
5912 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5913 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
5914 return (long)ret_conv;
5917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5918 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)_res;
5920 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
5923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
5924 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)_res;
5926 C2Tuple_u64u64Z_free(_res_conv);
5929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
5930 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5931 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5932 return (long)ret_ref;
5935 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
5936 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)o;
5938 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5939 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
5940 return (long)ret_conv;
5943 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
5944 LDKDecodeError e_conv;
5945 e_conv.inner = (void*)(e & (~1));
5946 e_conv.is_owned = (e & 1) || (e == 0);
5947 // Warning: we may need a move here but can't clone!
5948 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5949 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
5950 return (long)ret_conv;
5953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5954 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)_res;
5956 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
5959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
5960 LDKCVec_SignatureZ _res_constr;
5961 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
5962 if (_res_constr.datalen > 0)
5963 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5965 _res_constr.data = NULL;
5966 for (size_t i = 0; i < _res_constr.datalen; i++) {
5967 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
5968 LDKSignature arr_conv_8_ref;
5969 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5970 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5971 _res_constr.data[i] = arr_conv_8_ref;
5973 CVec_SignatureZ_free(_res_constr);
5976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
5977 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)_res;
5979 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
5982 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
5984 CHECK((*env)->GetArrayLength(env, a) == 64);
5985 (*env)->GetByteArrayRegion(env, a, 0, 64, a_ref.compact_form);
5986 LDKCVec_SignatureZ b_constr;
5987 b_constr.datalen = (*env)->GetArrayLength(env, b);
5988 if (b_constr.datalen > 0)
5989 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5991 b_constr.data = NULL;
5992 for (size_t i = 0; i < b_constr.datalen; i++) {
5993 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, b, i);
5994 LDKSignature arr_conv_8_ref;
5995 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
5996 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5997 b_constr.data[i] = arr_conv_8_ref;
5999 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
6000 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
6001 // XXX: We likely need to clone here, but no _clone fn is available for byte[]
6002 // XXX: We likely need to clone here, but no _clone fn is available for byte[][]
6003 return (long)ret_ref;
6006 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6007 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)o;
6009 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6010 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
6011 return (long)ret_conv;
6014 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv *env, jclass clz) {
6015 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6016 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
6017 return (long)ret_conv;
6020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6021 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)_res;
6023 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
6026 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6027 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* orig_conv = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)orig;
6028 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6029 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(orig_conv);
6030 return (long)ret_conv;
6033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6035 CHECK((*env)->GetArrayLength(env, o) == 64);
6036 (*env)->GetByteArrayRegion(env, o, 0, 64, o_ref.compact_form);
6037 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6038 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
6039 return (long)ret_conv;
6042 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv *env, jclass clz) {
6043 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6044 *ret_conv = CResult_SignatureNoneZ_err();
6045 return (long)ret_conv;
6048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6049 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)_res;
6051 CResult_SignatureNoneZ_free(_res_conv);
6054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6055 LDKCResult_SignatureNoneZ* orig_conv = (LDKCResult_SignatureNoneZ*)orig;
6056 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6057 *ret_conv = CResult_SignatureNoneZ_clone(orig_conv);
6058 return (long)ret_conv;
6061 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv *env, jclass clz, jobjectArray o) {
6062 LDKCVec_SignatureZ o_constr;
6063 o_constr.datalen = (*env)->GetArrayLength(env, o);
6064 if (o_constr.datalen > 0)
6065 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6067 o_constr.data = NULL;
6068 for (size_t i = 0; i < o_constr.datalen; i++) {
6069 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, o, i);
6070 LDKSignature arr_conv_8_ref;
6071 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
6072 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
6073 o_constr.data[i] = arr_conv_8_ref;
6075 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6076 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6077 return (long)ret_conv;
6080 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv *env, jclass clz) {
6081 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6082 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6083 return (long)ret_conv;
6086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6087 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)_res;
6089 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6092 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
6093 LDKCResult_CVec_SignatureZNoneZ* orig_conv = (LDKCResult_CVec_SignatureZNoneZ*)orig;
6094 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6095 *ret_conv = CResult_CVec_SignatureZNoneZ_clone(orig_conv);
6096 return (long)ret_conv;
6099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6100 LDKChannelKeys o_conv = *(LDKChannelKeys*)o;
6101 if (o_conv.free == LDKChannelKeys_JCalls_free) {
6102 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6103 LDKChannelKeys_JCalls_clone(o_conv.this_arg);
6105 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
6106 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
6107 return (long)ret_conv;
6110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6111 LDKDecodeError e_conv;
6112 e_conv.inner = (void*)(e & (~1));
6113 e_conv.is_owned = (e & 1) || (e == 0);
6114 // Warning: we may need a move here but can't clone!
6115 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
6116 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
6117 return (long)ret_conv;
6120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6121 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)_res;
6123 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
6126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6127 LDKInMemoryChannelKeys o_conv;
6128 o_conv.inner = (void*)(o & (~1));
6129 o_conv.is_owned = (o & 1) || (o == 0);
6130 if (o_conv.inner != NULL)
6131 o_conv = InMemoryChannelKeys_clone(&o_conv);
6132 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6133 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
6134 return (long)ret_conv;
6137 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6138 LDKDecodeError e_conv;
6139 e_conv.inner = (void*)(e & (~1));
6140 e_conv.is_owned = (e & 1) || (e == 0);
6141 // Warning: we may need a move here but can't clone!
6142 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6143 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
6144 return (long)ret_conv;
6147 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6148 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)_res;
6150 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
6153 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6154 LDKTxOut o_conv = *(LDKTxOut*)o;
6156 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6157 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
6158 return (long)ret_conv;
6161 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
6162 LDKAccessError e_conv = LDKAccessError_from_java(env, e);
6163 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6164 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6165 return (long)ret_conv;
6168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6169 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)_res;
6171 CResult_TxOutAccessErrorZ_free(_res_conv);
6174 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv *env, jclass clz) {
6175 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6176 *ret_conv = CResult_NoneAPIErrorZ_ok();
6177 return (long)ret_conv;
6180 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6181 LDKAPIError e_conv = *(LDKAPIError*)e;
6183 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6184 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6185 return (long)ret_conv;
6188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6189 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)_res;
6191 CResult_NoneAPIErrorZ_free(_res_conv);
6194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6195 LDKCVec_ChannelDetailsZ _res_constr;
6196 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6197 if (_res_constr.datalen > 0)
6198 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6200 _res_constr.data = NULL;
6201 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6202 for (size_t q = 0; q < _res_constr.datalen; q++) {
6203 int64_t arr_conv_16 = _res_vals[q];
6204 LDKChannelDetails arr_conv_16_conv;
6205 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6206 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6207 _res_constr.data[q] = arr_conv_16_conv;
6209 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6210 CVec_ChannelDetailsZ_free(_res_constr);
6213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv *env, jclass clz) {
6214 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6215 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
6216 return (long)ret_conv;
6219 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6220 LDKPaymentSendFailure e_conv;
6221 e_conv.inner = (void*)(e & (~1));
6222 e_conv.is_owned = (e & 1) || (e == 0);
6223 // Warning: we may need a move here but can't clone!
6224 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6225 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
6226 return (long)ret_conv;
6229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6230 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)_res;
6232 CResult_NonePaymentSendFailureZ_free(_res_conv);
6235 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6236 LDKCVec_NetAddressZ _res_constr;
6237 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6238 if (_res_constr.datalen > 0)
6239 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6241 _res_constr.data = NULL;
6242 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6243 for (size_t m = 0; m < _res_constr.datalen; m++) {
6244 int64_t arr_conv_12 = _res_vals[m];
6245 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6246 FREE((void*)arr_conv_12);
6247 _res_constr.data[m] = arr_conv_12_conv;
6249 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6250 CVec_NetAddressZ_free(_res_constr);
6253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6254 LDKCVec_ChannelMonitorZ _res_constr;
6255 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6256 if (_res_constr.datalen > 0)
6257 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6259 _res_constr.data = NULL;
6260 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6261 for (size_t q = 0; q < _res_constr.datalen; q++) {
6262 int64_t arr_conv_16 = _res_vals[q];
6263 LDKChannelMonitor arr_conv_16_conv;
6264 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6265 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6266 _res_constr.data[q] = arr_conv_16_conv;
6268 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6269 CVec_ChannelMonitorZ_free(_res_constr);
6272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6273 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)_res;
6275 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6278 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
6279 LDKThirtyTwoBytes a_ref;
6280 CHECK((*env)->GetArrayLength(env, a) == 32);
6281 (*env)->GetByteArrayRegion(env, a, 0, 32, a_ref.data);
6282 LDKChannelManager b_conv;
6283 b_conv.inner = (void*)(b & (~1));
6284 b_conv.is_owned = (b & 1) || (b == 0);
6285 // Warning: we may need a move here but can't clone!
6286 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6287 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6288 ret_ref->a = ThirtyTwoBytes_clone(&ret_ref->a);
6289 // XXX: We likely need to clone here, but no _clone fn is available for ChannelManager
6290 return (long)ret_ref;
6293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6294 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)o;
6296 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6297 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6298 return (long)ret_conv;
6301 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6302 LDKDecodeError e_conv;
6303 e_conv.inner = (void*)(e & (~1));
6304 e_conv.is_owned = (e & 1) || (e == 0);
6305 // Warning: we may need a move here but can't clone!
6306 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6307 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6308 return (long)ret_conv;
6311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6312 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)_res;
6314 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6317 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
6318 LDKNetAddress o_conv = *(LDKNetAddress*)o;
6320 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6321 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
6322 return (long)ret_conv;
6325 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv *env, jclass clz, int8_t e) {
6326 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6327 *ret_conv = CResult_NetAddressu8Z_err(e);
6328 return (long)ret_conv;
6331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv *env, jclass clz, int64_t _res) {
6332 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)_res;
6334 CResult_NetAddressu8Z_free(_res_conv);
6337 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6338 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)o;
6340 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6341 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
6342 return (long)ret_conv;
6345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6346 LDKDecodeError e_conv;
6347 e_conv.inner = (void*)(e & (~1));
6348 e_conv.is_owned = (e & 1) || (e == 0);
6349 // Warning: we may need a move here but can't clone!
6350 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6351 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
6352 return (long)ret_conv;
6355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6356 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)_res;
6358 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
6361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6362 LDKCVec_u64Z _res_constr;
6363 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6364 if (_res_constr.datalen > 0)
6365 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
6367 _res_constr.data = NULL;
6368 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6369 for (size_t g = 0; g < _res_constr.datalen; g++) {
6370 int64_t arr_conv_6 = _res_vals[g];
6371 _res_constr.data[g] = arr_conv_6;
6373 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6374 CVec_u64Z_free(_res_constr);
6377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6378 LDKCVec_UpdateAddHTLCZ _res_constr;
6379 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6380 if (_res_constr.datalen > 0)
6381 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
6383 _res_constr.data = NULL;
6384 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6385 for (size_t p = 0; p < _res_constr.datalen; p++) {
6386 int64_t arr_conv_15 = _res_vals[p];
6387 LDKUpdateAddHTLC arr_conv_15_conv;
6388 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
6389 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
6390 _res_constr.data[p] = arr_conv_15_conv;
6392 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6393 CVec_UpdateAddHTLCZ_free(_res_constr);
6396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6397 LDKCVec_UpdateFulfillHTLCZ _res_constr;
6398 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6399 if (_res_constr.datalen > 0)
6400 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
6402 _res_constr.data = NULL;
6403 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6404 for (size_t t = 0; t < _res_constr.datalen; t++) {
6405 int64_t arr_conv_19 = _res_vals[t];
6406 LDKUpdateFulfillHTLC arr_conv_19_conv;
6407 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
6408 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
6409 _res_constr.data[t] = arr_conv_19_conv;
6411 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6412 CVec_UpdateFulfillHTLCZ_free(_res_constr);
6415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6416 LDKCVec_UpdateFailHTLCZ _res_constr;
6417 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6418 if (_res_constr.datalen > 0)
6419 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
6421 _res_constr.data = NULL;
6422 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6423 for (size_t q = 0; q < _res_constr.datalen; q++) {
6424 int64_t arr_conv_16 = _res_vals[q];
6425 LDKUpdateFailHTLC arr_conv_16_conv;
6426 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6427 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6428 _res_constr.data[q] = arr_conv_16_conv;
6430 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6431 CVec_UpdateFailHTLCZ_free(_res_constr);
6434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6435 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
6436 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6437 if (_res_constr.datalen > 0)
6438 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
6440 _res_constr.data = NULL;
6441 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6442 for (size_t z = 0; z < _res_constr.datalen; z++) {
6443 int64_t arr_conv_25 = _res_vals[z];
6444 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
6445 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
6446 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
6447 _res_constr.data[z] = arr_conv_25_conv;
6449 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6450 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
6453 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6454 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6455 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6456 return (long)ret_conv;
6459 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6460 LDKLightningError e_conv;
6461 e_conv.inner = (void*)(e & (~1));
6462 e_conv.is_owned = (e & 1) || (e == 0);
6463 // Warning: we may need a move here but can't clone!
6464 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6465 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6466 return (long)ret_conv;
6469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6470 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)_res;
6472 CResult_boolLightningErrorZ_free(_res_conv);
6475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6476 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)_res;
6478 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6481 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) {
6482 LDKChannelAnnouncement a_conv;
6483 a_conv.inner = (void*)(a & (~1));
6484 a_conv.is_owned = (a & 1) || (a == 0);
6485 if (a_conv.inner != NULL)
6486 a_conv = ChannelAnnouncement_clone(&a_conv);
6487 LDKChannelUpdate b_conv;
6488 b_conv.inner = (void*)(b & (~1));
6489 b_conv.is_owned = (b & 1) || (b == 0);
6490 if (b_conv.inner != NULL)
6491 b_conv = ChannelUpdate_clone(&b_conv);
6492 LDKChannelUpdate c_conv;
6493 c_conv.inner = (void*)(c & (~1));
6494 c_conv.is_owned = (c & 1) || (c == 0);
6495 if (c_conv.inner != NULL)
6496 c_conv = ChannelUpdate_clone(&c_conv);
6497 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6498 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6499 ret_ref->a = ChannelAnnouncement_clone(&ret_ref->a);
6500 ret_ref->b = ChannelUpdate_clone(&ret_ref->b);
6501 ret_ref->c = ChannelUpdate_clone(&ret_ref->c);
6502 return (long)ret_ref;
6505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6506 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6507 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6508 if (_res_constr.datalen > 0)
6509 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6511 _res_constr.data = NULL;
6512 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6513 for (size_t l = 0; l < _res_constr.datalen; l++) {
6514 int64_t arr_conv_63 = _res_vals[l];
6515 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
6516 FREE((void*)arr_conv_63);
6517 _res_constr.data[l] = arr_conv_63_conv;
6519 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6520 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
6524 LDKCVec_NodeAnnouncementZ _res_constr;
6525 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6526 if (_res_constr.datalen > 0)
6527 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6529 _res_constr.data = NULL;
6530 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
6531 for (size_t s = 0; s < _res_constr.datalen; s++) {
6532 int64_t arr_conv_18 = _res_vals[s];
6533 LDKNodeAnnouncement arr_conv_18_conv;
6534 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
6535 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
6536 _res_constr.data[s] = arr_conv_18_conv;
6538 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
6539 CVec_NodeAnnouncementZ_free(_res_constr);
6542 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
6543 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6544 *ret_conv = CResult_NoneLightningErrorZ_ok();
6545 return (long)ret_conv;
6548 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6549 LDKLightningError e_conv;
6550 e_conv.inner = (void*)(e & (~1));
6551 e_conv.is_owned = (e & 1) || (e == 0);
6552 // Warning: we may need a move here but can't clone!
6553 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6554 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6555 return (long)ret_conv;
6558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6559 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)_res;
6561 CResult_NoneLightningErrorZ_free(_res_conv);
6564 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6565 LDKChannelReestablish o_conv;
6566 o_conv.inner = (void*)(o & (~1));
6567 o_conv.is_owned = (o & 1) || (o == 0);
6568 if (o_conv.inner != NULL)
6569 o_conv = ChannelReestablish_clone(&o_conv);
6570 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6571 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
6572 return (long)ret_conv;
6575 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6576 LDKDecodeError e_conv;
6577 e_conv.inner = (void*)(e & (~1));
6578 e_conv.is_owned = (e & 1) || (e == 0);
6579 // Warning: we may need a move here but can't clone!
6580 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6581 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
6582 return (long)ret_conv;
6585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6586 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)_res;
6588 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
6591 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6593 o_conv.inner = (void*)(o & (~1));
6594 o_conv.is_owned = (o & 1) || (o == 0);
6595 if (o_conv.inner != NULL)
6596 o_conv = Init_clone(&o_conv);
6597 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6598 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
6599 return (long)ret_conv;
6602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6603 LDKDecodeError e_conv;
6604 e_conv.inner = (void*)(e & (~1));
6605 e_conv.is_owned = (e & 1) || (e == 0);
6606 // Warning: we may need a move here but can't clone!
6607 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6608 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
6609 return (long)ret_conv;
6612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6613 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)_res;
6615 CResult_InitDecodeErrorZ_free(_res_conv);
6618 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6620 o_conv.inner = (void*)(o & (~1));
6621 o_conv.is_owned = (o & 1) || (o == 0);
6622 if (o_conv.inner != NULL)
6623 o_conv = Ping_clone(&o_conv);
6624 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6625 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
6626 return (long)ret_conv;
6629 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6630 LDKDecodeError e_conv;
6631 e_conv.inner = (void*)(e & (~1));
6632 e_conv.is_owned = (e & 1) || (e == 0);
6633 // Warning: we may need a move here but can't clone!
6634 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6635 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
6636 return (long)ret_conv;
6639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6640 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)_res;
6642 CResult_PingDecodeErrorZ_free(_res_conv);
6645 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6647 o_conv.inner = (void*)(o & (~1));
6648 o_conv.is_owned = (o & 1) || (o == 0);
6649 if (o_conv.inner != NULL)
6650 o_conv = Pong_clone(&o_conv);
6651 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6652 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
6653 return (long)ret_conv;
6656 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6657 LDKDecodeError e_conv;
6658 e_conv.inner = (void*)(e & (~1));
6659 e_conv.is_owned = (e & 1) || (e == 0);
6660 // Warning: we may need a move here but can't clone!
6661 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6662 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
6663 return (long)ret_conv;
6666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6667 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)_res;
6669 CResult_PongDecodeErrorZ_free(_res_conv);
6672 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6673 LDKUnsignedChannelAnnouncement o_conv;
6674 o_conv.inner = (void*)(o & (~1));
6675 o_conv.is_owned = (o & 1) || (o == 0);
6676 if (o_conv.inner != NULL)
6677 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
6678 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6679 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
6680 return (long)ret_conv;
6683 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6684 LDKDecodeError e_conv;
6685 e_conv.inner = (void*)(e & (~1));
6686 e_conv.is_owned = (e & 1) || (e == 0);
6687 // Warning: we may need a move here but can't clone!
6688 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6689 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
6690 return (long)ret_conv;
6693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6694 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)_res;
6696 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
6699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6700 LDKUnsignedChannelUpdate o_conv;
6701 o_conv.inner = (void*)(o & (~1));
6702 o_conv.is_owned = (o & 1) || (o == 0);
6703 if (o_conv.inner != NULL)
6704 o_conv = UnsignedChannelUpdate_clone(&o_conv);
6705 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6706 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
6707 return (long)ret_conv;
6710 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6711 LDKDecodeError e_conv;
6712 e_conv.inner = (void*)(e & (~1));
6713 e_conv.is_owned = (e & 1) || (e == 0);
6714 // Warning: we may need a move here but can't clone!
6715 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6716 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
6717 return (long)ret_conv;
6720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6721 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)_res;
6723 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
6726 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6727 LDKErrorMessage o_conv;
6728 o_conv.inner = (void*)(o & (~1));
6729 o_conv.is_owned = (o & 1) || (o == 0);
6730 if (o_conv.inner != NULL)
6731 o_conv = ErrorMessage_clone(&o_conv);
6732 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6733 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
6734 return (long)ret_conv;
6737 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6738 LDKDecodeError e_conv;
6739 e_conv.inner = (void*)(e & (~1));
6740 e_conv.is_owned = (e & 1) || (e == 0);
6741 // Warning: we may need a move here but can't clone!
6742 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6743 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
6744 return (long)ret_conv;
6747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6748 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)_res;
6750 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
6753 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6754 LDKUnsignedNodeAnnouncement o_conv;
6755 o_conv.inner = (void*)(o & (~1));
6756 o_conv.is_owned = (o & 1) || (o == 0);
6757 if (o_conv.inner != NULL)
6758 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
6759 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6760 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
6761 return (long)ret_conv;
6764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6765 LDKDecodeError e_conv;
6766 e_conv.inner = (void*)(e & (~1));
6767 e_conv.is_owned = (e & 1) || (e == 0);
6768 // Warning: we may need a move here but can't clone!
6769 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6770 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
6771 return (long)ret_conv;
6774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6775 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)_res;
6777 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
6780 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6781 LDKQueryShortChannelIds o_conv;
6782 o_conv.inner = (void*)(o & (~1));
6783 o_conv.is_owned = (o & 1) || (o == 0);
6784 if (o_conv.inner != NULL)
6785 o_conv = QueryShortChannelIds_clone(&o_conv);
6786 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6787 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
6788 return (long)ret_conv;
6791 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6792 LDKDecodeError e_conv;
6793 e_conv.inner = (void*)(e & (~1));
6794 e_conv.is_owned = (e & 1) || (e == 0);
6795 // Warning: we may need a move here but can't clone!
6796 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6797 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
6798 return (long)ret_conv;
6801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6802 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)_res;
6804 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
6807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6808 LDKReplyShortChannelIdsEnd o_conv;
6809 o_conv.inner = (void*)(o & (~1));
6810 o_conv.is_owned = (o & 1) || (o == 0);
6811 if (o_conv.inner != NULL)
6812 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
6813 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6814 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
6815 return (long)ret_conv;
6818 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6819 LDKDecodeError e_conv;
6820 e_conv.inner = (void*)(e & (~1));
6821 e_conv.is_owned = (e & 1) || (e == 0);
6822 // Warning: we may need a move here but can't clone!
6823 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6824 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
6825 return (long)ret_conv;
6828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6829 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)_res;
6831 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
6834 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6835 LDKQueryChannelRange o_conv;
6836 o_conv.inner = (void*)(o & (~1));
6837 o_conv.is_owned = (o & 1) || (o == 0);
6838 if (o_conv.inner != NULL)
6839 o_conv = QueryChannelRange_clone(&o_conv);
6840 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6841 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
6842 return (long)ret_conv;
6845 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6846 LDKDecodeError e_conv;
6847 e_conv.inner = (void*)(e & (~1));
6848 e_conv.is_owned = (e & 1) || (e == 0);
6849 // Warning: we may need a move here but can't clone!
6850 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6851 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
6852 return (long)ret_conv;
6855 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6856 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)_res;
6858 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
6861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6862 LDKReplyChannelRange o_conv;
6863 o_conv.inner = (void*)(o & (~1));
6864 o_conv.is_owned = (o & 1) || (o == 0);
6865 if (o_conv.inner != NULL)
6866 o_conv = ReplyChannelRange_clone(&o_conv);
6867 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6868 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
6869 return (long)ret_conv;
6872 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6873 LDKDecodeError e_conv;
6874 e_conv.inner = (void*)(e & (~1));
6875 e_conv.is_owned = (e & 1) || (e == 0);
6876 // Warning: we may need a move here but can't clone!
6877 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6878 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
6879 return (long)ret_conv;
6882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6883 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)_res;
6885 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
6888 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
6889 LDKGossipTimestampFilter o_conv;
6890 o_conv.inner = (void*)(o & (~1));
6891 o_conv.is_owned = (o & 1) || (o == 0);
6892 if (o_conv.inner != NULL)
6893 o_conv = GossipTimestampFilter_clone(&o_conv);
6894 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6895 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
6896 return (long)ret_conv;
6899 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6900 LDKDecodeError e_conv;
6901 e_conv.inner = (void*)(e & (~1));
6902 e_conv.is_owned = (e & 1) || (e == 0);
6903 // Warning: we may need a move here but can't clone!
6904 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6905 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
6906 return (long)ret_conv;
6909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6910 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)_res;
6912 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
6915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
6916 LDKCVec_PublicKeyZ _res_constr;
6917 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
6918 if (_res_constr.datalen > 0)
6919 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6921 _res_constr.data = NULL;
6922 for (size_t i = 0; i < _res_constr.datalen; i++) {
6923 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, _res, i);
6924 LDKPublicKey arr_conv_8_ref;
6925 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 33);
6926 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
6927 _res_constr.data[i] = arr_conv_8_ref;
6929 CVec_PublicKeyZ_free(_res_constr);
6932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv *env, jclass clz, int8_tArray _res) {
6933 LDKCVec_u8Z _res_ref;
6934 _res_ref.datalen = (*env)->GetArrayLength(env, _res);
6935 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6936 (*env)->GetByteArrayRegion(env, _res, 0, _res_ref.datalen, _res_ref.data);
6937 CVec_u8Z_free(_res_ref);
6940 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
6942 o_ref.datalen = (*env)->GetArrayLength(env, o);
6943 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6944 (*env)->GetByteArrayRegion(env, o, 0, o_ref.datalen, o_ref.data);
6945 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6946 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6947 return (long)ret_conv;
6950 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6951 LDKPeerHandleError e_conv;
6952 e_conv.inner = (void*)(e & (~1));
6953 e_conv.is_owned = (e & 1) || (e == 0);
6954 // Warning: we may need a move here but can't clone!
6955 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6956 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6957 return (long)ret_conv;
6960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6961 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)_res;
6963 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6966 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv *env, jclass clz) {
6967 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6968 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6969 return (long)ret_conv;
6972 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6973 LDKPeerHandleError e_conv;
6974 e_conv.inner = (void*)(e & (~1));
6975 e_conv.is_owned = (e & 1) || (e == 0);
6976 // Warning: we may need a move here but can't clone!
6977 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6978 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6979 return (long)ret_conv;
6982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
6983 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)_res;
6985 CResult_NonePeerHandleErrorZ_free(_res_conv);
6988 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
6989 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6990 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6991 return (long)ret_conv;
6994 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
6995 LDKPeerHandleError e_conv;
6996 e_conv.inner = (void*)(e & (~1));
6997 e_conv.is_owned = (e & 1) || (e == 0);
6998 // Warning: we may need a move here but can't clone!
6999 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
7000 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
7001 return (long)ret_conv;
7004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7005 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)_res;
7007 CResult_boolPeerHandleErrorZ_free(_res_conv);
7010 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
7012 CHECK((*env)->GetArrayLength(env, o) == 32);
7013 (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.bytes);
7014 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
7015 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
7016 return (long)ret_conv;
7019 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
7020 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
7021 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
7022 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
7023 return (long)ret_conv;
7026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7027 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)_res;
7029 CResult_SecretKeySecpErrorZ_free(_res_conv);
7032 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) {
7034 CHECK((*env)->GetArrayLength(env, o) == 33);
7035 (*env)->GetByteArrayRegion(env, o, 0, 33, o_ref.compressed_form);
7036 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
7037 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
7038 return (long)ret_conv;
7041 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
7042 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
7043 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
7044 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
7045 return (long)ret_conv;
7048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7049 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)_res;
7051 CResult_PublicKeySecpErrorZ_free(_res_conv);
7054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7055 LDKTxCreationKeys o_conv;
7056 o_conv.inner = (void*)(o & (~1));
7057 o_conv.is_owned = (o & 1) || (o == 0);
7058 if (o_conv.inner != NULL)
7059 o_conv = TxCreationKeys_clone(&o_conv);
7060 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
7061 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
7062 return (long)ret_conv;
7065 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv *env, jclass clz, jclass e) {
7066 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(env, e);
7067 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
7068 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
7069 return (long)ret_conv;
7072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7073 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)_res;
7075 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
7078 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7079 LDKTrustedCommitmentTransaction o_conv;
7080 o_conv.inner = (void*)(o & (~1));
7081 o_conv.is_owned = (o & 1) || (o == 0);
7082 // Warning: we may need a move here but can't clone!
7083 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7084 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7085 return (long)ret_conv;
7088 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
7089 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7090 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
7091 return (long)ret_conv;
7094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7095 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)_res;
7097 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7101 LDKCVec_RouteHopZ _res_constr;
7102 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7103 if (_res_constr.datalen > 0)
7104 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7106 _res_constr.data = NULL;
7107 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7108 for (size_t k = 0; k < _res_constr.datalen; k++) {
7109 int64_t arr_conv_10 = _res_vals[k];
7110 LDKRouteHop arr_conv_10_conv;
7111 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7112 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7113 _res_constr.data[k] = arr_conv_10_conv;
7115 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7116 CVec_RouteHopZ_free(_res_constr);
7119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
7120 LDKCVec_CVec_RouteHopZZ _res_constr;
7121 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7122 if (_res_constr.datalen > 0)
7123 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7125 _res_constr.data = NULL;
7126 for (size_t m = 0; m < _res_constr.datalen; m++) {
7127 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, _res, m);
7128 LDKCVec_RouteHopZ arr_conv_12_constr;
7129 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
7130 if (arr_conv_12_constr.datalen > 0)
7131 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7133 arr_conv_12_constr.data = NULL;
7134 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
7135 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
7136 int64_t arr_conv_10 = arr_conv_12_vals[k];
7137 LDKRouteHop arr_conv_10_conv;
7138 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7139 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7140 arr_conv_12_constr.data[k] = arr_conv_10_conv;
7142 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
7143 _res_constr.data[m] = arr_conv_12_constr;
7145 CVec_CVec_RouteHopZZ_free(_res_constr);
7148 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7150 o_conv.inner = (void*)(o & (~1));
7151 o_conv.is_owned = (o & 1) || (o == 0);
7152 if (o_conv.inner != NULL)
7153 o_conv = Route_clone(&o_conv);
7154 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7155 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7156 return (long)ret_conv;
7159 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7160 LDKDecodeError e_conv;
7161 e_conv.inner = (void*)(e & (~1));
7162 e_conv.is_owned = (e & 1) || (e == 0);
7163 // Warning: we may need a move here but can't clone!
7164 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7165 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7166 return (long)ret_conv;
7169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7170 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)_res;
7172 CResult_RouteDecodeErrorZ_free(_res_conv);
7175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
7176 LDKCVec_RouteHintZ _res_constr;
7177 _res_constr.datalen = (*env)->GetArrayLength(env, _res);
7178 if (_res_constr.datalen > 0)
7179 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7181 _res_constr.data = NULL;
7182 int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
7183 for (size_t l = 0; l < _res_constr.datalen; l++) {
7184 int64_t arr_conv_11 = _res_vals[l];
7185 LDKRouteHint arr_conv_11_conv;
7186 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
7187 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
7188 _res_constr.data[l] = arr_conv_11_conv;
7190 (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
7191 CVec_RouteHintZ_free(_res_constr);
7194 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7196 o_conv.inner = (void*)(o & (~1));
7197 o_conv.is_owned = (o & 1) || (o == 0);
7198 if (o_conv.inner != NULL)
7199 o_conv = Route_clone(&o_conv);
7200 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7201 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7202 return (long)ret_conv;
7205 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7206 LDKLightningError e_conv;
7207 e_conv.inner = (void*)(e & (~1));
7208 e_conv.is_owned = (e & 1) || (e == 0);
7209 // Warning: we may need a move here but can't clone!
7210 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7211 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7212 return (long)ret_conv;
7215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7216 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)_res;
7218 CResult_RouteLightningErrorZ_free(_res_conv);
7221 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7222 LDKRoutingFees o_conv;
7223 o_conv.inner = (void*)(o & (~1));
7224 o_conv.is_owned = (o & 1) || (o == 0);
7225 if (o_conv.inner != NULL)
7226 o_conv = RoutingFees_clone(&o_conv);
7227 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7228 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7229 return (long)ret_conv;
7232 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7233 LDKDecodeError e_conv;
7234 e_conv.inner = (void*)(e & (~1));
7235 e_conv.is_owned = (e & 1) || (e == 0);
7236 // Warning: we may need a move here but can't clone!
7237 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7238 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7239 return (long)ret_conv;
7242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7243 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)_res;
7245 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7248 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7249 LDKNodeAnnouncementInfo o_conv;
7250 o_conv.inner = (void*)(o & (~1));
7251 o_conv.is_owned = (o & 1) || (o == 0);
7252 // Warning: we may need a move here but can't clone!
7253 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7254 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7255 return (long)ret_conv;
7258 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7259 LDKDecodeError e_conv;
7260 e_conv.inner = (void*)(e & (~1));
7261 e_conv.is_owned = (e & 1) || (e == 0);
7262 // Warning: we may need a move here but can't clone!
7263 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7264 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7265 return (long)ret_conv;
7268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7269 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)_res;
7271 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7274 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7276 o_conv.inner = (void*)(o & (~1));
7277 o_conv.is_owned = (o & 1) || (o == 0);
7278 // Warning: we may need a move here but can't clone!
7279 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7280 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7281 return (long)ret_conv;
7284 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7285 LDKDecodeError e_conv;
7286 e_conv.inner = (void*)(e & (~1));
7287 e_conv.is_owned = (e & 1) || (e == 0);
7288 // Warning: we may need a move here but can't clone!
7289 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7290 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7291 return (long)ret_conv;
7294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7295 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)_res;
7297 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7300 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
7301 LDKNetworkGraph o_conv;
7302 o_conv.inner = (void*)(o & (~1));
7303 o_conv.is_owned = (o & 1) || (o == 0);
7304 // Warning: we may need a move here but can't clone!
7305 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7306 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7307 return (long)ret_conv;
7310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
7311 LDKDecodeError e_conv;
7312 e_conv.inner = (void*)(e & (~1));
7313 e_conv.is_owned = (e & 1) || (e == 0);
7314 // Warning: we may need a move here but can't clone!
7315 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7316 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7317 return (long)ret_conv;
7320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
7321 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)_res;
7323 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7327 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
7328 FREE((void*)this_ptr);
7329 Event_free(this_ptr_conv);
7332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7333 LDKEvent* orig_conv = (LDKEvent*)orig;
7334 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
7335 *ret_copy = Event_clone(orig_conv);
7336 long ret_ref = (long)ret_copy;
7340 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
7341 LDKEvent* obj_conv = (LDKEvent*)obj;
7342 LDKCVec_u8Z arg_var = Event_write(obj_conv);
7343 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7344 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7345 CVec_u8Z_free(arg_var);
7349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7350 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
7351 FREE((void*)this_ptr);
7352 MessageSendEvent_free(this_ptr_conv);
7355 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7356 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
7357 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7358 *ret_copy = MessageSendEvent_clone(orig_conv);
7359 long ret_ref = (long)ret_copy;
7363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7364 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
7365 FREE((void*)this_ptr);
7366 MessageSendEventsProvider_free(this_ptr_conv);
7369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7370 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
7371 FREE((void*)this_ptr);
7372 EventsProvider_free(this_ptr_conv);
7375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7376 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
7377 FREE((void*)this_ptr);
7378 APIError_free(this_ptr_conv);
7381 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7382 LDKAPIError* orig_conv = (LDKAPIError*)orig;
7383 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7384 *ret_copy = APIError_clone(orig_conv);
7385 long ret_ref = (long)ret_copy;
7389 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7390 LDKLevel* orig_conv = (LDKLevel*)orig;
7391 jclass ret_conv = LDKLevel_to_java(env, Level_clone(orig_conv));
7395 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv *env, jclass clz) {
7396 jclass ret_conv = LDKLevel_to_java(env, Level_max());
7400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7401 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
7402 FREE((void*)this_ptr);
7403 Logger_free(this_ptr_conv);
7406 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7407 LDKChannelHandshakeConfig this_ptr_conv;
7408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7409 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7410 ChannelHandshakeConfig_free(this_ptr_conv);
7413 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7414 LDKChannelHandshakeConfig orig_conv;
7415 orig_conv.inner = (void*)(orig & (~1));
7416 orig_conv.is_owned = false;
7417 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
7418 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7419 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7420 long ret_ref = (long)ret_var.inner;
7421 if (ret_var.is_owned) {
7427 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7428 LDKChannelHandshakeConfig this_ptr_conv;
7429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7430 this_ptr_conv.is_owned = false;
7431 int32_t ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
7435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7436 LDKChannelHandshakeConfig this_ptr_conv;
7437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7438 this_ptr_conv.is_owned = false;
7439 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
7442 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7443 LDKChannelHandshakeConfig this_ptr_conv;
7444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7445 this_ptr_conv.is_owned = false;
7446 int16_t ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
7450 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) {
7451 LDKChannelHandshakeConfig this_ptr_conv;
7452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7453 this_ptr_conv.is_owned = false;
7454 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
7457 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7458 LDKChannelHandshakeConfig this_ptr_conv;
7459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7460 this_ptr_conv.is_owned = false;
7461 int64_t ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
7465 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) {
7466 LDKChannelHandshakeConfig this_ptr_conv;
7467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7468 this_ptr_conv.is_owned = false;
7469 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
7472 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) {
7473 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
7474 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7475 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7476 long ret_ref = (long)ret_var.inner;
7477 if (ret_var.is_owned) {
7483 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv *env, jclass clz) {
7484 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
7485 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7486 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7487 long ret_ref = (long)ret_var.inner;
7488 if (ret_var.is_owned) {
7494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7495 LDKChannelHandshakeLimits this_ptr_conv;
7496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7498 ChannelHandshakeLimits_free(this_ptr_conv);
7501 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7502 LDKChannelHandshakeLimits orig_conv;
7503 orig_conv.inner = (void*)(orig & (~1));
7504 orig_conv.is_owned = false;
7505 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
7506 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7507 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7508 long ret_ref = (long)ret_var.inner;
7509 if (ret_var.is_owned) {
7515 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7516 LDKChannelHandshakeLimits this_ptr_conv;
7517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7518 this_ptr_conv.is_owned = false;
7519 int64_t ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
7523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7524 LDKChannelHandshakeLimits this_ptr_conv;
7525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7526 this_ptr_conv.is_owned = false;
7527 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
7530 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
7531 LDKChannelHandshakeLimits this_ptr_conv;
7532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7533 this_ptr_conv.is_owned = false;
7534 int64_t ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
7538 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) {
7539 LDKChannelHandshakeLimits this_ptr_conv;
7540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7541 this_ptr_conv.is_owned = false;
7542 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
7545 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) {
7546 LDKChannelHandshakeLimits this_ptr_conv;
7547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7548 this_ptr_conv.is_owned = false;
7549 int64_t ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
7553 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) {
7554 LDKChannelHandshakeLimits this_ptr_conv;
7555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7556 this_ptr_conv.is_owned = false;
7557 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7561 LDKChannelHandshakeLimits this_ptr_conv;
7562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7563 this_ptr_conv.is_owned = false;
7564 int64_t ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
7568 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) {
7569 LDKChannelHandshakeLimits this_ptr_conv;
7570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7571 this_ptr_conv.is_owned = false;
7572 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
7575 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
7576 LDKChannelHandshakeLimits this_ptr_conv;
7577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7578 this_ptr_conv.is_owned = false;
7579 int16_t ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
7583 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) {
7584 LDKChannelHandshakeLimits this_ptr_conv;
7585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7586 this_ptr_conv.is_owned = false;
7587 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
7590 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7591 LDKChannelHandshakeLimits this_ptr_conv;
7592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7593 this_ptr_conv.is_owned = false;
7594 int64_t ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
7598 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) {
7599 LDKChannelHandshakeLimits this_ptr_conv;
7600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7601 this_ptr_conv.is_owned = false;
7602 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
7605 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
7606 LDKChannelHandshakeLimits this_ptr_conv;
7607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7608 this_ptr_conv.is_owned = false;
7609 int64_t ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
7613 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) {
7614 LDKChannelHandshakeLimits this_ptr_conv;
7615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7616 this_ptr_conv.is_owned = false;
7617 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
7620 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
7621 LDKChannelHandshakeLimits this_ptr_conv;
7622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7623 this_ptr_conv.is_owned = false;
7624 int32_t ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
7628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7629 LDKChannelHandshakeLimits this_ptr_conv;
7630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7631 this_ptr_conv.is_owned = false;
7632 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
7635 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr) {
7636 LDKChannelHandshakeLimits this_ptr_conv;
7637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7638 this_ptr_conv.is_owned = false;
7639 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
7643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7644 LDKChannelHandshakeLimits this_ptr_conv;
7645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7646 this_ptr_conv.is_owned = false;
7647 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
7650 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
7651 LDKChannelHandshakeLimits this_ptr_conv;
7652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7653 this_ptr_conv.is_owned = false;
7654 int16_t ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
7658 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) {
7659 LDKChannelHandshakeLimits this_ptr_conv;
7660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7661 this_ptr_conv.is_owned = false;
7662 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
7665 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) {
7666 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);
7667 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7668 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7669 long ret_ref = (long)ret_var.inner;
7670 if (ret_var.is_owned) {
7676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv *env, jclass clz) {
7677 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
7678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7680 long ret_ref = (long)ret_var.inner;
7681 if (ret_var.is_owned) {
7687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7688 LDKChannelConfig this_ptr_conv;
7689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7691 ChannelConfig_free(this_ptr_conv);
7694 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7695 LDKChannelConfig orig_conv;
7696 orig_conv.inner = (void*)(orig & (~1));
7697 orig_conv.is_owned = false;
7698 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
7699 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7700 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7701 long ret_ref = (long)ret_var.inner;
7702 if (ret_var.is_owned) {
7708 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
7709 LDKChannelConfig this_ptr_conv;
7710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7711 this_ptr_conv.is_owned = false;
7712 int32_t ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
7716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
7717 LDKChannelConfig this_ptr_conv;
7718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7719 this_ptr_conv.is_owned = false;
7720 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
7723 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr) {
7724 LDKChannelConfig this_ptr_conv;
7725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7726 this_ptr_conv.is_owned = false;
7727 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
7731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7732 LDKChannelConfig this_ptr_conv;
7733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7734 this_ptr_conv.is_owned = false;
7735 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
7738 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
7739 LDKChannelConfig this_ptr_conv;
7740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7741 this_ptr_conv.is_owned = false;
7742 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
7746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
7747 LDKChannelConfig this_ptr_conv;
7748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7749 this_ptr_conv.is_owned = false;
7750 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
7753 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) {
7754 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
7755 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7756 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7757 long ret_ref = (long)ret_var.inner;
7758 if (ret_var.is_owned) {
7764 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv *env, jclass clz) {
7765 LDKChannelConfig ret_var = ChannelConfig_default();
7766 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7767 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7768 long ret_ref = (long)ret_var.inner;
7769 if (ret_var.is_owned) {
7775 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv *env, jclass clz, int64_t obj) {
7776 LDKChannelConfig obj_conv;
7777 obj_conv.inner = (void*)(obj & (~1));
7778 obj_conv.is_owned = false;
7779 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
7780 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
7781 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
7782 CVec_u8Z_free(arg_var);
7786 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
7788 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
7789 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
7790 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
7791 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7792 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7793 long ret_ref = (long)ret_var.inner;
7794 if (ret_var.is_owned) {
7797 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
7801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7802 LDKUserConfig this_ptr_conv;
7803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7805 UserConfig_free(this_ptr_conv);
7808 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7809 LDKUserConfig orig_conv;
7810 orig_conv.inner = (void*)(orig & (~1));
7811 orig_conv.is_owned = false;
7812 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
7813 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7814 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7815 long ret_ref = (long)ret_var.inner;
7816 if (ret_var.is_owned) {
7822 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
7823 LDKUserConfig this_ptr_conv;
7824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7825 this_ptr_conv.is_owned = false;
7826 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
7827 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7828 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7829 long ret_ref = (long)ret_var.inner;
7830 if (ret_var.is_owned) {
7836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7837 LDKUserConfig this_ptr_conv;
7838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7839 this_ptr_conv.is_owned = false;
7840 LDKChannelHandshakeConfig val_conv;
7841 val_conv.inner = (void*)(val & (~1));
7842 val_conv.is_owned = (val & 1) || (val == 0);
7843 if (val_conv.inner != NULL)
7844 val_conv = ChannelHandshakeConfig_clone(&val_conv);
7845 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
7848 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv *env, jclass clz, int64_t this_ptr) {
7849 LDKUserConfig this_ptr_conv;
7850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7851 this_ptr_conv.is_owned = false;
7852 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
7853 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7854 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7855 long ret_ref = (long)ret_var.inner;
7856 if (ret_var.is_owned) {
7862 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) {
7863 LDKUserConfig this_ptr_conv;
7864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7865 this_ptr_conv.is_owned = false;
7866 LDKChannelHandshakeLimits val_conv;
7867 val_conv.inner = (void*)(val & (~1));
7868 val_conv.is_owned = (val & 1) || (val == 0);
7869 if (val_conv.inner != NULL)
7870 val_conv = ChannelHandshakeLimits_clone(&val_conv);
7871 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
7874 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr) {
7875 LDKUserConfig this_ptr_conv;
7876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7877 this_ptr_conv.is_owned = false;
7878 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
7879 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7880 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7881 long ret_ref = (long)ret_var.inner;
7882 if (ret_var.is_owned) {
7888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
7889 LDKUserConfig this_ptr_conv;
7890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7891 this_ptr_conv.is_owned = false;
7892 LDKChannelConfig val_conv;
7893 val_conv.inner = (void*)(val & (~1));
7894 val_conv.is_owned = (val & 1) || (val == 0);
7895 if (val_conv.inner != NULL)
7896 val_conv = ChannelConfig_clone(&val_conv);
7897 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
7900 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) {
7901 LDKChannelHandshakeConfig own_channel_config_arg_conv;
7902 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
7903 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
7904 if (own_channel_config_arg_conv.inner != NULL)
7905 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
7906 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
7907 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
7908 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
7909 if (peer_channel_config_limits_arg_conv.inner != NULL)
7910 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
7911 LDKChannelConfig channel_options_arg_conv;
7912 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
7913 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
7914 if (channel_options_arg_conv.inner != NULL)
7915 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
7916 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
7917 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7918 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7919 long ret_ref = (long)ret_var.inner;
7920 if (ret_var.is_owned) {
7926 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv *env, jclass clz) {
7927 LDKUserConfig ret_var = UserConfig_default();
7928 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7929 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7930 long ret_ref = (long)ret_var.inner;
7931 if (ret_var.is_owned) {
7937 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7938 LDKAccessError* orig_conv = (LDKAccessError*)orig;
7939 jclass ret_conv = LDKAccessError_to_java(env, AccessError_clone(orig_conv));
7943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7944 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
7945 FREE((void*)this_ptr);
7946 Access_free(this_ptr_conv);
7949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7950 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
7951 FREE((void*)this_ptr);
7952 Watch_free(this_ptr_conv);
7955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7956 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
7957 FREE((void*)this_ptr);
7958 Filter_free(this_ptr_conv);
7961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7962 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
7963 FREE((void*)this_ptr);
7964 BroadcasterInterface_free(this_ptr_conv);
7967 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv *env, jclass clz, int64_t orig) {
7968 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
7969 jclass ret_conv = LDKConfirmationTarget_to_java(env, ConfirmationTarget_clone(orig_conv));
7973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7974 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
7975 FREE((void*)this_ptr);
7976 FeeEstimator_free(this_ptr_conv);
7979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
7980 LDKChainMonitor this_ptr_conv;
7981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7983 ChainMonitor_free(this_ptr_conv);
7986 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) {
7987 LDKChainMonitor this_arg_conv;
7988 this_arg_conv.inner = (void*)(this_arg & (~1));
7989 this_arg_conv.is_owned = false;
7990 unsigned char header_arr[80];
7991 CHECK((*env)->GetArrayLength(env, header) == 80);
7992 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
7993 unsigned char (*header_ref)[80] = &header_arr;
7994 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7995 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
7996 if (txdata_constr.datalen > 0)
7997 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7999 txdata_constr.data = NULL;
8000 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8001 for (size_t y = 0; y < txdata_constr.datalen; y++) {
8002 int64_t arr_conv_24 = txdata_vals[y];
8003 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
8004 FREE((void*)arr_conv_24);
8005 txdata_constr.data[y] = arr_conv_24_conv;
8007 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8008 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
8011 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) {
8012 LDKChainMonitor this_arg_conv;
8013 this_arg_conv.inner = (void*)(this_arg & (~1));
8014 this_arg_conv.is_owned = false;
8015 unsigned char header_arr[80];
8016 CHECK((*env)->GetArrayLength(env, header) == 80);
8017 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8018 unsigned char (*header_ref)[80] = &header_arr;
8019 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
8022 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) {
8023 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
8024 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
8025 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8026 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8027 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8029 LDKLogger logger_conv = *(LDKLogger*)logger;
8030 if (logger_conv.free == LDKLogger_JCalls_free) {
8031 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8032 LDKLogger_JCalls_clone(logger_conv.this_arg);
8034 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
8035 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
8036 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8037 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
8039 LDKPersist persister_conv = *(LDKPersist*)persister;
8040 if (persister_conv.free == LDKPersist_JCalls_free) {
8041 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8042 LDKPersist_JCalls_clone(persister_conv.this_arg);
8044 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
8045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8047 long ret_ref = (long)ret_var.inner;
8048 if (ret_var.is_owned) {
8054 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
8055 LDKChainMonitor this_arg_conv;
8056 this_arg_conv.inner = (void*)(this_arg & (~1));
8057 this_arg_conv.is_owned = false;
8058 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
8059 *ret = ChainMonitor_as_Watch(&this_arg_conv);
8063 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
8064 LDKChainMonitor this_arg_conv;
8065 this_arg_conv.inner = (void*)(this_arg & (~1));
8066 this_arg_conv.is_owned = false;
8067 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8068 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
8072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8073 LDKChannelMonitorUpdate this_ptr_conv;
8074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8075 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8076 ChannelMonitorUpdate_free(this_ptr_conv);
8079 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8080 LDKChannelMonitorUpdate orig_conv;
8081 orig_conv.inner = (void*)(orig & (~1));
8082 orig_conv.is_owned = false;
8083 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
8084 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8085 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8086 long ret_ref = (long)ret_var.inner;
8087 if (ret_var.is_owned) {
8093 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8094 LDKChannelMonitorUpdate this_ptr_conv;
8095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8096 this_ptr_conv.is_owned = false;
8097 int64_t ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
8101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8102 LDKChannelMonitorUpdate this_ptr_conv;
8103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8104 this_ptr_conv.is_owned = false;
8105 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
8108 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
8109 LDKChannelMonitorUpdate obj_conv;
8110 obj_conv.inner = (void*)(obj & (~1));
8111 obj_conv.is_owned = false;
8112 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
8113 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8114 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8115 CVec_u8Z_free(arg_var);
8119 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8121 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8122 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8123 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8124 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
8125 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8126 return (long)ret_conv;
8129 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8130 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
8131 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(env, ChannelMonitorUpdateErr_clone(orig_conv));
8135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8136 LDKMonitorUpdateError this_ptr_conv;
8137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8139 MonitorUpdateError_free(this_ptr_conv);
8142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8143 LDKMonitorEvent this_ptr_conv;
8144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8146 MonitorEvent_free(this_ptr_conv);
8149 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8150 LDKMonitorEvent orig_conv;
8151 orig_conv.inner = (void*)(orig & (~1));
8152 orig_conv.is_owned = false;
8153 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
8154 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8155 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8156 long ret_ref = (long)ret_var.inner;
8157 if (ret_var.is_owned) {
8163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8164 LDKHTLCUpdate this_ptr_conv;
8165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8167 HTLCUpdate_free(this_ptr_conv);
8170 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8171 LDKHTLCUpdate orig_conv;
8172 orig_conv.inner = (void*)(orig & (~1));
8173 orig_conv.is_owned = false;
8174 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
8175 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8176 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8177 long ret_ref = (long)ret_var.inner;
8178 if (ret_var.is_owned) {
8184 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
8185 LDKHTLCUpdate obj_conv;
8186 obj_conv.inner = (void*)(obj & (~1));
8187 obj_conv.is_owned = false;
8188 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
8189 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8190 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8191 CVec_u8Z_free(arg_var);
8195 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8197 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8198 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8199 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
8200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8202 long ret_ref = (long)ret_var.inner;
8203 if (ret_var.is_owned) {
8206 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8211 LDKChannelMonitor this_ptr_conv;
8212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8213 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8214 ChannelMonitor_free(this_ptr_conv);
8217 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8218 LDKChannelMonitor obj_conv;
8219 obj_conv.inner = (void*)(obj & (~1));
8220 obj_conv.is_owned = false;
8221 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
8222 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8223 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8224 CVec_u8Z_free(arg_var);
8228 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) {
8229 LDKChannelMonitor this_arg_conv;
8230 this_arg_conv.inner = (void*)(this_arg & (~1));
8231 this_arg_conv.is_owned = false;
8232 LDKChannelMonitorUpdate updates_conv;
8233 updates_conv.inner = (void*)(updates & (~1));
8234 updates_conv.is_owned = false;
8235 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
8236 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
8237 LDKLogger* logger_conv = (LDKLogger*)logger;
8238 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8239 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
8240 return (long)ret_conv;
8243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8244 LDKChannelMonitor this_arg_conv;
8245 this_arg_conv.inner = (void*)(this_arg & (~1));
8246 this_arg_conv.is_owned = false;
8247 int64_t ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
8251 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv *env, jclass clz, int64_t this_arg) {
8252 LDKChannelMonitor this_arg_conv;
8253 this_arg_conv.inner = (void*)(this_arg & (~1));
8254 this_arg_conv.is_owned = false;
8255 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8256 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
8257 ret_ref->a = OutPoint_clone(&ret_ref->a);
8258 ret_ref->b = CVec_u8Z_clone(&ret_ref->b);
8259 return (long)ret_ref;
8262 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8263 LDKChannelMonitor this_arg_conv;
8264 this_arg_conv.inner = (void*)(this_arg & (~1));
8265 this_arg_conv.is_owned = false;
8266 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
8267 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8268 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8269 for (size_t o = 0; o < ret_var.datalen; o++) {
8270 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
8271 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8272 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8273 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
8274 if (arr_conv_14_var.is_owned) {
8275 arr_conv_14_ref |= 1;
8277 ret_arr_ptr[o] = arr_conv_14_ref;
8279 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8284 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
8285 LDKChannelMonitor this_arg_conv;
8286 this_arg_conv.inner = (void*)(this_arg & (~1));
8287 this_arg_conv.is_owned = false;
8288 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
8289 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8290 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8291 for (size_t h = 0; h < ret_var.datalen; h++) {
8292 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8293 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
8294 long arr_conv_7_ref = (long)arr_conv_7_copy;
8295 ret_arr_ptr[h] = arr_conv_7_ref;
8297 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8302 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) {
8303 LDKChannelMonitor this_arg_conv;
8304 this_arg_conv.inner = (void*)(this_arg & (~1));
8305 this_arg_conv.is_owned = false;
8306 LDKLogger* logger_conv = (LDKLogger*)logger;
8307 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
8308 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
8310 for (size_t i = 0; i < ret_var.datalen; i++) {
8311 LDKTransaction arr_conv_8_var = ret_var.data[i];
8312 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, arr_conv_8_var.datalen);
8313 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
8314 Transaction_free(arr_conv_8_var);
8315 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
8321 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) {
8322 LDKChannelMonitor this_arg_conv;
8323 this_arg_conv.inner = (void*)(this_arg & (~1));
8324 this_arg_conv.is_owned = false;
8325 unsigned char header_arr[80];
8326 CHECK((*env)->GetArrayLength(env, header) == 80);
8327 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8328 unsigned char (*header_ref)[80] = &header_arr;
8329 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8330 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
8331 if (txdata_constr.datalen > 0)
8332 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8334 txdata_constr.data = NULL;
8335 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
8336 for (size_t y = 0; y < txdata_constr.datalen; y++) {
8337 int64_t arr_conv_24 = txdata_vals[y];
8338 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
8339 FREE((void*)arr_conv_24);
8340 txdata_constr.data[y] = arr_conv_24_conv;
8342 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
8343 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
8344 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8345 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8346 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8348 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8349 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8350 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8351 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8353 LDKLogger logger_conv = *(LDKLogger*)logger;
8354 if (logger_conv.free == LDKLogger_JCalls_free) {
8355 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8356 LDKLogger_JCalls_clone(logger_conv.this_arg);
8358 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);
8359 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
8360 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
8361 for (size_t u = 0; u < ret_var.datalen; u++) {
8362 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8363 *arr_conv_46_ref = ret_var.data[u];
8364 arr_conv_46_ref->a = ThirtyTwoBytes_clone(&arr_conv_46_ref->a);
8365 arr_conv_46_ref->b = CVec_C2Tuple_u32TxOutZZ_clone(&arr_conv_46_ref->b);
8366 ret_arr_ptr[u] = (long)arr_conv_46_ref;
8368 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
8373 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) {
8374 LDKChannelMonitor this_arg_conv;
8375 this_arg_conv.inner = (void*)(this_arg & (~1));
8376 this_arg_conv.is_owned = false;
8377 unsigned char header_arr[80];
8378 CHECK((*env)->GetArrayLength(env, header) == 80);
8379 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
8380 unsigned char (*header_ref)[80] = &header_arr;
8381 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
8382 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8383 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8384 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8386 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8387 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8388 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8389 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8391 LDKLogger logger_conv = *(LDKLogger*)logger;
8392 if (logger_conv.free == LDKLogger_JCalls_free) {
8393 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8394 LDKLogger_JCalls_clone(logger_conv.this_arg);
8396 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
8399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8400 LDKPersist this_ptr_conv = *(LDKPersist*)this_ptr;
8401 FREE((void*)this_ptr);
8402 Persist_free(this_ptr_conv);
8405 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
8407 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8408 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8409 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
8410 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8411 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
8412 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8413 return (long)ret_conv;
8416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8417 LDKOutPoint this_ptr_conv;
8418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8420 OutPoint_free(this_ptr_conv);
8423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8424 LDKOutPoint orig_conv;
8425 orig_conv.inner = (void*)(orig & (~1));
8426 orig_conv.is_owned = false;
8427 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
8428 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8429 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8430 long ret_ref = (long)ret_var.inner;
8431 if (ret_var.is_owned) {
8437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
8438 LDKOutPoint this_ptr_conv;
8439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8440 this_ptr_conv.is_owned = false;
8441 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8442 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
8446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8447 LDKOutPoint this_ptr_conv;
8448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8449 this_ptr_conv.is_owned = false;
8450 LDKThirtyTwoBytes val_ref;
8451 CHECK((*env)->GetArrayLength(env, val) == 32);
8452 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8453 OutPoint_set_txid(&this_ptr_conv, val_ref);
8456 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
8457 LDKOutPoint this_ptr_conv;
8458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8459 this_ptr_conv.is_owned = false;
8460 int16_t ret_val = OutPoint_get_index(&this_ptr_conv);
8464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
8465 LDKOutPoint this_ptr_conv;
8466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8467 this_ptr_conv.is_owned = false;
8468 OutPoint_set_index(&this_ptr_conv, val);
8471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv *env, jclass clz, int8_tArray txid_arg, int16_t index_arg) {
8472 LDKThirtyTwoBytes txid_arg_ref;
8473 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
8474 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
8475 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
8476 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8477 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8478 long ret_ref = (long)ret_var.inner;
8479 if (ret_var.is_owned) {
8485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
8486 LDKOutPoint this_arg_conv;
8487 this_arg_conv.inner = (void*)(this_arg & (~1));
8488 this_arg_conv.is_owned = false;
8489 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
8490 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
8494 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv *env, jclass clz, int64_t obj) {
8495 LDKOutPoint obj_conv;
8496 obj_conv.inner = (void*)(obj & (~1));
8497 obj_conv.is_owned = false;
8498 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
8499 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8500 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8501 CVec_u8Z_free(arg_var);
8505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8507 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8508 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8509 LDKOutPoint ret_var = OutPoint_read(ser_ref);
8510 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8511 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8512 long ret_ref = (long)ret_var.inner;
8513 if (ret_var.is_owned) {
8516 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8521 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
8522 FREE((void*)this_ptr);
8523 SpendableOutputDescriptor_free(this_ptr_conv);
8526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8527 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
8528 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
8529 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
8530 long ret_ref = (long)ret_copy;
8534 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv *env, jclass clz, int64_t obj) {
8535 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
8536 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
8537 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8538 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8539 CVec_u8Z_free(arg_var);
8543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8545 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8546 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8547 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8548 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
8549 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8550 return (long)ret_conv;
8553 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8554 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
8555 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8556 *ret = ChannelKeys_clone(orig_conv);
8560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8561 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
8562 FREE((void*)this_ptr);
8563 ChannelKeys_free(this_ptr_conv);
8566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8567 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
8568 FREE((void*)this_ptr);
8569 KeysInterface_free(this_ptr_conv);
8572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8573 LDKInMemoryChannelKeys this_ptr_conv;
8574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8576 InMemoryChannelKeys_free(this_ptr_conv);
8579 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8580 LDKInMemoryChannelKeys orig_conv;
8581 orig_conv.inner = (void*)(orig & (~1));
8582 orig_conv.is_owned = false;
8583 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
8584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8586 long ret_ref = (long)ret_var.inner;
8587 if (ret_var.is_owned) {
8593 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8594 LDKInMemoryChannelKeys this_ptr_conv;
8595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8596 this_ptr_conv.is_owned = false;
8597 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8598 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
8602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8603 LDKInMemoryChannelKeys this_ptr_conv;
8604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8605 this_ptr_conv.is_owned = false;
8606 LDKSecretKey val_ref;
8607 CHECK((*env)->GetArrayLength(env, val) == 32);
8608 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8609 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
8612 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8613 LDKInMemoryChannelKeys this_ptr_conv;
8614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8615 this_ptr_conv.is_owned = false;
8616 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8617 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
8621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8622 LDKInMemoryChannelKeys this_ptr_conv;
8623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8624 this_ptr_conv.is_owned = false;
8625 LDKSecretKey val_ref;
8626 CHECK((*env)->GetArrayLength(env, val) == 32);
8627 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8628 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
8631 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8632 LDKInMemoryChannelKeys this_ptr_conv;
8633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8634 this_ptr_conv.is_owned = false;
8635 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8636 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
8640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8641 LDKInMemoryChannelKeys this_ptr_conv;
8642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8643 this_ptr_conv.is_owned = false;
8644 LDKSecretKey val_ref;
8645 CHECK((*env)->GetArrayLength(env, val) == 32);
8646 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8647 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
8650 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8651 LDKInMemoryChannelKeys this_ptr_conv;
8652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8653 this_ptr_conv.is_owned = false;
8654 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8655 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
8659 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) {
8660 LDKInMemoryChannelKeys this_ptr_conv;
8661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8662 this_ptr_conv.is_owned = false;
8663 LDKSecretKey val_ref;
8664 CHECK((*env)->GetArrayLength(env, val) == 32);
8665 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8666 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
8669 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
8670 LDKInMemoryChannelKeys this_ptr_conv;
8671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8672 this_ptr_conv.is_owned = false;
8673 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8674 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
8678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8679 LDKInMemoryChannelKeys this_ptr_conv;
8680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8681 this_ptr_conv.is_owned = false;
8682 LDKSecretKey val_ref;
8683 CHECK((*env)->GetArrayLength(env, val) == 32);
8684 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.bytes);
8685 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
8688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr) {
8689 LDKInMemoryChannelKeys this_ptr_conv;
8690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8691 this_ptr_conv.is_owned = false;
8692 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8693 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
8697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8698 LDKInMemoryChannelKeys this_ptr_conv;
8699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8700 this_ptr_conv.is_owned = false;
8701 LDKThirtyTwoBytes val_ref;
8702 CHECK((*env)->GetArrayLength(env, val) == 32);
8703 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8704 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
8707 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) {
8708 LDKSecretKey funding_key_ref;
8709 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
8710 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_ref.bytes);
8711 LDKSecretKey revocation_base_key_ref;
8712 CHECK((*env)->GetArrayLength(env, revocation_base_key) == 32);
8713 (*env)->GetByteArrayRegion(env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
8714 LDKSecretKey payment_key_ref;
8715 CHECK((*env)->GetArrayLength(env, payment_key) == 32);
8716 (*env)->GetByteArrayRegion(env, payment_key, 0, 32, payment_key_ref.bytes);
8717 LDKSecretKey delayed_payment_base_key_ref;
8718 CHECK((*env)->GetArrayLength(env, delayed_payment_base_key) == 32);
8719 (*env)->GetByteArrayRegion(env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
8720 LDKSecretKey htlc_base_key_ref;
8721 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
8722 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
8723 LDKThirtyTwoBytes commitment_seed_ref;
8724 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
8725 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_ref.data);
8726 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
8727 FREE((void*)key_derivation_params);
8728 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);
8729 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8730 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8731 long ret_ref = (long)ret_var.inner;
8732 if (ret_var.is_owned) {
8738 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8739 LDKInMemoryChannelKeys this_arg_conv;
8740 this_arg_conv.inner = (void*)(this_arg & (~1));
8741 this_arg_conv.is_owned = false;
8742 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
8743 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8744 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8745 long ret_ref = (long)ret_var.inner;
8746 if (ret_var.is_owned) {
8752 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8753 LDKInMemoryChannelKeys this_arg_conv;
8754 this_arg_conv.inner = (void*)(this_arg & (~1));
8755 this_arg_conv.is_owned = false;
8756 int16_t ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
8760 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
8761 LDKInMemoryChannelKeys this_arg_conv;
8762 this_arg_conv.inner = (void*)(this_arg & (~1));
8763 this_arg_conv.is_owned = false;
8764 int16_t ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
8768 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
8769 LDKInMemoryChannelKeys this_arg_conv;
8770 this_arg_conv.inner = (void*)(this_arg & (~1));
8771 this_arg_conv.is_owned = false;
8772 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
8776 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
8777 LDKInMemoryChannelKeys this_arg_conv;
8778 this_arg_conv.inner = (void*)(this_arg & (~1));
8779 this_arg_conv.is_owned = false;
8780 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
8781 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8782 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8783 long ret_ref = (long)ret_var.inner;
8784 if (ret_var.is_owned) {
8790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters(JNIEnv *env, jclass clz, int64_t this_arg) {
8791 LDKInMemoryChannelKeys this_arg_conv;
8792 this_arg_conv.inner = (void*)(this_arg & (~1));
8793 this_arg_conv.is_owned = false;
8794 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
8795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8797 long ret_ref = (long)ret_var.inner;
8798 if (ret_var.is_owned) {
8804 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv *env, jclass clz, int64_t this_arg) {
8805 LDKInMemoryChannelKeys this_arg_conv;
8806 this_arg_conv.inner = (void*)(this_arg & (~1));
8807 this_arg_conv.is_owned = false;
8808 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8809 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
8813 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
8814 LDKInMemoryChannelKeys obj_conv;
8815 obj_conv.inner = (void*)(obj & (~1));
8816 obj_conv.is_owned = false;
8817 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
8818 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
8819 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
8820 CVec_u8Z_free(arg_var);
8824 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
8826 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
8827 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
8828 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
8829 *ret_conv = InMemoryChannelKeys_read(ser_ref);
8830 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
8831 return (long)ret_conv;
8834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8835 LDKKeysManager this_ptr_conv;
8836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8838 KeysManager_free(this_ptr_conv);
8841 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) {
8842 unsigned char seed_arr[32];
8843 CHECK((*env)->GetArrayLength(env, seed) == 32);
8844 (*env)->GetByteArrayRegion(env, seed, 0, 32, seed_arr);
8845 unsigned char (*seed_ref)[32] = &seed_arr;
8846 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
8847 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
8848 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8849 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8850 long ret_ref = (long)ret_var.inner;
8851 if (ret_var.is_owned) {
8857 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) {
8858 LDKKeysManager this_arg_conv;
8859 this_arg_conv.inner = (void*)(this_arg & (~1));
8860 this_arg_conv.is_owned = false;
8861 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
8862 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8863 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8864 long ret_ref = (long)ret_var.inner;
8865 if (ret_var.is_owned) {
8871 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv *env, jclass clz, int64_t this_arg) {
8872 LDKKeysManager this_arg_conv;
8873 this_arg_conv.inner = (void*)(this_arg & (~1));
8874 this_arg_conv.is_owned = false;
8875 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
8876 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
8880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8881 LDKChannelManager this_ptr_conv;
8882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8883 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8884 ChannelManager_free(this_ptr_conv);
8887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
8888 LDKChannelDetails this_ptr_conv;
8889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8891 ChannelDetails_free(this_ptr_conv);
8894 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv *env, jclass clz, int64_t orig) {
8895 LDKChannelDetails orig_conv;
8896 orig_conv.inner = (void*)(orig & (~1));
8897 orig_conv.is_owned = false;
8898 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
8899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8901 long ret_ref = (long)ret_var.inner;
8902 if (ret_var.is_owned) {
8908 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8909 LDKChannelDetails this_ptr_conv;
8910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8911 this_ptr_conv.is_owned = false;
8912 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
8913 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
8917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8918 LDKChannelDetails this_ptr_conv;
8919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8920 this_ptr_conv.is_owned = false;
8921 LDKThirtyTwoBytes val_ref;
8922 CHECK((*env)->GetArrayLength(env, val) == 32);
8923 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
8924 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
8927 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8928 LDKChannelDetails this_ptr_conv;
8929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8930 this_ptr_conv.is_owned = false;
8931 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
8932 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
8936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
8937 LDKChannelDetails this_ptr_conv;
8938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8939 this_ptr_conv.is_owned = false;
8940 LDKPublicKey val_ref;
8941 CHECK((*env)->GetArrayLength(env, val) == 33);
8942 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
8943 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
8946 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
8947 LDKChannelDetails this_ptr_conv;
8948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8949 this_ptr_conv.is_owned = false;
8950 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
8951 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8952 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8953 long ret_ref = (long)ret_var.inner;
8954 if (ret_var.is_owned) {
8960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8961 LDKChannelDetails this_ptr_conv;
8962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8963 this_ptr_conv.is_owned = false;
8964 LDKInitFeatures val_conv;
8965 val_conv.inner = (void*)(val & (~1));
8966 val_conv.is_owned = (val & 1) || (val == 0);
8967 // Warning: we may need a move here but can't clone!
8968 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
8971 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
8972 LDKChannelDetails this_ptr_conv;
8973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8974 this_ptr_conv.is_owned = false;
8975 int64_t ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
8979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8980 LDKChannelDetails this_ptr_conv;
8981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8982 this_ptr_conv.is_owned = false;
8983 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
8986 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
8987 LDKChannelDetails this_ptr_conv;
8988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8989 this_ptr_conv.is_owned = false;
8990 int64_t ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
8994 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
8995 LDKChannelDetails this_ptr_conv;
8996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8997 this_ptr_conv.is_owned = false;
8998 ChannelDetails_set_user_id(&this_ptr_conv, val);
9001 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9002 LDKChannelDetails this_ptr_conv;
9003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9004 this_ptr_conv.is_owned = false;
9005 int64_t ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
9009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9010 LDKChannelDetails this_ptr_conv;
9011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9012 this_ptr_conv.is_owned = false;
9013 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
9016 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9017 LDKChannelDetails this_ptr_conv;
9018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9019 this_ptr_conv.is_owned = false;
9020 int64_t ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
9024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9025 LDKChannelDetails this_ptr_conv;
9026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9027 this_ptr_conv.is_owned = false;
9028 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
9031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr) {
9032 LDKChannelDetails this_ptr_conv;
9033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9034 this_ptr_conv.is_owned = false;
9035 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
9039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
9040 LDKChannelDetails this_ptr_conv;
9041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9042 this_ptr_conv.is_owned = false;
9043 ChannelDetails_set_is_live(&this_ptr_conv, val);
9046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9047 LDKPaymentSendFailure this_ptr_conv;
9048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9050 PaymentSendFailure_free(this_ptr_conv);
9053 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) {
9054 LDKNetwork network_conv = LDKNetwork_from_java(env, network);
9055 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
9056 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
9057 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9058 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
9060 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
9061 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9062 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9063 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9065 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
9066 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9067 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9068 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9070 LDKLogger logger_conv = *(LDKLogger*)logger;
9071 if (logger_conv.free == LDKLogger_JCalls_free) {
9072 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9073 LDKLogger_JCalls_clone(logger_conv.this_arg);
9075 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
9076 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9077 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9078 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9080 LDKUserConfig config_conv;
9081 config_conv.inner = (void*)(config & (~1));
9082 config_conv.is_owned = (config & 1) || (config == 0);
9083 if (config_conv.inner != NULL)
9084 config_conv = UserConfig_clone(&config_conv);
9085 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);
9086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9088 long ret_ref = (long)ret_var.inner;
9089 if (ret_var.is_owned) {
9095 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) {
9096 LDKChannelManager this_arg_conv;
9097 this_arg_conv.inner = (void*)(this_arg & (~1));
9098 this_arg_conv.is_owned = false;
9099 LDKPublicKey their_network_key_ref;
9100 CHECK((*env)->GetArrayLength(env, their_network_key) == 33);
9101 (*env)->GetByteArrayRegion(env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
9102 LDKUserConfig override_config_conv;
9103 override_config_conv.inner = (void*)(override_config & (~1));
9104 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
9105 if (override_config_conv.inner != NULL)
9106 override_config_conv = UserConfig_clone(&override_config_conv);
9107 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9108 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
9109 return (long)ret_conv;
9112 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9113 LDKChannelManager this_arg_conv;
9114 this_arg_conv.inner = (void*)(this_arg & (~1));
9115 this_arg_conv.is_owned = false;
9116 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
9117 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9118 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9119 for (size_t q = 0; q < ret_var.datalen; q++) {
9120 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9121 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9122 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9123 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9124 if (arr_conv_16_var.is_owned) {
9125 arr_conv_16_ref |= 1;
9127 ret_arr_ptr[q] = arr_conv_16_ref;
9129 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9134 JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9135 LDKChannelManager this_arg_conv;
9136 this_arg_conv.inner = (void*)(this_arg & (~1));
9137 this_arg_conv.is_owned = false;
9138 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
9139 int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
9140 int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
9141 for (size_t q = 0; q < ret_var.datalen; q++) {
9142 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9143 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9144 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9145 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9146 if (arr_conv_16_var.is_owned) {
9147 arr_conv_16_ref |= 1;
9149 ret_arr_ptr[q] = arr_conv_16_ref;
9151 (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
9156 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
9157 LDKChannelManager this_arg_conv;
9158 this_arg_conv.inner = (void*)(this_arg & (~1));
9159 this_arg_conv.is_owned = false;
9160 unsigned char channel_id_arr[32];
9161 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9162 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9163 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9164 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9165 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
9166 return (long)ret_conv;
9169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray channel_id) {
9170 LDKChannelManager this_arg_conv;
9171 this_arg_conv.inner = (void*)(this_arg & (~1));
9172 this_arg_conv.is_owned = false;
9173 unsigned char channel_id_arr[32];
9174 CHECK((*env)->GetArrayLength(env, channel_id) == 32);
9175 (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_arr);
9176 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9177 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
9180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv *env, jclass clz, int64_t this_arg) {
9181 LDKChannelManager this_arg_conv;
9182 this_arg_conv.inner = (void*)(this_arg & (~1));
9183 this_arg_conv.is_owned = false;
9184 ChannelManager_force_close_all_channels(&this_arg_conv);
9187 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) {
9188 LDKChannelManager this_arg_conv;
9189 this_arg_conv.inner = (void*)(this_arg & (~1));
9190 this_arg_conv.is_owned = false;
9191 LDKRoute route_conv;
9192 route_conv.inner = (void*)(route & (~1));
9193 route_conv.is_owned = false;
9194 LDKThirtyTwoBytes payment_hash_ref;
9195 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9196 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
9197 LDKThirtyTwoBytes payment_secret_ref;
9198 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9199 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9200 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9201 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
9202 return (long)ret_conv;
9205 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) {
9206 LDKChannelManager this_arg_conv;
9207 this_arg_conv.inner = (void*)(this_arg & (~1));
9208 this_arg_conv.is_owned = false;
9209 unsigned char temporary_channel_id_arr[32];
9210 CHECK((*env)->GetArrayLength(env, temporary_channel_id) == 32);
9211 (*env)->GetByteArrayRegion(env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
9212 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
9213 LDKOutPoint funding_txo_conv;
9214 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9215 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
9216 if (funding_txo_conv.inner != NULL)
9217 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9218 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
9221 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) {
9222 LDKChannelManager this_arg_conv;
9223 this_arg_conv.inner = (void*)(this_arg & (~1));
9224 this_arg_conv.is_owned = false;
9225 LDKThreeBytes rgb_ref;
9226 CHECK((*env)->GetArrayLength(env, rgb) == 3);
9227 (*env)->GetByteArrayRegion(env, rgb, 0, 3, rgb_ref.data);
9228 LDKThirtyTwoBytes alias_ref;
9229 CHECK((*env)->GetArrayLength(env, alias) == 32);
9230 (*env)->GetByteArrayRegion(env, alias, 0, 32, alias_ref.data);
9231 LDKCVec_NetAddressZ addresses_constr;
9232 addresses_constr.datalen = (*env)->GetArrayLength(env, addresses);
9233 if (addresses_constr.datalen > 0)
9234 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9236 addresses_constr.data = NULL;
9237 int64_t* addresses_vals = (*env)->GetLongArrayElements (env, addresses, NULL);
9238 for (size_t m = 0; m < addresses_constr.datalen; m++) {
9239 int64_t arr_conv_12 = addresses_vals[m];
9240 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9241 FREE((void*)arr_conv_12);
9242 addresses_constr.data[m] = arr_conv_12_conv;
9244 (*env)->ReleaseLongArrayElements(env, addresses, addresses_vals, 0);
9245 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
9248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv *env, jclass clz, int64_t this_arg) {
9249 LDKChannelManager this_arg_conv;
9250 this_arg_conv.inner = (void*)(this_arg & (~1));
9251 this_arg_conv.is_owned = false;
9252 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
9255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv *env, jclass clz, int64_t this_arg) {
9256 LDKChannelManager this_arg_conv;
9257 this_arg_conv.inner = (void*)(this_arg & (~1));
9258 this_arg_conv.is_owned = false;
9259 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
9262 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) {
9263 LDKChannelManager this_arg_conv;
9264 this_arg_conv.inner = (void*)(this_arg & (~1));
9265 this_arg_conv.is_owned = false;
9266 unsigned char payment_hash_arr[32];
9267 CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
9268 (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr);
9269 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
9270 LDKThirtyTwoBytes payment_secret_ref;
9271 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9272 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9273 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
9277 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) {
9278 LDKChannelManager this_arg_conv;
9279 this_arg_conv.inner = (void*)(this_arg & (~1));
9280 this_arg_conv.is_owned = false;
9281 LDKThirtyTwoBytes payment_preimage_ref;
9282 CHECK((*env)->GetArrayLength(env, payment_preimage) == 32);
9283 (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data);
9284 LDKThirtyTwoBytes payment_secret_ref;
9285 CHECK((*env)->GetArrayLength(env, payment_secret) == 32);
9286 (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data);
9287 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
9291 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
9292 LDKChannelManager this_arg_conv;
9293 this_arg_conv.inner = (void*)(this_arg & (~1));
9294 this_arg_conv.is_owned = false;
9295 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
9296 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
9300 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) {
9301 LDKChannelManager this_arg_conv;
9302 this_arg_conv.inner = (void*)(this_arg & (~1));
9303 this_arg_conv.is_owned = false;
9304 LDKOutPoint funding_txo_conv;
9305 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9306 funding_txo_conv.is_owned = false;
9307 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
9310 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9311 LDKChannelManager this_arg_conv;
9312 this_arg_conv.inner = (void*)(this_arg & (~1));
9313 this_arg_conv.is_owned = false;
9314 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9315 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
9319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
9320 LDKChannelManager this_arg_conv;
9321 this_arg_conv.inner = (void*)(this_arg & (~1));
9322 this_arg_conv.is_owned = false;
9323 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9324 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
9328 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) {
9329 LDKChannelManager this_arg_conv;
9330 this_arg_conv.inner = (void*)(this_arg & (~1));
9331 this_arg_conv.is_owned = false;
9332 unsigned char header_arr[80];
9333 CHECK((*env)->GetArrayLength(env, header) == 80);
9334 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9335 unsigned char (*header_ref)[80] = &header_arr;
9336 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9337 txdata_constr.datalen = (*env)->GetArrayLength(env, txdata);
9338 if (txdata_constr.datalen > 0)
9339 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9341 txdata_constr.data = NULL;
9342 int64_t* txdata_vals = (*env)->GetLongArrayElements (env, txdata, NULL);
9343 for (size_t y = 0; y < txdata_constr.datalen; y++) {
9344 int64_t arr_conv_24 = txdata_vals[y];
9345 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
9346 FREE((void*)arr_conv_24);
9347 txdata_constr.data[y] = arr_conv_24_conv;
9349 (*env)->ReleaseLongArrayElements(env, txdata, txdata_vals, 0);
9350 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray header) {
9354 LDKChannelManager this_arg_conv;
9355 this_arg_conv.inner = (void*)(this_arg & (~1));
9356 this_arg_conv.is_owned = false;
9357 unsigned char header_arr[80];
9358 CHECK((*env)->GetArrayLength(env, header) == 80);
9359 (*env)->GetByteArrayRegion(env, header, 0, 80, header_arr);
9360 unsigned char (*header_ref)[80] = &header_arr;
9361 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
9364 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
9365 LDKChannelManager this_arg_conv;
9366 this_arg_conv.inner = (void*)(this_arg & (~1));
9367 this_arg_conv.is_owned = false;
9368 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9369 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
9373 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
9374 LDKChannelManager obj_conv;
9375 obj_conv.inner = (void*)(obj & (~1));
9376 obj_conv.is_owned = false;
9377 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
9378 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
9379 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
9380 CVec_u8Z_free(arg_var);
9384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9385 LDKChannelManagerReadArgs this_ptr_conv;
9386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9388 ChannelManagerReadArgs_free(this_ptr_conv);
9391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr) {
9392 LDKChannelManagerReadArgs this_ptr_conv;
9393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9394 this_ptr_conv.is_owned = false;
9395 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
9399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9400 LDKChannelManagerReadArgs this_ptr_conv;
9401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9402 this_ptr_conv.is_owned = false;
9403 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
9404 if (val_conv.free == LDKKeysInterface_JCalls_free) {
9405 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9406 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
9408 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
9411 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr) {
9412 LDKChannelManagerReadArgs this_ptr_conv;
9413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9414 this_ptr_conv.is_owned = false;
9415 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
9419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9420 LDKChannelManagerReadArgs this_ptr_conv;
9421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9422 this_ptr_conv.is_owned = false;
9423 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
9424 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
9425 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9426 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
9428 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
9431 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr) {
9432 LDKChannelManagerReadArgs this_ptr_conv;
9433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9434 this_ptr_conv.is_owned = false;
9435 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
9439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9440 LDKChannelManagerReadArgs this_ptr_conv;
9441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9442 this_ptr_conv.is_owned = false;
9443 LDKWatch val_conv = *(LDKWatch*)val;
9444 if (val_conv.free == LDKWatch_JCalls_free) {
9445 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9446 LDKWatch_JCalls_clone(val_conv.this_arg);
9448 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
9451 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr) {
9452 LDKChannelManagerReadArgs this_ptr_conv;
9453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9454 this_ptr_conv.is_owned = false;
9455 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
9459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9460 LDKChannelManagerReadArgs this_ptr_conv;
9461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9462 this_ptr_conv.is_owned = false;
9463 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
9464 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
9465 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9466 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
9468 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
9471 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv *env, jclass clz, int64_t this_ptr) {
9472 LDKChannelManagerReadArgs this_ptr_conv;
9473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9474 this_ptr_conv.is_owned = false;
9475 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
9479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9480 LDKChannelManagerReadArgs this_ptr_conv;
9481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9482 this_ptr_conv.is_owned = false;
9483 LDKLogger val_conv = *(LDKLogger*)val;
9484 if (val_conv.free == LDKLogger_JCalls_free) {
9485 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9486 LDKLogger_JCalls_clone(val_conv.this_arg);
9488 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
9491 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr) {
9492 LDKChannelManagerReadArgs this_ptr_conv;
9493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9494 this_ptr_conv.is_owned = false;
9495 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
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 void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9506 LDKChannelManagerReadArgs this_ptr_conv;
9507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9508 this_ptr_conv.is_owned = false;
9509 LDKUserConfig val_conv;
9510 val_conv.inner = (void*)(val & (~1));
9511 val_conv.is_owned = (val & 1) || (val == 0);
9512 if (val_conv.inner != NULL)
9513 val_conv = UserConfig_clone(&val_conv);
9514 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
9517 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) {
9518 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
9519 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9520 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9521 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9523 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
9524 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
9525 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9526 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
9528 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
9529 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9530 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9531 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9533 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
9534 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9535 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9536 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9538 LDKLogger logger_conv = *(LDKLogger*)logger;
9539 if (logger_conv.free == LDKLogger_JCalls_free) {
9540 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9541 LDKLogger_JCalls_clone(logger_conv.this_arg);
9543 LDKUserConfig default_config_conv;
9544 default_config_conv.inner = (void*)(default_config & (~1));
9545 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
9546 if (default_config_conv.inner != NULL)
9547 default_config_conv = UserConfig_clone(&default_config_conv);
9548 LDKCVec_ChannelMonitorZ channel_monitors_constr;
9549 channel_monitors_constr.datalen = (*env)->GetArrayLength(env, channel_monitors);
9550 if (channel_monitors_constr.datalen > 0)
9551 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9553 channel_monitors_constr.data = NULL;
9554 int64_t* channel_monitors_vals = (*env)->GetLongArrayElements (env, channel_monitors, NULL);
9555 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
9556 int64_t arr_conv_16 = channel_monitors_vals[q];
9557 LDKChannelMonitor arr_conv_16_conv;
9558 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
9559 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
9560 // Warning: we may need a move here but can't clone!
9561 channel_monitors_constr.data[q] = arr_conv_16_conv;
9563 (*env)->ReleaseLongArrayElements(env, channel_monitors, channel_monitors_vals, 0);
9564 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);
9565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9567 long ret_ref = (long)ret_var.inner;
9568 if (ret_var.is_owned) {
9574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv *env, jclass clz, int8_tArray ser, int64_t arg) {
9576 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
9577 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
9578 LDKChannelManagerReadArgs arg_conv;
9579 arg_conv.inner = (void*)(arg & (~1));
9580 arg_conv.is_owned = (arg & 1) || (arg == 0);
9581 // Warning: we may need a move here but can't clone!
9582 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9583 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
9584 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
9585 return (long)ret_conv;
9588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9589 LDKDecodeError this_ptr_conv;
9590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9592 DecodeError_free(this_ptr_conv);
9595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9596 LDKInit this_ptr_conv;
9597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9599 Init_free(this_ptr_conv);
9602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9604 orig_conv.inner = (void*)(orig & (~1));
9605 orig_conv.is_owned = false;
9606 LDKInit ret_var = Init_clone(&orig_conv);
9607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9609 long ret_ref = (long)ret_var.inner;
9610 if (ret_var.is_owned) {
9616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9617 LDKErrorMessage this_ptr_conv;
9618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9620 ErrorMessage_free(this_ptr_conv);
9623 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9624 LDKErrorMessage orig_conv;
9625 orig_conv.inner = (void*)(orig & (~1));
9626 orig_conv.is_owned = false;
9627 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
9628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9630 long ret_ref = (long)ret_var.inner;
9631 if (ret_var.is_owned) {
9637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9638 LDKErrorMessage this_ptr_conv;
9639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9640 this_ptr_conv.is_owned = false;
9641 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9642 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
9646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9647 LDKErrorMessage this_ptr_conv;
9648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9649 this_ptr_conv.is_owned = false;
9650 LDKThirtyTwoBytes val_ref;
9651 CHECK((*env)->GetArrayLength(env, val) == 32);
9652 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9653 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
9656 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv *env, jclass clz, int64_t this_ptr) {
9657 LDKErrorMessage this_ptr_conv;
9658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9659 this_ptr_conv.is_owned = false;
9660 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
9661 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
9665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9666 LDKErrorMessage this_ptr_conv;
9667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9668 this_ptr_conv.is_owned = false;
9669 LDKCVec_u8Z val_ref;
9670 val_ref.datalen = (*env)->GetArrayLength(env, val);
9671 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9672 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
9673 ErrorMessage_set_data(&this_ptr_conv, val_ref);
9676 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray data_arg) {
9677 LDKThirtyTwoBytes channel_id_arg_ref;
9678 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
9679 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9680 LDKCVec_u8Z data_arg_ref;
9681 data_arg_ref.datalen = (*env)->GetArrayLength(env, data_arg);
9682 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9683 (*env)->GetByteArrayRegion(env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
9684 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
9685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9687 long ret_ref = (long)ret_var.inner;
9688 if (ret_var.is_owned) {
9694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9695 LDKPing this_ptr_conv;
9696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9698 Ping_free(this_ptr_conv);
9701 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9703 orig_conv.inner = (void*)(orig & (~1));
9704 orig_conv.is_owned = false;
9705 LDKPing ret_var = Ping_clone(&orig_conv);
9706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9708 long ret_ref = (long)ret_var.inner;
9709 if (ret_var.is_owned) {
9715 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9716 LDKPing this_ptr_conv;
9717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9718 this_ptr_conv.is_owned = false;
9719 int16_t ret_val = Ping_get_ponglen(&this_ptr_conv);
9723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9724 LDKPing this_ptr_conv;
9725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9726 this_ptr_conv.is_owned = false;
9727 Ping_set_ponglen(&this_ptr_conv, val);
9730 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9731 LDKPing this_ptr_conv;
9732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9733 this_ptr_conv.is_owned = false;
9734 int16_t ret_val = Ping_get_byteslen(&this_ptr_conv);
9738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9739 LDKPing this_ptr_conv;
9740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9741 this_ptr_conv.is_owned = false;
9742 Ping_set_byteslen(&this_ptr_conv, val);
9745 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv *env, jclass clz, int16_t ponglen_arg, int16_t byteslen_arg) {
9746 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
9747 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9748 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9749 long ret_ref = (long)ret_var.inner;
9750 if (ret_var.is_owned) {
9756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9757 LDKPong this_ptr_conv;
9758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9760 Pong_free(this_ptr_conv);
9763 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9765 orig_conv.inner = (void*)(orig & (~1));
9766 orig_conv.is_owned = false;
9767 LDKPong ret_var = Pong_clone(&orig_conv);
9768 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9769 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9770 long ret_ref = (long)ret_var.inner;
9771 if (ret_var.is_owned) {
9777 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr) {
9778 LDKPong this_ptr_conv;
9779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9780 this_ptr_conv.is_owned = false;
9781 int16_t ret_val = Pong_get_byteslen(&this_ptr_conv);
9785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9786 LDKPong this_ptr_conv;
9787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9788 this_ptr_conv.is_owned = false;
9789 Pong_set_byteslen(&this_ptr_conv, val);
9792 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv *env, jclass clz, int16_t byteslen_arg) {
9793 LDKPong ret_var = Pong_new(byteslen_arg);
9794 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9795 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9796 long ret_ref = (long)ret_var.inner;
9797 if (ret_var.is_owned) {
9803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
9804 LDKOpenChannel this_ptr_conv;
9805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9807 OpenChannel_free(this_ptr_conv);
9810 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
9811 LDKOpenChannel orig_conv;
9812 orig_conv.inner = (void*)(orig & (~1));
9813 orig_conv.is_owned = false;
9814 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
9815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9817 long ret_ref = (long)ret_var.inner;
9818 if (ret_var.is_owned) {
9824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
9825 LDKOpenChannel this_ptr_conv;
9826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9827 this_ptr_conv.is_owned = false;
9828 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9829 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
9833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9834 LDKOpenChannel this_ptr_conv;
9835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9836 this_ptr_conv.is_owned = false;
9837 LDKThirtyTwoBytes val_ref;
9838 CHECK((*env)->GetArrayLength(env, val) == 32);
9839 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9840 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
9843 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
9844 LDKOpenChannel this_ptr_conv;
9845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9846 this_ptr_conv.is_owned = false;
9847 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
9848 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
9852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
9853 LDKOpenChannel this_ptr_conv;
9854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9855 this_ptr_conv.is_owned = false;
9856 LDKThirtyTwoBytes val_ref;
9857 CHECK((*env)->GetArrayLength(env, val) == 32);
9858 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
9859 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
9862 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9863 LDKOpenChannel this_ptr_conv;
9864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9865 this_ptr_conv.is_owned = false;
9866 int64_t ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
9870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9871 LDKOpenChannel this_ptr_conv;
9872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9873 this_ptr_conv.is_owned = false;
9874 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
9877 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9878 LDKOpenChannel this_ptr_conv;
9879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9880 this_ptr_conv.is_owned = false;
9881 int64_t ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
9885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9886 LDKOpenChannel this_ptr_conv;
9887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9888 this_ptr_conv.is_owned = false;
9889 OpenChannel_set_push_msat(&this_ptr_conv, val);
9892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9893 LDKOpenChannel this_ptr_conv;
9894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9895 this_ptr_conv.is_owned = false;
9896 int64_t ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
9900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9901 LDKOpenChannel this_ptr_conv;
9902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9903 this_ptr_conv.is_owned = false;
9904 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
9907 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) {
9908 LDKOpenChannel this_ptr_conv;
9909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9910 this_ptr_conv.is_owned = false;
9911 int64_t ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
9915 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) {
9916 LDKOpenChannel this_ptr_conv;
9917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9918 this_ptr_conv.is_owned = false;
9919 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9922 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
9923 LDKOpenChannel this_ptr_conv;
9924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9925 this_ptr_conv.is_owned = false;
9926 int64_t ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
9930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9931 LDKOpenChannel this_ptr_conv;
9932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9933 this_ptr_conv.is_owned = false;
9934 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
9937 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
9938 LDKOpenChannel this_ptr_conv;
9939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9940 this_ptr_conv.is_owned = false;
9941 int64_t ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
9945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
9946 LDKOpenChannel this_ptr_conv;
9947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9948 this_ptr_conv.is_owned = false;
9949 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
9952 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
9953 LDKOpenChannel this_ptr_conv;
9954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9955 this_ptr_conv.is_owned = false;
9956 int32_t ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
9960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
9961 LDKOpenChannel this_ptr_conv;
9962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9963 this_ptr_conv.is_owned = false;
9964 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
9967 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
9968 LDKOpenChannel this_ptr_conv;
9969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9970 this_ptr_conv.is_owned = false;
9971 int16_t ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
9975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9976 LDKOpenChannel this_ptr_conv;
9977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9978 this_ptr_conv.is_owned = false;
9979 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
9982 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
9983 LDKOpenChannel this_ptr_conv;
9984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9985 this_ptr_conv.is_owned = false;
9986 int16_t ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
9990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
9991 LDKOpenChannel this_ptr_conv;
9992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9993 this_ptr_conv.is_owned = false;
9994 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
9997 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
9998 LDKOpenChannel this_ptr_conv;
9999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10000 this_ptr_conv.is_owned = false;
10001 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10002 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
10006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10007 LDKOpenChannel this_ptr_conv;
10008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10009 this_ptr_conv.is_owned = false;
10010 LDKPublicKey val_ref;
10011 CHECK((*env)->GetArrayLength(env, val) == 33);
10012 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10013 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10016 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10017 LDKOpenChannel this_ptr_conv;
10018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10019 this_ptr_conv.is_owned = false;
10020 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10021 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10026 LDKOpenChannel this_ptr_conv;
10027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10028 this_ptr_conv.is_owned = false;
10029 LDKPublicKey val_ref;
10030 CHECK((*env)->GetArrayLength(env, val) == 33);
10031 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10032 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10035 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10036 LDKOpenChannel this_ptr_conv;
10037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10038 this_ptr_conv.is_owned = false;
10039 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10040 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
10044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10045 LDKOpenChannel this_ptr_conv;
10046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10047 this_ptr_conv.is_owned = false;
10048 LDKPublicKey val_ref;
10049 CHECK((*env)->GetArrayLength(env, val) == 33);
10050 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10051 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
10054 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10055 LDKOpenChannel this_ptr_conv;
10056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10057 this_ptr_conv.is_owned = false;
10058 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10059 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10064 LDKOpenChannel this_ptr_conv;
10065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10066 this_ptr_conv.is_owned = false;
10067 LDKPublicKey val_ref;
10068 CHECK((*env)->GetArrayLength(env, val) == 33);
10069 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10070 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10073 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10074 LDKOpenChannel this_ptr_conv;
10075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10076 this_ptr_conv.is_owned = false;
10077 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10078 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10083 LDKOpenChannel this_ptr_conv;
10084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10085 this_ptr_conv.is_owned = false;
10086 LDKPublicKey val_ref;
10087 CHECK((*env)->GetArrayLength(env, val) == 33);
10088 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10089 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10092 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10093 LDKOpenChannel this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = false;
10096 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10097 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10101 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) {
10102 LDKOpenChannel this_ptr_conv;
10103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10104 this_ptr_conv.is_owned = false;
10105 LDKPublicKey val_ref;
10106 CHECK((*env)->GetArrayLength(env, val) == 33);
10107 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10108 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10111 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
10112 LDKOpenChannel this_ptr_conv;
10113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10114 this_ptr_conv.is_owned = false;
10115 int8_t ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
10119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
10120 LDKOpenChannel this_ptr_conv;
10121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10122 this_ptr_conv.is_owned = false;
10123 OpenChannel_set_channel_flags(&this_ptr_conv, val);
10126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10127 LDKAcceptChannel this_ptr_conv;
10128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10129 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10130 AcceptChannel_free(this_ptr_conv);
10133 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10134 LDKAcceptChannel orig_conv;
10135 orig_conv.inner = (void*)(orig & (~1));
10136 orig_conv.is_owned = false;
10137 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
10138 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10139 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10140 long ret_ref = (long)ret_var.inner;
10141 if (ret_var.is_owned) {
10147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10148 LDKAcceptChannel this_ptr_conv;
10149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10150 this_ptr_conv.is_owned = false;
10151 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10152 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
10156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10157 LDKAcceptChannel this_ptr_conv;
10158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10159 this_ptr_conv.is_owned = false;
10160 LDKThirtyTwoBytes val_ref;
10161 CHECK((*env)->GetArrayLength(env, val) == 32);
10162 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10163 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
10166 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10167 LDKAcceptChannel this_ptr_conv;
10168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10169 this_ptr_conv.is_owned = false;
10170 int64_t ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
10174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10175 LDKAcceptChannel this_ptr_conv;
10176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10177 this_ptr_conv.is_owned = false;
10178 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
10181 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) {
10182 LDKAcceptChannel this_ptr_conv;
10183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10184 this_ptr_conv.is_owned = false;
10185 int64_t ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
10189 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) {
10190 LDKAcceptChannel this_ptr_conv;
10191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10192 this_ptr_conv.is_owned = false;
10193 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10196 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10197 LDKAcceptChannel this_ptr_conv;
10198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10199 this_ptr_conv.is_owned = false;
10200 int64_t ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
10204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10205 LDKAcceptChannel this_ptr_conv;
10206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10207 this_ptr_conv.is_owned = false;
10208 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
10211 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10212 LDKAcceptChannel this_ptr_conv;
10213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10214 this_ptr_conv.is_owned = false;
10215 int64_t ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
10219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10220 LDKAcceptChannel this_ptr_conv;
10221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10222 this_ptr_conv.is_owned = false;
10223 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
10226 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr) {
10227 LDKAcceptChannel this_ptr_conv;
10228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10229 this_ptr_conv.is_owned = false;
10230 int32_t ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
10234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10235 LDKAcceptChannel this_ptr_conv;
10236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10237 this_ptr_conv.is_owned = false;
10238 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
10241 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
10242 LDKAcceptChannel this_ptr_conv;
10243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10244 this_ptr_conv.is_owned = false;
10245 int16_t ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
10249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10250 LDKAcceptChannel this_ptr_conv;
10251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10252 this_ptr_conv.is_owned = false;
10253 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
10256 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
10257 LDKAcceptChannel this_ptr_conv;
10258 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10259 this_ptr_conv.is_owned = false;
10260 int16_t ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
10264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10265 LDKAcceptChannel this_ptr_conv;
10266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10267 this_ptr_conv.is_owned = false;
10268 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
10271 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10272 LDKAcceptChannel this_ptr_conv;
10273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10274 this_ptr_conv.is_owned = false;
10275 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10276 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
10280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10281 LDKAcceptChannel this_ptr_conv;
10282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10283 this_ptr_conv.is_owned = false;
10284 LDKPublicKey val_ref;
10285 CHECK((*env)->GetArrayLength(env, val) == 33);
10286 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10287 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10290 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10291 LDKAcceptChannel this_ptr_conv;
10292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10293 this_ptr_conv.is_owned = false;
10294 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10295 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10300 LDKAcceptChannel this_ptr_conv;
10301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10302 this_ptr_conv.is_owned = false;
10303 LDKPublicKey val_ref;
10304 CHECK((*env)->GetArrayLength(env, val) == 33);
10305 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10306 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10309 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10310 LDKAcceptChannel this_ptr_conv;
10311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10312 this_ptr_conv.is_owned = false;
10313 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10314 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
10318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10319 LDKAcceptChannel this_ptr_conv;
10320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10321 this_ptr_conv.is_owned = false;
10322 LDKPublicKey val_ref;
10323 CHECK((*env)->GetArrayLength(env, val) == 33);
10324 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10325 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
10328 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10329 LDKAcceptChannel this_ptr_conv;
10330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10331 this_ptr_conv.is_owned = false;
10332 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10333 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10337 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10338 LDKAcceptChannel this_ptr_conv;
10339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10340 this_ptr_conv.is_owned = false;
10341 LDKPublicKey val_ref;
10342 CHECK((*env)->GetArrayLength(env, val) == 33);
10343 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10344 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10347 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
10348 LDKAcceptChannel this_ptr_conv;
10349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10350 this_ptr_conv.is_owned = false;
10351 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10352 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10357 LDKAcceptChannel this_ptr_conv;
10358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10359 this_ptr_conv.is_owned = false;
10360 LDKPublicKey val_ref;
10361 CHECK((*env)->GetArrayLength(env, val) == 33);
10362 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10363 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10366 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10367 LDKAcceptChannel this_ptr_conv;
10368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10369 this_ptr_conv.is_owned = false;
10370 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10371 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10375 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) {
10376 LDKAcceptChannel this_ptr_conv;
10377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10378 this_ptr_conv.is_owned = false;
10379 LDKPublicKey val_ref;
10380 CHECK((*env)->GetArrayLength(env, val) == 33);
10381 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10382 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10386 LDKFundingCreated this_ptr_conv;
10387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10389 FundingCreated_free(this_ptr_conv);
10392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10393 LDKFundingCreated orig_conv;
10394 orig_conv.inner = (void*)(orig & (~1));
10395 orig_conv.is_owned = false;
10396 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
10397 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10398 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10399 long ret_ref = (long)ret_var.inner;
10400 if (ret_var.is_owned) {
10406 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10407 LDKFundingCreated this_ptr_conv;
10408 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10409 this_ptr_conv.is_owned = false;
10410 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10411 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
10415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10416 LDKFundingCreated this_ptr_conv;
10417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10418 this_ptr_conv.is_owned = false;
10419 LDKThirtyTwoBytes val_ref;
10420 CHECK((*env)->GetArrayLength(env, val) == 32);
10421 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10422 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
10425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
10426 LDKFundingCreated this_ptr_conv;
10427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10428 this_ptr_conv.is_owned = false;
10429 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10430 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
10434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10435 LDKFundingCreated this_ptr_conv;
10436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10437 this_ptr_conv.is_owned = false;
10438 LDKThirtyTwoBytes val_ref;
10439 CHECK((*env)->GetArrayLength(env, val) == 32);
10440 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10441 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
10444 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr) {
10445 LDKFundingCreated this_ptr_conv;
10446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10447 this_ptr_conv.is_owned = false;
10448 int16_t ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
10452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
10453 LDKFundingCreated this_ptr_conv;
10454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10455 this_ptr_conv.is_owned = false;
10456 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
10459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10460 LDKFundingCreated this_ptr_conv;
10461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10462 this_ptr_conv.is_owned = false;
10463 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10464 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
10468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10469 LDKFundingCreated this_ptr_conv;
10470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10471 this_ptr_conv.is_owned = false;
10472 LDKSignature val_ref;
10473 CHECK((*env)->GetArrayLength(env, val) == 64);
10474 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10475 FundingCreated_set_signature(&this_ptr_conv, val_ref);
10478 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) {
10479 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
10480 CHECK((*env)->GetArrayLength(env, temporary_channel_id_arg) == 32);
10481 (*env)->GetByteArrayRegion(env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
10482 LDKThirtyTwoBytes funding_txid_arg_ref;
10483 CHECK((*env)->GetArrayLength(env, funding_txid_arg) == 32);
10484 (*env)->GetByteArrayRegion(env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
10485 LDKSignature signature_arg_ref;
10486 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10487 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10488 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
10489 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10490 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10491 long ret_ref = (long)ret_var.inner;
10492 if (ret_var.is_owned) {
10498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10499 LDKFundingSigned this_ptr_conv;
10500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10502 FundingSigned_free(this_ptr_conv);
10505 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10506 LDKFundingSigned orig_conv;
10507 orig_conv.inner = (void*)(orig & (~1));
10508 orig_conv.is_owned = false;
10509 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
10510 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10511 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10512 long ret_ref = (long)ret_var.inner;
10513 if (ret_var.is_owned) {
10519 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10520 LDKFundingSigned this_ptr_conv;
10521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10522 this_ptr_conv.is_owned = false;
10523 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10524 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
10528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10529 LDKFundingSigned this_ptr_conv;
10530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10531 this_ptr_conv.is_owned = false;
10532 LDKThirtyTwoBytes val_ref;
10533 CHECK((*env)->GetArrayLength(env, val) == 32);
10534 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10535 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
10538 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10539 LDKFundingSigned this_ptr_conv;
10540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10541 this_ptr_conv.is_owned = false;
10542 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10543 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
10547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10548 LDKFundingSigned this_ptr_conv;
10549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10550 this_ptr_conv.is_owned = false;
10551 LDKSignature val_ref;
10552 CHECK((*env)->GetArrayLength(env, val) == 64);
10553 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10554 FundingSigned_set_signature(&this_ptr_conv, val_ref);
10557 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray signature_arg) {
10558 LDKThirtyTwoBytes channel_id_arg_ref;
10559 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10560 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10561 LDKSignature signature_arg_ref;
10562 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10563 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10564 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
10565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10567 long ret_ref = (long)ret_var.inner;
10568 if (ret_var.is_owned) {
10574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10575 LDKFundingLocked this_ptr_conv;
10576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10577 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10578 FundingLocked_free(this_ptr_conv);
10581 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10582 LDKFundingLocked orig_conv;
10583 orig_conv.inner = (void*)(orig & (~1));
10584 orig_conv.is_owned = false;
10585 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
10586 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10587 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10588 long ret_ref = (long)ret_var.inner;
10589 if (ret_var.is_owned) {
10595 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10596 LDKFundingLocked this_ptr_conv;
10597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10598 this_ptr_conv.is_owned = false;
10599 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10600 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
10604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10605 LDKFundingLocked this_ptr_conv;
10606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10607 this_ptr_conv.is_owned = false;
10608 LDKThirtyTwoBytes val_ref;
10609 CHECK((*env)->GetArrayLength(env, val) == 32);
10610 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10611 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
10614 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
10615 LDKFundingLocked this_ptr_conv;
10616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10617 this_ptr_conv.is_owned = false;
10618 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
10619 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
10623 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) {
10624 LDKFundingLocked this_ptr_conv;
10625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10626 this_ptr_conv.is_owned = false;
10627 LDKPublicKey val_ref;
10628 CHECK((*env)->GetArrayLength(env, val) == 33);
10629 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
10630 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
10633 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) {
10634 LDKThirtyTwoBytes channel_id_arg_ref;
10635 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10636 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10637 LDKPublicKey next_per_commitment_point_arg_ref;
10638 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
10639 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
10640 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
10641 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10642 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10643 long ret_ref = (long)ret_var.inner;
10644 if (ret_var.is_owned) {
10650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10651 LDKShutdown this_ptr_conv;
10652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10654 Shutdown_free(this_ptr_conv);
10657 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10658 LDKShutdown orig_conv;
10659 orig_conv.inner = (void*)(orig & (~1));
10660 orig_conv.is_owned = false;
10661 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
10662 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10663 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10664 long ret_ref = (long)ret_var.inner;
10665 if (ret_var.is_owned) {
10671 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10672 LDKShutdown this_ptr_conv;
10673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10674 this_ptr_conv.is_owned = false;
10675 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10676 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
10680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10681 LDKShutdown this_ptr_conv;
10682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10683 this_ptr_conv.is_owned = false;
10684 LDKThirtyTwoBytes val_ref;
10685 CHECK((*env)->GetArrayLength(env, val) == 32);
10686 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10687 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
10690 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
10691 LDKShutdown this_ptr_conv;
10692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10693 this_ptr_conv.is_owned = false;
10694 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
10695 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
10696 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
10700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10701 LDKShutdown this_ptr_conv;
10702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10703 this_ptr_conv.is_owned = false;
10704 LDKCVec_u8Z val_ref;
10705 val_ref.datalen = (*env)->GetArrayLength(env, val);
10706 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10707 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
10708 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
10711 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int8_tArray scriptpubkey_arg) {
10712 LDKThirtyTwoBytes channel_id_arg_ref;
10713 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10714 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10715 LDKCVec_u8Z scriptpubkey_arg_ref;
10716 scriptpubkey_arg_ref.datalen = (*env)->GetArrayLength(env, scriptpubkey_arg);
10717 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10718 (*env)->GetByteArrayRegion(env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
10719 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
10720 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10721 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10722 long ret_ref = (long)ret_var.inner;
10723 if (ret_var.is_owned) {
10729 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10730 LDKClosingSigned this_ptr_conv;
10731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10732 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10733 ClosingSigned_free(this_ptr_conv);
10736 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10737 LDKClosingSigned orig_conv;
10738 orig_conv.inner = (void*)(orig & (~1));
10739 orig_conv.is_owned = false;
10740 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
10741 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10742 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10743 long ret_ref = (long)ret_var.inner;
10744 if (ret_var.is_owned) {
10750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10751 LDKClosingSigned this_ptr_conv;
10752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10753 this_ptr_conv.is_owned = false;
10754 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10755 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
10759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10760 LDKClosingSigned this_ptr_conv;
10761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10762 this_ptr_conv.is_owned = false;
10763 LDKThirtyTwoBytes val_ref;
10764 CHECK((*env)->GetArrayLength(env, val) == 32);
10765 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10766 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
10769 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr) {
10770 LDKClosingSigned this_ptr_conv;
10771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10772 this_ptr_conv.is_owned = false;
10773 int64_t ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
10777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10778 LDKClosingSigned this_ptr_conv;
10779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10780 this_ptr_conv.is_owned = false;
10781 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
10784 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
10785 LDKClosingSigned this_ptr_conv;
10786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10787 this_ptr_conv.is_owned = false;
10788 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
10789 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
10793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10794 LDKClosingSigned this_ptr_conv;
10795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10796 this_ptr_conv.is_owned = false;
10797 LDKSignature val_ref;
10798 CHECK((*env)->GetArrayLength(env, val) == 64);
10799 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
10800 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
10803 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) {
10804 LDKThirtyTwoBytes channel_id_arg_ref;
10805 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
10806 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10807 LDKSignature signature_arg_ref;
10808 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
10809 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10810 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
10811 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10812 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10813 long ret_ref = (long)ret_var.inner;
10814 if (ret_var.is_owned) {
10820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10821 LDKUpdateAddHTLC this_ptr_conv;
10822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10824 UpdateAddHTLC_free(this_ptr_conv);
10827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10828 LDKUpdateAddHTLC orig_conv;
10829 orig_conv.inner = (void*)(orig & (~1));
10830 orig_conv.is_owned = false;
10831 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
10832 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10833 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10834 long ret_ref = (long)ret_var.inner;
10835 if (ret_var.is_owned) {
10841 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10842 LDKUpdateAddHTLC this_ptr_conv;
10843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10844 this_ptr_conv.is_owned = false;
10845 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10846 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
10850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10851 LDKUpdateAddHTLC this_ptr_conv;
10852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10853 this_ptr_conv.is_owned = false;
10854 LDKThirtyTwoBytes val_ref;
10855 CHECK((*env)->GetArrayLength(env, val) == 32);
10856 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10857 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
10860 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10861 LDKUpdateAddHTLC this_ptr_conv;
10862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10863 this_ptr_conv.is_owned = false;
10864 int64_t ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
10868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10869 LDKUpdateAddHTLC this_ptr_conv;
10870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10871 this_ptr_conv.is_owned = false;
10872 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
10875 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
10876 LDKUpdateAddHTLC this_ptr_conv;
10877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10878 this_ptr_conv.is_owned = false;
10879 int64_t ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
10883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10884 LDKUpdateAddHTLC this_ptr_conv;
10885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10886 this_ptr_conv.is_owned = false;
10887 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
10890 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
10891 LDKUpdateAddHTLC this_ptr_conv;
10892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10893 this_ptr_conv.is_owned = false;
10894 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10895 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
10899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10900 LDKUpdateAddHTLC this_ptr_conv;
10901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10902 this_ptr_conv.is_owned = false;
10903 LDKThirtyTwoBytes val_ref;
10904 CHECK((*env)->GetArrayLength(env, val) == 32);
10905 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10906 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
10909 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
10910 LDKUpdateAddHTLC this_ptr_conv;
10911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10912 this_ptr_conv.is_owned = false;
10913 int32_t ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
10917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
10918 LDKUpdateAddHTLC this_ptr_conv;
10919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10920 this_ptr_conv.is_owned = false;
10921 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
10924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
10925 LDKUpdateFulfillHTLC this_ptr_conv;
10926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10928 UpdateFulfillHTLC_free(this_ptr_conv);
10931 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
10932 LDKUpdateFulfillHTLC orig_conv;
10933 orig_conv.inner = (void*)(orig & (~1));
10934 orig_conv.is_owned = false;
10935 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
10936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10938 long ret_ref = (long)ret_var.inner;
10939 if (ret_var.is_owned) {
10945 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10946 LDKUpdateFulfillHTLC this_ptr_conv;
10947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10948 this_ptr_conv.is_owned = false;
10949 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10950 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
10954 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10955 LDKUpdateFulfillHTLC this_ptr_conv;
10956 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10957 this_ptr_conv.is_owned = false;
10958 LDKThirtyTwoBytes val_ref;
10959 CHECK((*env)->GetArrayLength(env, val) == 32);
10960 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10961 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
10964 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
10965 LDKUpdateFulfillHTLC this_ptr_conv;
10966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10967 this_ptr_conv.is_owned = false;
10968 int64_t ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
10972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
10973 LDKUpdateFulfillHTLC this_ptr_conv;
10974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10975 this_ptr_conv.is_owned = false;
10976 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
10979 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr) {
10980 LDKUpdateFulfillHTLC this_ptr_conv;
10981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10982 this_ptr_conv.is_owned = false;
10983 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
10984 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
10988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
10989 LDKUpdateFulfillHTLC this_ptr_conv;
10990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10991 this_ptr_conv.is_owned = false;
10992 LDKThirtyTwoBytes val_ref;
10993 CHECK((*env)->GetArrayLength(env, val) == 32);
10994 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
10995 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
10998 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) {
10999 LDKThirtyTwoBytes channel_id_arg_ref;
11000 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11001 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11002 LDKThirtyTwoBytes payment_preimage_arg_ref;
11003 CHECK((*env)->GetArrayLength(env, payment_preimage_arg) == 32);
11004 (*env)->GetByteArrayRegion(env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
11005 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
11006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11008 long ret_ref = (long)ret_var.inner;
11009 if (ret_var.is_owned) {
11015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11016 LDKUpdateFailHTLC this_ptr_conv;
11017 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11018 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11019 UpdateFailHTLC_free(this_ptr_conv);
11022 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11023 LDKUpdateFailHTLC orig_conv;
11024 orig_conv.inner = (void*)(orig & (~1));
11025 orig_conv.is_owned = false;
11026 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
11027 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11028 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11029 long ret_ref = (long)ret_var.inner;
11030 if (ret_var.is_owned) {
11036 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11037 LDKUpdateFailHTLC this_ptr_conv;
11038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11039 this_ptr_conv.is_owned = false;
11040 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11041 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
11045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11046 LDKUpdateFailHTLC this_ptr_conv;
11047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11048 this_ptr_conv.is_owned = false;
11049 LDKThirtyTwoBytes val_ref;
11050 CHECK((*env)->GetArrayLength(env, val) == 32);
11051 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11052 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
11055 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11056 LDKUpdateFailHTLC this_ptr_conv;
11057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11058 this_ptr_conv.is_owned = false;
11059 int64_t ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
11063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11064 LDKUpdateFailHTLC this_ptr_conv;
11065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11066 this_ptr_conv.is_owned = false;
11067 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
11070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11071 LDKUpdateFailMalformedHTLC this_ptr_conv;
11072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11074 UpdateFailMalformedHTLC_free(this_ptr_conv);
11077 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11078 LDKUpdateFailMalformedHTLC orig_conv;
11079 orig_conv.inner = (void*)(orig & (~1));
11080 orig_conv.is_owned = false;
11081 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
11082 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11083 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11084 long ret_ref = (long)ret_var.inner;
11085 if (ret_var.is_owned) {
11091 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11092 LDKUpdateFailMalformedHTLC this_ptr_conv;
11093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11094 this_ptr_conv.is_owned = false;
11095 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11096 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
11100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11101 LDKUpdateFailMalformedHTLC this_ptr_conv;
11102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11103 this_ptr_conv.is_owned = false;
11104 LDKThirtyTwoBytes val_ref;
11105 CHECK((*env)->GetArrayLength(env, val) == 32);
11106 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11107 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
11110 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11111 LDKUpdateFailMalformedHTLC this_ptr_conv;
11112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11113 this_ptr_conv.is_owned = false;
11114 int64_t ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
11118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11119 LDKUpdateFailMalformedHTLC this_ptr_conv;
11120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11121 this_ptr_conv.is_owned = false;
11122 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
11125 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr) {
11126 LDKUpdateFailMalformedHTLC this_ptr_conv;
11127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11128 this_ptr_conv.is_owned = false;
11129 int16_t ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
11133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
11134 LDKUpdateFailMalformedHTLC this_ptr_conv;
11135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11136 this_ptr_conv.is_owned = false;
11137 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
11140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11141 LDKCommitmentSigned this_ptr_conv;
11142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11144 CommitmentSigned_free(this_ptr_conv);
11147 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11148 LDKCommitmentSigned orig_conv;
11149 orig_conv.inner = (void*)(orig & (~1));
11150 orig_conv.is_owned = false;
11151 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
11152 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11153 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11154 long ret_ref = (long)ret_var.inner;
11155 if (ret_var.is_owned) {
11161 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11162 LDKCommitmentSigned this_ptr_conv;
11163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11164 this_ptr_conv.is_owned = false;
11165 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11166 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
11170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11171 LDKCommitmentSigned this_ptr_conv;
11172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11173 this_ptr_conv.is_owned = false;
11174 LDKThirtyTwoBytes val_ref;
11175 CHECK((*env)->GetArrayLength(env, val) == 32);
11176 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11177 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
11180 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11181 LDKCommitmentSigned this_ptr_conv;
11182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11183 this_ptr_conv.is_owned = false;
11184 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11185 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
11189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11190 LDKCommitmentSigned this_ptr_conv;
11191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11192 this_ptr_conv.is_owned = false;
11193 LDKSignature val_ref;
11194 CHECK((*env)->GetArrayLength(env, val) == 64);
11195 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11196 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
11199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
11200 LDKCommitmentSigned this_ptr_conv;
11201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11202 this_ptr_conv.is_owned = false;
11203 LDKCVec_SignatureZ val_constr;
11204 val_constr.datalen = (*env)->GetArrayLength(env, val);
11205 if (val_constr.datalen > 0)
11206 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11208 val_constr.data = NULL;
11209 for (size_t i = 0; i < val_constr.datalen; i++) {
11210 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
11211 LDKSignature arr_conv_8_ref;
11212 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11213 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11214 val_constr.data[i] = arr_conv_8_ref;
11216 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
11219 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) {
11220 LDKThirtyTwoBytes channel_id_arg_ref;
11221 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11222 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11223 LDKSignature signature_arg_ref;
11224 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11225 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11226 LDKCVec_SignatureZ htlc_signatures_arg_constr;
11227 htlc_signatures_arg_constr.datalen = (*env)->GetArrayLength(env, htlc_signatures_arg);
11228 if (htlc_signatures_arg_constr.datalen > 0)
11229 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11231 htlc_signatures_arg_constr.data = NULL;
11232 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
11233 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, htlc_signatures_arg, i);
11234 LDKSignature arr_conv_8_ref;
11235 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
11236 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11237 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
11239 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
11240 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11241 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11242 long ret_ref = (long)ret_var.inner;
11243 if (ret_var.is_owned) {
11249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11250 LDKRevokeAndACK this_ptr_conv;
11251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11253 RevokeAndACK_free(this_ptr_conv);
11256 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11257 LDKRevokeAndACK orig_conv;
11258 orig_conv.inner = (void*)(orig & (~1));
11259 orig_conv.is_owned = false;
11260 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
11261 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11262 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11263 long ret_ref = (long)ret_var.inner;
11264 if (ret_var.is_owned) {
11270 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11271 LDKRevokeAndACK this_ptr_conv;
11272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11273 this_ptr_conv.is_owned = false;
11274 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11275 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
11279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11280 LDKRevokeAndACK this_ptr_conv;
11281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11282 this_ptr_conv.is_owned = false;
11283 LDKThirtyTwoBytes val_ref;
11284 CHECK((*env)->GetArrayLength(env, val) == 32);
11285 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11286 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
11289 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11290 LDKRevokeAndACK this_ptr_conv;
11291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11292 this_ptr_conv.is_owned = false;
11293 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11294 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
11298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11299 LDKRevokeAndACK this_ptr_conv;
11300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11301 this_ptr_conv.is_owned = false;
11302 LDKThirtyTwoBytes val_ref;
11303 CHECK((*env)->GetArrayLength(env, val) == 32);
11304 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11305 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
11308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11309 LDKRevokeAndACK this_ptr_conv;
11310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11311 this_ptr_conv.is_owned = false;
11312 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11313 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
11317 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) {
11318 LDKRevokeAndACK this_ptr_conv;
11319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11320 this_ptr_conv.is_owned = false;
11321 LDKPublicKey val_ref;
11322 CHECK((*env)->GetArrayLength(env, val) == 33);
11323 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11324 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
11327 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) {
11328 LDKThirtyTwoBytes channel_id_arg_ref;
11329 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11330 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11331 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
11332 CHECK((*env)->GetArrayLength(env, per_commitment_secret_arg) == 32);
11333 (*env)->GetByteArrayRegion(env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
11334 LDKPublicKey next_per_commitment_point_arg_ref;
11335 CHECK((*env)->GetArrayLength(env, next_per_commitment_point_arg) == 33);
11336 (*env)->GetByteArrayRegion(env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
11337 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
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_UpdateFee_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11348 LDKUpdateFee 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 UpdateFee_free(this_ptr_conv);
11354 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11355 LDKUpdateFee orig_conv;
11356 orig_conv.inner = (void*)(orig & (~1));
11357 orig_conv.is_owned = false;
11358 LDKUpdateFee ret_var = UpdateFee_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_UpdateFee_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11369 LDKUpdateFee 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, *UpdateFee_get_channel_id(&this_ptr_conv));
11377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11378 LDKUpdateFee 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 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
11387 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr) {
11388 LDKUpdateFee this_ptr_conv;
11389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11390 this_ptr_conv.is_owned = false;
11391 int32_t ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
11395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11396 LDKUpdateFee this_ptr_conv;
11397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11398 this_ptr_conv.is_owned = false;
11399 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
11402 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) {
11403 LDKThirtyTwoBytes channel_id_arg_ref;
11404 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11405 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11406 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
11407 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11408 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11409 long ret_ref = (long)ret_var.inner;
11410 if (ret_var.is_owned) {
11416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11417 LDKDataLossProtect this_ptr_conv;
11418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11420 DataLossProtect_free(this_ptr_conv);
11423 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11424 LDKDataLossProtect orig_conv;
11425 orig_conv.inner = (void*)(orig & (~1));
11426 orig_conv.is_owned = false;
11427 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
11428 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11429 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11430 long ret_ref = (long)ret_var.inner;
11431 if (ret_var.is_owned) {
11437 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv *env, jclass clz, int64_t this_ptr) {
11438 LDKDataLossProtect this_ptr_conv;
11439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11440 this_ptr_conv.is_owned = false;
11441 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11442 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
11446 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) {
11447 LDKDataLossProtect this_ptr_conv;
11448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11449 this_ptr_conv.is_owned = false;
11450 LDKThirtyTwoBytes val_ref;
11451 CHECK((*env)->GetArrayLength(env, val) == 32);
11452 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11453 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
11456 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
11457 LDKDataLossProtect this_ptr_conv;
11458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11459 this_ptr_conv.is_owned = false;
11460 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11461 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
11465 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) {
11466 LDKDataLossProtect this_ptr_conv;
11467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11468 this_ptr_conv.is_owned = false;
11469 LDKPublicKey val_ref;
11470 CHECK((*env)->GetArrayLength(env, val) == 33);
11471 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11472 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
11475 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) {
11476 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
11477 CHECK((*env)->GetArrayLength(env, your_last_per_commitment_secret_arg) == 32);
11478 (*env)->GetByteArrayRegion(env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
11479 LDKPublicKey my_current_per_commitment_point_arg_ref;
11480 CHECK((*env)->GetArrayLength(env, my_current_per_commitment_point_arg) == 33);
11481 (*env)->GetByteArrayRegion(env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
11482 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
11483 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11484 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11485 long ret_ref = (long)ret_var.inner;
11486 if (ret_var.is_owned) {
11492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11493 LDKChannelReestablish this_ptr_conv;
11494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11496 ChannelReestablish_free(this_ptr_conv);
11499 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11500 LDKChannelReestablish orig_conv;
11501 orig_conv.inner = (void*)(orig & (~1));
11502 orig_conv.is_owned = false;
11503 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
11504 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11505 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11506 long ret_ref = (long)ret_var.inner;
11507 if (ret_var.is_owned) {
11513 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11514 LDKChannelReestablish this_ptr_conv;
11515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11516 this_ptr_conv.is_owned = false;
11517 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11518 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
11522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11523 LDKChannelReestablish this_ptr_conv;
11524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11525 this_ptr_conv.is_owned = false;
11526 LDKThirtyTwoBytes val_ref;
11527 CHECK((*env)->GetArrayLength(env, val) == 32);
11528 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11529 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
11532 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11533 LDKChannelReestablish this_ptr_conv;
11534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11535 this_ptr_conv.is_owned = false;
11536 int64_t ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
11540 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) {
11541 LDKChannelReestablish this_ptr_conv;
11542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11543 this_ptr_conv.is_owned = false;
11544 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
11547 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_ptr) {
11548 LDKChannelReestablish this_ptr_conv;
11549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11550 this_ptr_conv.is_owned = false;
11551 int64_t ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
11555 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) {
11556 LDKChannelReestablish this_ptr_conv;
11557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11558 this_ptr_conv.is_owned = false;
11559 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
11562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11563 LDKAnnouncementSignatures this_ptr_conv;
11564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11566 AnnouncementSignatures_free(this_ptr_conv);
11569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11570 LDKAnnouncementSignatures orig_conv;
11571 orig_conv.inner = (void*)(orig & (~1));
11572 orig_conv.is_owned = false;
11573 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
11574 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11575 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11576 long ret_ref = (long)ret_var.inner;
11577 if (ret_var.is_owned) {
11583 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11584 LDKAnnouncementSignatures this_ptr_conv;
11585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11586 this_ptr_conv.is_owned = false;
11587 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11588 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
11592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11593 LDKAnnouncementSignatures this_ptr_conv;
11594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11595 this_ptr_conv.is_owned = false;
11596 LDKThirtyTwoBytes val_ref;
11597 CHECK((*env)->GetArrayLength(env, val) == 32);
11598 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11599 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
11602 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11603 LDKAnnouncementSignatures this_ptr_conv;
11604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11605 this_ptr_conv.is_owned = false;
11606 int64_t ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
11610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11611 LDKAnnouncementSignatures this_ptr_conv;
11612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11613 this_ptr_conv.is_owned = false;
11614 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
11617 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11618 LDKAnnouncementSignatures this_ptr_conv;
11619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11620 this_ptr_conv.is_owned = false;
11621 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11622 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
11626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11627 LDKAnnouncementSignatures this_ptr_conv;
11628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11629 this_ptr_conv.is_owned = false;
11630 LDKSignature val_ref;
11631 CHECK((*env)->GetArrayLength(env, val) == 64);
11632 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11633 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
11636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11637 LDKAnnouncementSignatures this_ptr_conv;
11638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11639 this_ptr_conv.is_owned = false;
11640 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11641 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
11645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11646 LDKAnnouncementSignatures this_ptr_conv;
11647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11648 this_ptr_conv.is_owned = false;
11649 LDKSignature val_ref;
11650 CHECK((*env)->GetArrayLength(env, val) == 64);
11651 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11652 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
11655 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) {
11656 LDKThirtyTwoBytes channel_id_arg_ref;
11657 CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32);
11658 (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11659 LDKSignature node_signature_arg_ref;
11660 CHECK((*env)->GetArrayLength(env, node_signature_arg) == 64);
11661 (*env)->GetByteArrayRegion(env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
11662 LDKSignature bitcoin_signature_arg_ref;
11663 CHECK((*env)->GetArrayLength(env, bitcoin_signature_arg) == 64);
11664 (*env)->GetByteArrayRegion(env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
11665 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
11666 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11667 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11668 long ret_ref = (long)ret_var.inner;
11669 if (ret_var.is_owned) {
11675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11676 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
11677 FREE((void*)this_ptr);
11678 NetAddress_free(this_ptr_conv);
11681 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11682 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
11683 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
11684 *ret_copy = NetAddress_clone(orig_conv);
11685 long ret_ref = (long)ret_copy;
11689 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv *env, jclass clz, int64_t obj) {
11690 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
11691 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
11692 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
11693 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
11694 CVec_u8Z_free(arg_var);
11698 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
11699 LDKu8slice ser_ref;
11700 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
11701 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
11702 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11703 *ret_conv = Result_read(ser_ref);
11704 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
11705 return (long)ret_conv;
11708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11709 LDKUnsignedNodeAnnouncement this_ptr_conv;
11710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11712 UnsignedNodeAnnouncement_free(this_ptr_conv);
11715 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11716 LDKUnsignedNodeAnnouncement orig_conv;
11717 orig_conv.inner = (void*)(orig & (~1));
11718 orig_conv.is_owned = false;
11719 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
11720 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11721 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11722 long ret_ref = (long)ret_var.inner;
11723 if (ret_var.is_owned) {
11729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11730 LDKUnsignedNodeAnnouncement this_ptr_conv;
11731 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11732 this_ptr_conv.is_owned = false;
11733 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
11734 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11735 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11736 long ret_ref = (long)ret_var.inner;
11737 if (ret_var.is_owned) {
11743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11744 LDKUnsignedNodeAnnouncement this_ptr_conv;
11745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11746 this_ptr_conv.is_owned = false;
11747 LDKNodeFeatures val_conv;
11748 val_conv.inner = (void*)(val & (~1));
11749 val_conv.is_owned = (val & 1) || (val == 0);
11750 // Warning: we may need a move here but can't clone!
11751 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
11754 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
11755 LDKUnsignedNodeAnnouncement this_ptr_conv;
11756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11757 this_ptr_conv.is_owned = false;
11758 int32_t ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
11762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
11763 LDKUnsignedNodeAnnouncement this_ptr_conv;
11764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11765 this_ptr_conv.is_owned = false;
11766 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
11769 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11770 LDKUnsignedNodeAnnouncement this_ptr_conv;
11771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11772 this_ptr_conv.is_owned = false;
11773 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
11774 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
11778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11779 LDKUnsignedNodeAnnouncement this_ptr_conv;
11780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11781 this_ptr_conv.is_owned = false;
11782 LDKPublicKey val_ref;
11783 CHECK((*env)->GetArrayLength(env, val) == 33);
11784 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
11785 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
11788 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
11789 LDKUnsignedNodeAnnouncement this_ptr_conv;
11790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11791 this_ptr_conv.is_owned = false;
11792 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
11793 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
11797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11798 LDKUnsignedNodeAnnouncement this_ptr_conv;
11799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11800 this_ptr_conv.is_owned = false;
11801 LDKThreeBytes val_ref;
11802 CHECK((*env)->GetArrayLength(env, val) == 3);
11803 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
11804 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
11807 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
11808 LDKUnsignedNodeAnnouncement this_ptr_conv;
11809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11810 this_ptr_conv.is_owned = false;
11811 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11812 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
11816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11817 LDKUnsignedNodeAnnouncement this_ptr_conv;
11818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11819 this_ptr_conv.is_owned = false;
11820 LDKThirtyTwoBytes val_ref;
11821 CHECK((*env)->GetArrayLength(env, val) == 32);
11822 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11823 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
11826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
11827 LDKUnsignedNodeAnnouncement this_ptr_conv;
11828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11829 this_ptr_conv.is_owned = false;
11830 LDKCVec_NetAddressZ val_constr;
11831 val_constr.datalen = (*env)->GetArrayLength(env, val);
11832 if (val_constr.datalen > 0)
11833 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11835 val_constr.data = NULL;
11836 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
11837 for (size_t m = 0; m < val_constr.datalen; m++) {
11838 int64_t arr_conv_12 = val_vals[m];
11839 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
11840 FREE((void*)arr_conv_12);
11841 val_constr.data[m] = arr_conv_12_conv;
11843 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
11844 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
11847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11848 LDKNodeAnnouncement this_ptr_conv;
11849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11850 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11851 NodeAnnouncement_free(this_ptr_conv);
11854 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11855 LDKNodeAnnouncement orig_conv;
11856 orig_conv.inner = (void*)(orig & (~1));
11857 orig_conv.is_owned = false;
11858 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
11859 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11860 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11861 long ret_ref = (long)ret_var.inner;
11862 if (ret_var.is_owned) {
11868 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
11869 LDKNodeAnnouncement this_ptr_conv;
11870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11871 this_ptr_conv.is_owned = false;
11872 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
11873 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
11877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11878 LDKNodeAnnouncement this_ptr_conv;
11879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11880 this_ptr_conv.is_owned = false;
11881 LDKSignature val_ref;
11882 CHECK((*env)->GetArrayLength(env, val) == 64);
11883 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
11884 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
11887 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
11888 LDKNodeAnnouncement this_ptr_conv;
11889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11890 this_ptr_conv.is_owned = false;
11891 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
11892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11894 long ret_ref = (long)ret_var.inner;
11895 if (ret_var.is_owned) {
11901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11902 LDKNodeAnnouncement this_ptr_conv;
11903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11904 this_ptr_conv.is_owned = false;
11905 LDKUnsignedNodeAnnouncement val_conv;
11906 val_conv.inner = (void*)(val & (~1));
11907 val_conv.is_owned = (val & 1) || (val == 0);
11908 if (val_conv.inner != NULL)
11909 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
11910 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
11913 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
11914 LDKSignature signature_arg_ref;
11915 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
11916 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11917 LDKUnsignedNodeAnnouncement contents_arg_conv;
11918 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11919 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11920 if (contents_arg_conv.inner != NULL)
11921 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
11922 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
11923 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11924 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11925 long ret_ref = (long)ret_var.inner;
11926 if (ret_var.is_owned) {
11932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
11933 LDKUnsignedChannelAnnouncement this_ptr_conv;
11934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11936 UnsignedChannelAnnouncement_free(this_ptr_conv);
11939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
11940 LDKUnsignedChannelAnnouncement orig_conv;
11941 orig_conv.inner = (void*)(orig & (~1));
11942 orig_conv.is_owned = false;
11943 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
11944 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11945 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11946 long ret_ref = (long)ret_var.inner;
11947 if (ret_var.is_owned) {
11953 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
11954 LDKUnsignedChannelAnnouncement this_ptr_conv;
11955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11956 this_ptr_conv.is_owned = false;
11957 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
11958 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11959 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11960 long ret_ref = (long)ret_var.inner;
11961 if (ret_var.is_owned) {
11967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
11968 LDKUnsignedChannelAnnouncement this_ptr_conv;
11969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11970 this_ptr_conv.is_owned = false;
11971 LDKChannelFeatures val_conv;
11972 val_conv.inner = (void*)(val & (~1));
11973 val_conv.is_owned = (val & 1) || (val == 0);
11974 // Warning: we may need a move here but can't clone!
11975 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
11978 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
11979 LDKUnsignedChannelAnnouncement this_ptr_conv;
11980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11981 this_ptr_conv.is_owned = false;
11982 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
11983 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
11987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
11988 LDKUnsignedChannelAnnouncement this_ptr_conv;
11989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11990 this_ptr_conv.is_owned = false;
11991 LDKThirtyTwoBytes val_ref;
11992 CHECK((*env)->GetArrayLength(env, val) == 32);
11993 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
11994 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
11997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
11998 LDKUnsignedChannelAnnouncement this_ptr_conv;
11999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12000 this_ptr_conv.is_owned = false;
12001 int64_t ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
12005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12006 LDKUnsignedChannelAnnouncement this_ptr_conv;
12007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12008 this_ptr_conv.is_owned = false;
12009 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
12012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12013 LDKUnsignedChannelAnnouncement this_ptr_conv;
12014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12015 this_ptr_conv.is_owned = false;
12016 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12017 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
12021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12022 LDKUnsignedChannelAnnouncement this_ptr_conv;
12023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12024 this_ptr_conv.is_owned = false;
12025 LDKPublicKey val_ref;
12026 CHECK((*env)->GetArrayLength(env, val) == 33);
12027 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12028 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
12031 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12032 LDKUnsignedChannelAnnouncement this_ptr_conv;
12033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12034 this_ptr_conv.is_owned = false;
12035 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12036 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
12040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12041 LDKUnsignedChannelAnnouncement this_ptr_conv;
12042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12043 this_ptr_conv.is_owned = false;
12044 LDKPublicKey val_ref;
12045 CHECK((*env)->GetArrayLength(env, val) == 33);
12046 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12047 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
12050 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12051 LDKUnsignedChannelAnnouncement this_ptr_conv;
12052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12053 this_ptr_conv.is_owned = false;
12054 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12055 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
12059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12060 LDKUnsignedChannelAnnouncement this_ptr_conv;
12061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12062 this_ptr_conv.is_owned = false;
12063 LDKPublicKey val_ref;
12064 CHECK((*env)->GetArrayLength(env, val) == 33);
12065 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12066 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
12069 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12070 LDKUnsignedChannelAnnouncement this_ptr_conv;
12071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12072 this_ptr_conv.is_owned = false;
12073 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
12074 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
12078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12079 LDKUnsignedChannelAnnouncement this_ptr_conv;
12080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12081 this_ptr_conv.is_owned = false;
12082 LDKPublicKey val_ref;
12083 CHECK((*env)->GetArrayLength(env, val) == 33);
12084 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
12085 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
12088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12089 LDKChannelAnnouncement this_ptr_conv;
12090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12091 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12092 ChannelAnnouncement_free(this_ptr_conv);
12095 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12096 LDKChannelAnnouncement orig_conv;
12097 orig_conv.inner = (void*)(orig & (~1));
12098 orig_conv.is_owned = false;
12099 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
12100 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12101 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12102 long ret_ref = (long)ret_var.inner;
12103 if (ret_var.is_owned) {
12109 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12110 LDKChannelAnnouncement this_ptr_conv;
12111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12112 this_ptr_conv.is_owned = false;
12113 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12114 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
12118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12119 LDKChannelAnnouncement this_ptr_conv;
12120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12121 this_ptr_conv.is_owned = false;
12122 LDKSignature val_ref;
12123 CHECK((*env)->GetArrayLength(env, val) == 64);
12124 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12125 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
12128 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12129 LDKChannelAnnouncement this_ptr_conv;
12130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12131 this_ptr_conv.is_owned = false;
12132 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12133 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
12137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12138 LDKChannelAnnouncement this_ptr_conv;
12139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12140 this_ptr_conv.is_owned = false;
12141 LDKSignature val_ref;
12142 CHECK((*env)->GetArrayLength(env, val) == 64);
12143 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12144 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
12147 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr) {
12148 LDKChannelAnnouncement this_ptr_conv;
12149 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12150 this_ptr_conv.is_owned = false;
12151 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12152 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
12156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12157 LDKChannelAnnouncement this_ptr_conv;
12158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12159 this_ptr_conv.is_owned = false;
12160 LDKSignature val_ref;
12161 CHECK((*env)->GetArrayLength(env, val) == 64);
12162 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12163 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
12166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr) {
12167 LDKChannelAnnouncement this_ptr_conv;
12168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12169 this_ptr_conv.is_owned = false;
12170 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12171 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
12175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12176 LDKChannelAnnouncement this_ptr_conv;
12177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12178 this_ptr_conv.is_owned = false;
12179 LDKSignature val_ref;
12180 CHECK((*env)->GetArrayLength(env, val) == 64);
12181 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12182 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
12185 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12186 LDKChannelAnnouncement this_ptr_conv;
12187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12188 this_ptr_conv.is_owned = false;
12189 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
12190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12192 long ret_ref = (long)ret_var.inner;
12193 if (ret_var.is_owned) {
12199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12200 LDKChannelAnnouncement this_ptr_conv;
12201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12202 this_ptr_conv.is_owned = false;
12203 LDKUnsignedChannelAnnouncement val_conv;
12204 val_conv.inner = (void*)(val & (~1));
12205 val_conv.is_owned = (val & 1) || (val == 0);
12206 if (val_conv.inner != NULL)
12207 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
12208 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
12211 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) {
12212 LDKSignature node_signature_1_arg_ref;
12213 CHECK((*env)->GetArrayLength(env, node_signature_1_arg) == 64);
12214 (*env)->GetByteArrayRegion(env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
12215 LDKSignature node_signature_2_arg_ref;
12216 CHECK((*env)->GetArrayLength(env, node_signature_2_arg) == 64);
12217 (*env)->GetByteArrayRegion(env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
12218 LDKSignature bitcoin_signature_1_arg_ref;
12219 CHECK((*env)->GetArrayLength(env, bitcoin_signature_1_arg) == 64);
12220 (*env)->GetByteArrayRegion(env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
12221 LDKSignature bitcoin_signature_2_arg_ref;
12222 CHECK((*env)->GetArrayLength(env, bitcoin_signature_2_arg) == 64);
12223 (*env)->GetByteArrayRegion(env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
12224 LDKUnsignedChannelAnnouncement contents_arg_conv;
12225 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12226 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12227 if (contents_arg_conv.inner != NULL)
12228 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
12229 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);
12230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12232 long ret_ref = (long)ret_var.inner;
12233 if (ret_var.is_owned) {
12239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12240 LDKUnsignedChannelUpdate this_ptr_conv;
12241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12242 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12243 UnsignedChannelUpdate_free(this_ptr_conv);
12246 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12247 LDKUnsignedChannelUpdate orig_conv;
12248 orig_conv.inner = (void*)(orig & (~1));
12249 orig_conv.is_owned = false;
12250 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
12251 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12252 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12253 long ret_ref = (long)ret_var.inner;
12254 if (ret_var.is_owned) {
12260 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12261 LDKUnsignedChannelUpdate this_ptr_conv;
12262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12263 this_ptr_conv.is_owned = false;
12264 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12265 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
12269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12270 LDKUnsignedChannelUpdate this_ptr_conv;
12271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12272 this_ptr_conv.is_owned = false;
12273 LDKThirtyTwoBytes val_ref;
12274 CHECK((*env)->GetArrayLength(env, val) == 32);
12275 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12276 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
12279 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
12280 LDKUnsignedChannelUpdate this_ptr_conv;
12281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12282 this_ptr_conv.is_owned = false;
12283 int64_t ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
12287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12288 LDKUnsignedChannelUpdate this_ptr_conv;
12289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12290 this_ptr_conv.is_owned = false;
12291 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
12294 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12295 LDKUnsignedChannelUpdate this_ptr_conv;
12296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12297 this_ptr_conv.is_owned = false;
12298 int32_t ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
12302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12303 LDKUnsignedChannelUpdate this_ptr_conv;
12304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12305 this_ptr_conv.is_owned = false;
12306 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
12309 JNIEXPORT int8_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv *env, jclass clz, int64_t this_ptr) {
12310 LDKUnsignedChannelUpdate this_ptr_conv;
12311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12312 this_ptr_conv.is_owned = false;
12313 int8_t ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
12317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv *env, jclass clz, int64_t this_ptr, int8_t val) {
12318 LDKUnsignedChannelUpdate this_ptr_conv;
12319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12320 this_ptr_conv.is_owned = false;
12321 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
12324 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
12325 LDKUnsignedChannelUpdate this_ptr_conv;
12326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12327 this_ptr_conv.is_owned = false;
12328 int16_t ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
12332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
12333 LDKUnsignedChannelUpdate this_ptr_conv;
12334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12335 this_ptr_conv.is_owned = false;
12336 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
12339 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12340 LDKUnsignedChannelUpdate this_ptr_conv;
12341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12342 this_ptr_conv.is_owned = false;
12343 int64_t ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
12347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12348 LDKUnsignedChannelUpdate this_ptr_conv;
12349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12350 this_ptr_conv.is_owned = false;
12351 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
12354 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
12355 LDKUnsignedChannelUpdate this_ptr_conv;
12356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12357 this_ptr_conv.is_owned = false;
12358 int32_t ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
12362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12363 LDKUnsignedChannelUpdate this_ptr_conv;
12364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12365 this_ptr_conv.is_owned = false;
12366 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
12369 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
12370 LDKUnsignedChannelUpdate this_ptr_conv;
12371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12372 this_ptr_conv.is_owned = false;
12373 int32_t ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
12377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12378 LDKUnsignedChannelUpdate this_ptr_conv;
12379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12380 this_ptr_conv.is_owned = false;
12381 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
12384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12385 LDKChannelUpdate this_ptr_conv;
12386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12388 ChannelUpdate_free(this_ptr_conv);
12391 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12392 LDKChannelUpdate orig_conv;
12393 orig_conv.inner = (void*)(orig & (~1));
12394 orig_conv.is_owned = false;
12395 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
12396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12398 long ret_ref = (long)ret_var.inner;
12399 if (ret_var.is_owned) {
12405 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv *env, jclass clz, int64_t this_ptr) {
12406 LDKChannelUpdate this_ptr_conv;
12407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12408 this_ptr_conv.is_owned = false;
12409 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
12410 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
12414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12415 LDKChannelUpdate this_ptr_conv;
12416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12417 this_ptr_conv.is_owned = false;
12418 LDKSignature val_ref;
12419 CHECK((*env)->GetArrayLength(env, val) == 64);
12420 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
12421 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
12424 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv *env, jclass clz, int64_t this_ptr) {
12425 LDKChannelUpdate this_ptr_conv;
12426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12427 this_ptr_conv.is_owned = false;
12428 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
12429 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12430 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12431 long ret_ref = (long)ret_var.inner;
12432 if (ret_var.is_owned) {
12438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12439 LDKChannelUpdate this_ptr_conv;
12440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12441 this_ptr_conv.is_owned = false;
12442 LDKUnsignedChannelUpdate val_conv;
12443 val_conv.inner = (void*)(val & (~1));
12444 val_conv.is_owned = (val & 1) || (val == 0);
12445 if (val_conv.inner != NULL)
12446 val_conv = UnsignedChannelUpdate_clone(&val_conv);
12447 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
12450 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv *env, jclass clz, int8_tArray signature_arg, int64_t contents_arg) {
12451 LDKSignature signature_arg_ref;
12452 CHECK((*env)->GetArrayLength(env, signature_arg) == 64);
12453 (*env)->GetByteArrayRegion(env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12454 LDKUnsignedChannelUpdate contents_arg_conv;
12455 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12456 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12457 if (contents_arg_conv.inner != NULL)
12458 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
12459 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
12460 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12461 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12462 long ret_ref = (long)ret_var.inner;
12463 if (ret_var.is_owned) {
12469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12470 LDKQueryChannelRange this_ptr_conv;
12471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12473 QueryChannelRange_free(this_ptr_conv);
12476 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12477 LDKQueryChannelRange orig_conv;
12478 orig_conv.inner = (void*)(orig & (~1));
12479 orig_conv.is_owned = false;
12480 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
12481 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12482 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12483 long ret_ref = (long)ret_var.inner;
12484 if (ret_var.is_owned) {
12490 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12491 LDKQueryChannelRange this_ptr_conv;
12492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12493 this_ptr_conv.is_owned = false;
12494 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12495 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
12499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12500 LDKQueryChannelRange this_ptr_conv;
12501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12502 this_ptr_conv.is_owned = false;
12503 LDKThirtyTwoBytes val_ref;
12504 CHECK((*env)->GetArrayLength(env, val) == 32);
12505 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12506 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12509 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12510 LDKQueryChannelRange this_ptr_conv;
12511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12512 this_ptr_conv.is_owned = false;
12513 int32_t ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
12517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12518 LDKQueryChannelRange this_ptr_conv;
12519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12520 this_ptr_conv.is_owned = false;
12521 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
12524 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12525 LDKQueryChannelRange this_ptr_conv;
12526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12527 this_ptr_conv.is_owned = false;
12528 int32_t ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
12532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12533 LDKQueryChannelRange this_ptr_conv;
12534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12535 this_ptr_conv.is_owned = false;
12536 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12539 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) {
12540 LDKThirtyTwoBytes chain_hash_arg_ref;
12541 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12542 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12543 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
12544 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12545 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12546 long ret_ref = (long)ret_var.inner;
12547 if (ret_var.is_owned) {
12553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12554 LDKReplyChannelRange this_ptr_conv;
12555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12557 ReplyChannelRange_free(this_ptr_conv);
12560 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12561 LDKReplyChannelRange orig_conv;
12562 orig_conv.inner = (void*)(orig & (~1));
12563 orig_conv.is_owned = false;
12564 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
12565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12567 long ret_ref = (long)ret_var.inner;
12568 if (ret_var.is_owned) {
12574 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12575 LDKReplyChannelRange this_ptr_conv;
12576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12577 this_ptr_conv.is_owned = false;
12578 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12579 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
12583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12584 LDKReplyChannelRange this_ptr_conv;
12585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12586 this_ptr_conv.is_owned = false;
12587 LDKThirtyTwoBytes val_ref;
12588 CHECK((*env)->GetArrayLength(env, val) == 32);
12589 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12590 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12593 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr) {
12594 LDKReplyChannelRange this_ptr_conv;
12595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12596 this_ptr_conv.is_owned = false;
12597 int32_t ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
12601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12602 LDKReplyChannelRange this_ptr_conv;
12603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12604 this_ptr_conv.is_owned = false;
12605 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
12608 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr) {
12609 LDKReplyChannelRange this_ptr_conv;
12610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12611 this_ptr_conv.is_owned = false;
12612 int32_t ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
12616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12617 LDKReplyChannelRange this_ptr_conv;
12618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12619 this_ptr_conv.is_owned = false;
12620 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12623 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12624 LDKReplyChannelRange this_ptr_conv;
12625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12626 this_ptr_conv.is_owned = false;
12627 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
12631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12632 LDKReplyChannelRange this_ptr_conv;
12633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12634 this_ptr_conv.is_owned = false;
12635 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
12638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12639 LDKReplyChannelRange this_ptr_conv;
12640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12641 this_ptr_conv.is_owned = false;
12642 LDKCVec_u64Z val_constr;
12643 val_constr.datalen = (*env)->GetArrayLength(env, val);
12644 if (val_constr.datalen > 0)
12645 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12647 val_constr.data = NULL;
12648 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12649 for (size_t g = 0; g < val_constr.datalen; g++) {
12650 int64_t arr_conv_6 = val_vals[g];
12651 val_constr.data[g] = arr_conv_6;
12653 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12654 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
12657 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) {
12658 LDKThirtyTwoBytes chain_hash_arg_ref;
12659 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12660 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12661 LDKCVec_u64Z short_channel_ids_arg_constr;
12662 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12663 if (short_channel_ids_arg_constr.datalen > 0)
12664 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12666 short_channel_ids_arg_constr.data = NULL;
12667 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12668 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12669 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12670 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12672 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12673 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
12674 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12675 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12676 long ret_ref = (long)ret_var.inner;
12677 if (ret_var.is_owned) {
12683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12684 LDKQueryShortChannelIds this_ptr_conv;
12685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12687 QueryShortChannelIds_free(this_ptr_conv);
12690 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12691 LDKQueryShortChannelIds orig_conv;
12692 orig_conv.inner = (void*)(orig & (~1));
12693 orig_conv.is_owned = false;
12694 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
12695 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12696 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12697 long ret_ref = (long)ret_var.inner;
12698 if (ret_var.is_owned) {
12704 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12705 LDKQueryShortChannelIds this_ptr_conv;
12706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12707 this_ptr_conv.is_owned = false;
12708 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12709 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
12713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12714 LDKQueryShortChannelIds this_ptr_conv;
12715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12716 this_ptr_conv.is_owned = false;
12717 LDKThirtyTwoBytes val_ref;
12718 CHECK((*env)->GetArrayLength(env, val) == 32);
12719 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12720 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
12723 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
12724 LDKQueryShortChannelIds this_ptr_conv;
12725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12726 this_ptr_conv.is_owned = false;
12727 LDKCVec_u64Z val_constr;
12728 val_constr.datalen = (*env)->GetArrayLength(env, val);
12729 if (val_constr.datalen > 0)
12730 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12732 val_constr.data = NULL;
12733 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
12734 for (size_t g = 0; g < val_constr.datalen; g++) {
12735 int64_t arr_conv_6 = val_vals[g];
12736 val_constr.data[g] = arr_conv_6;
12738 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
12739 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
12742 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) {
12743 LDKThirtyTwoBytes chain_hash_arg_ref;
12744 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12745 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12746 LDKCVec_u64Z short_channel_ids_arg_constr;
12747 short_channel_ids_arg_constr.datalen = (*env)->GetArrayLength(env, short_channel_ids_arg);
12748 if (short_channel_ids_arg_constr.datalen > 0)
12749 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
12751 short_channel_ids_arg_constr.data = NULL;
12752 int64_t* short_channel_ids_arg_vals = (*env)->GetLongArrayElements (env, short_channel_ids_arg, NULL);
12753 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12754 int64_t arr_conv_6 = short_channel_ids_arg_vals[g];
12755 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12757 (*env)->ReleaseLongArrayElements(env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12758 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
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_ReplyShortChannelIdsEnd_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12769 LDKReplyShortChannelIdsEnd 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 ReplyShortChannelIdsEnd_free(this_ptr_conv);
12775 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12776 LDKReplyShortChannelIdsEnd orig_conv;
12777 orig_conv.inner = (void*)(orig & (~1));
12778 orig_conv.is_owned = false;
12779 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_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_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12790 LDKReplyShortChannelIdsEnd 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, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
12798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12799 LDKReplyShortChannelIdsEnd 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 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
12808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr) {
12809 LDKReplyShortChannelIdsEnd this_ptr_conv;
12810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12811 this_ptr_conv.is_owned = false;
12812 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
12816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
12817 LDKReplyShortChannelIdsEnd this_ptr_conv;
12818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12819 this_ptr_conv.is_owned = false;
12820 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
12823 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv *env, jclass clz, int8_tArray chain_hash_arg, jboolean full_information_arg) {
12824 LDKThirtyTwoBytes chain_hash_arg_ref;
12825 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12826 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12827 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
12828 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12829 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12830 long ret_ref = (long)ret_var.inner;
12831 if (ret_var.is_owned) {
12837 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12838 LDKGossipTimestampFilter this_ptr_conv;
12839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12840 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12841 GossipTimestampFilter_free(this_ptr_conv);
12844 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12845 LDKGossipTimestampFilter orig_conv;
12846 orig_conv.inner = (void*)(orig & (~1));
12847 orig_conv.is_owned = false;
12848 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
12849 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12850 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12851 long ret_ref = (long)ret_var.inner;
12852 if (ret_var.is_owned) {
12858 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
12859 LDKGossipTimestampFilter this_ptr_conv;
12860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12861 this_ptr_conv.is_owned = false;
12862 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
12863 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
12867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12868 LDKGossipTimestampFilter this_ptr_conv;
12869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12870 this_ptr_conv.is_owned = false;
12871 LDKThirtyTwoBytes val_ref;
12872 CHECK((*env)->GetArrayLength(env, val) == 32);
12873 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
12874 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
12877 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr) {
12878 LDKGossipTimestampFilter this_ptr_conv;
12879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12880 this_ptr_conv.is_owned = false;
12881 int32_t ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
12885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12886 LDKGossipTimestampFilter this_ptr_conv;
12887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12888 this_ptr_conv.is_owned = false;
12889 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
12892 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr) {
12893 LDKGossipTimestampFilter this_ptr_conv;
12894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12895 this_ptr_conv.is_owned = false;
12896 int32_t ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
12900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
12901 LDKGossipTimestampFilter this_ptr_conv;
12902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12903 this_ptr_conv.is_owned = false;
12904 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
12907 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) {
12908 LDKThirtyTwoBytes chain_hash_arg_ref;
12909 CHECK((*env)->GetArrayLength(env, chain_hash_arg) == 32);
12910 (*env)->GetByteArrayRegion(env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12911 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
12912 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12913 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12914 long ret_ref = (long)ret_var.inner;
12915 if (ret_var.is_owned) {
12921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12922 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
12923 FREE((void*)this_ptr);
12924 ErrorAction_free(this_ptr_conv);
12927 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
12928 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
12929 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12930 *ret_copy = ErrorAction_clone(orig_conv);
12931 long ret_ref = (long)ret_copy;
12935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12936 LDKLightningError this_ptr_conv;
12937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12938 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12939 LightningError_free(this_ptr_conv);
12942 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv *env, jclass clz, int64_t this_ptr) {
12943 LDKLightningError this_ptr_conv;
12944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12945 this_ptr_conv.is_owned = false;
12946 LDKStr _str = LightningError_get_err(&this_ptr_conv);
12947 jstring _conv = str_ref_to_java(env, _str.chars, _str.len);
12951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
12952 LDKLightningError this_ptr_conv;
12953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12954 this_ptr_conv.is_owned = false;
12955 LDKCVec_u8Z val_ref;
12956 val_ref.datalen = (*env)->GetArrayLength(env, val);
12957 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12958 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
12959 LightningError_set_err(&this_ptr_conv, val_ref);
12962 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv *env, jclass clz, int64_t this_ptr) {
12963 LDKLightningError this_ptr_conv;
12964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12965 this_ptr_conv.is_owned = false;
12966 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12967 *ret_copy = LightningError_get_action(&this_ptr_conv);
12968 long ret_ref = (long)ret_copy;
12972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
12973 LDKLightningError this_ptr_conv;
12974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12975 this_ptr_conv.is_owned = false;
12976 LDKErrorAction val_conv = *(LDKErrorAction*)val;
12978 LightningError_set_action(&this_ptr_conv, val_conv);
12981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, int8_tArray err_arg, int64_t action_arg) {
12982 LDKCVec_u8Z err_arg_ref;
12983 err_arg_ref.datalen = (*env)->GetArrayLength(env, err_arg);
12984 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12985 (*env)->GetByteArrayRegion(env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
12986 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
12987 FREE((void*)action_arg);
12988 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
12989 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12990 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12991 long ret_ref = (long)ret_var.inner;
12992 if (ret_var.is_owned) {
12998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
12999 LDKCommitmentUpdate this_ptr_conv;
13000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13002 CommitmentUpdate_free(this_ptr_conv);
13005 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13006 LDKCommitmentUpdate orig_conv;
13007 orig_conv.inner = (void*)(orig & (~1));
13008 orig_conv.is_owned = false;
13009 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
13010 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13011 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13012 long ret_ref = (long)ret_var.inner;
13013 if (ret_var.is_owned) {
13019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13020 LDKCommitmentUpdate this_ptr_conv;
13021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13022 this_ptr_conv.is_owned = false;
13023 LDKCVec_UpdateAddHTLCZ val_constr;
13024 val_constr.datalen = (*env)->GetArrayLength(env, val);
13025 if (val_constr.datalen > 0)
13026 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13028 val_constr.data = NULL;
13029 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13030 for (size_t p = 0; p < val_constr.datalen; p++) {
13031 int64_t arr_conv_15 = val_vals[p];
13032 LDKUpdateAddHTLC arr_conv_15_conv;
13033 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13034 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13035 if (arr_conv_15_conv.inner != NULL)
13036 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13037 val_constr.data[p] = arr_conv_15_conv;
13039 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13040 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
13043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13044 LDKCommitmentUpdate this_ptr_conv;
13045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13046 this_ptr_conv.is_owned = false;
13047 LDKCVec_UpdateFulfillHTLCZ val_constr;
13048 val_constr.datalen = (*env)->GetArrayLength(env, val);
13049 if (val_constr.datalen > 0)
13050 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13052 val_constr.data = NULL;
13053 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13054 for (size_t t = 0; t < val_constr.datalen; t++) {
13055 int64_t arr_conv_19 = val_vals[t];
13056 LDKUpdateFulfillHTLC arr_conv_19_conv;
13057 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13058 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13059 if (arr_conv_19_conv.inner != NULL)
13060 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13061 val_constr.data[t] = arr_conv_19_conv;
13063 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13064 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
13067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
13068 LDKCommitmentUpdate this_ptr_conv;
13069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13070 this_ptr_conv.is_owned = false;
13071 LDKCVec_UpdateFailHTLCZ val_constr;
13072 val_constr.datalen = (*env)->GetArrayLength(env, val);
13073 if (val_constr.datalen > 0)
13074 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13076 val_constr.data = NULL;
13077 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13078 for (size_t q = 0; q < val_constr.datalen; q++) {
13079 int64_t arr_conv_16 = val_vals[q];
13080 LDKUpdateFailHTLC arr_conv_16_conv;
13081 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13082 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13083 if (arr_conv_16_conv.inner != NULL)
13084 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13085 val_constr.data[q] = arr_conv_16_conv;
13087 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13088 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
13091 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) {
13092 LDKCommitmentUpdate this_ptr_conv;
13093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13094 this_ptr_conv.is_owned = false;
13095 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
13096 val_constr.datalen = (*env)->GetArrayLength(env, val);
13097 if (val_constr.datalen > 0)
13098 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13100 val_constr.data = NULL;
13101 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
13102 for (size_t z = 0; z < val_constr.datalen; z++) {
13103 int64_t arr_conv_25 = val_vals[z];
13104 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13105 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13106 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13107 if (arr_conv_25_conv.inner != NULL)
13108 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13109 val_constr.data[z] = arr_conv_25_conv;
13111 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
13112 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
13115 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr) {
13116 LDKCommitmentUpdate this_ptr_conv;
13117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13118 this_ptr_conv.is_owned = false;
13119 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
13120 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13121 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13122 long ret_ref = (long)ret_var.inner;
13123 if (ret_var.is_owned) {
13129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13130 LDKCommitmentUpdate this_ptr_conv;
13131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13132 this_ptr_conv.is_owned = false;
13133 LDKUpdateFee val_conv;
13134 val_conv.inner = (void*)(val & (~1));
13135 val_conv.is_owned = (val & 1) || (val == 0);
13136 if (val_conv.inner != NULL)
13137 val_conv = UpdateFee_clone(&val_conv);
13138 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
13141 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr) {
13142 LDKCommitmentUpdate this_ptr_conv;
13143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13144 this_ptr_conv.is_owned = false;
13145 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
13146 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13147 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13148 long ret_ref = (long)ret_var.inner;
13149 if (ret_var.is_owned) {
13155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
13156 LDKCommitmentUpdate this_ptr_conv;
13157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13158 this_ptr_conv.is_owned = false;
13159 LDKCommitmentSigned val_conv;
13160 val_conv.inner = (void*)(val & (~1));
13161 val_conv.is_owned = (val & 1) || (val == 0);
13162 if (val_conv.inner != NULL)
13163 val_conv = CommitmentSigned_clone(&val_conv);
13164 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
13167 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) {
13168 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
13169 update_add_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_add_htlcs_arg);
13170 if (update_add_htlcs_arg_constr.datalen > 0)
13171 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13173 update_add_htlcs_arg_constr.data = NULL;
13174 int64_t* update_add_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_add_htlcs_arg, NULL);
13175 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
13176 int64_t arr_conv_15 = update_add_htlcs_arg_vals[p];
13177 LDKUpdateAddHTLC arr_conv_15_conv;
13178 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13179 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13180 if (arr_conv_15_conv.inner != NULL)
13181 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
13182 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
13184 (*env)->ReleaseLongArrayElements(env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
13185 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
13186 update_fulfill_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fulfill_htlcs_arg);
13187 if (update_fulfill_htlcs_arg_constr.datalen > 0)
13188 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13190 update_fulfill_htlcs_arg_constr.data = NULL;
13191 int64_t* update_fulfill_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fulfill_htlcs_arg, NULL);
13192 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
13193 int64_t arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
13194 LDKUpdateFulfillHTLC arr_conv_19_conv;
13195 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13196 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13197 if (arr_conv_19_conv.inner != NULL)
13198 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
13199 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
13201 (*env)->ReleaseLongArrayElements(env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
13202 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
13203 update_fail_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_htlcs_arg);
13204 if (update_fail_htlcs_arg_constr.datalen > 0)
13205 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13207 update_fail_htlcs_arg_constr.data = NULL;
13208 int64_t* update_fail_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_htlcs_arg, NULL);
13209 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
13210 int64_t arr_conv_16 = update_fail_htlcs_arg_vals[q];
13211 LDKUpdateFailHTLC arr_conv_16_conv;
13212 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13213 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13214 if (arr_conv_16_conv.inner != NULL)
13215 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
13216 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
13218 (*env)->ReleaseLongArrayElements(env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
13219 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
13220 update_fail_malformed_htlcs_arg_constr.datalen = (*env)->GetArrayLength(env, update_fail_malformed_htlcs_arg);
13221 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
13222 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13224 update_fail_malformed_htlcs_arg_constr.data = NULL;
13225 int64_t* update_fail_malformed_htlcs_arg_vals = (*env)->GetLongArrayElements (env, update_fail_malformed_htlcs_arg, NULL);
13226 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
13227 int64_t arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
13228 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13229 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13230 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13231 if (arr_conv_25_conv.inner != NULL)
13232 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
13233 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
13235 (*env)->ReleaseLongArrayElements(env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
13236 LDKUpdateFee update_fee_arg_conv;
13237 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
13238 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
13239 if (update_fee_arg_conv.inner != NULL)
13240 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
13241 LDKCommitmentSigned commitment_signed_arg_conv;
13242 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
13243 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
13244 if (commitment_signed_arg_conv.inner != NULL)
13245 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
13246 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);
13247 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13248 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13249 long ret_ref = (long)ret_var.inner;
13250 if (ret_var.is_owned) {
13256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13257 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
13258 FREE((void*)this_ptr);
13259 HTLCFailChannelUpdate_free(this_ptr_conv);
13262 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
13263 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
13264 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
13265 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
13266 long ret_ref = (long)ret_copy;
13270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13271 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
13272 FREE((void*)this_ptr);
13273 ChannelMessageHandler_free(this_ptr_conv);
13276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
13277 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
13278 FREE((void*)this_ptr);
13279 RoutingMessageHandler_free(this_ptr_conv);
13282 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13283 LDKAcceptChannel obj_conv;
13284 obj_conv.inner = (void*)(obj & (~1));
13285 obj_conv.is_owned = false;
13286 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
13287 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13288 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13289 CVec_u8Z_free(arg_var);
13293 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13294 LDKu8slice ser_ref;
13295 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13296 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13297 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
13298 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13299 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13300 long ret_ref = (long)ret_var.inner;
13301 if (ret_var.is_owned) {
13304 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13308 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv *env, jclass clz, int64_t obj) {
13309 LDKAnnouncementSignatures obj_conv;
13310 obj_conv.inner = (void*)(obj & (~1));
13311 obj_conv.is_owned = false;
13312 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
13313 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13314 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13315 CVec_u8Z_free(arg_var);
13319 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13320 LDKu8slice ser_ref;
13321 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13322 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13323 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
13324 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13325 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13326 long ret_ref = (long)ret_var.inner;
13327 if (ret_var.is_owned) {
13330 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13334 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv *env, jclass clz, int64_t obj) {
13335 LDKChannelReestablish obj_conv;
13336 obj_conv.inner = (void*)(obj & (~1));
13337 obj_conv.is_owned = false;
13338 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
13339 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13340 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13341 CVec_u8Z_free(arg_var);
13345 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13346 LDKu8slice ser_ref;
13347 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13348 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13349 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13350 *ret_conv = ChannelReestablish_read(ser_ref);
13351 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13352 return (long)ret_conv;
13355 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13356 LDKClosingSigned obj_conv;
13357 obj_conv.inner = (void*)(obj & (~1));
13358 obj_conv.is_owned = false;
13359 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
13360 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13361 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13362 CVec_u8Z_free(arg_var);
13366 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13367 LDKu8slice ser_ref;
13368 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13369 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13370 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
13371 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13372 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13373 long ret_ref = (long)ret_var.inner;
13374 if (ret_var.is_owned) {
13377 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13381 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13382 LDKCommitmentSigned obj_conv;
13383 obj_conv.inner = (void*)(obj & (~1));
13384 obj_conv.is_owned = false;
13385 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
13386 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13387 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13388 CVec_u8Z_free(arg_var);
13392 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13393 LDKu8slice ser_ref;
13394 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13395 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13396 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
13397 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13398 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13399 long ret_ref = (long)ret_var.inner;
13400 if (ret_var.is_owned) {
13403 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13407 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv *env, jclass clz, int64_t obj) {
13408 LDKFundingCreated obj_conv;
13409 obj_conv.inner = (void*)(obj & (~1));
13410 obj_conv.is_owned = false;
13411 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
13412 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13413 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13414 CVec_u8Z_free(arg_var);
13418 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13419 LDKu8slice ser_ref;
13420 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13421 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13422 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
13423 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13424 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13425 long ret_ref = (long)ret_var.inner;
13426 if (ret_var.is_owned) {
13429 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13433 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv *env, jclass clz, int64_t obj) {
13434 LDKFundingSigned obj_conv;
13435 obj_conv.inner = (void*)(obj & (~1));
13436 obj_conv.is_owned = false;
13437 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
13438 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13439 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13440 CVec_u8Z_free(arg_var);
13444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13445 LDKu8slice ser_ref;
13446 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13447 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13448 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
13449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13451 long ret_ref = (long)ret_var.inner;
13452 if (ret_var.is_owned) {
13455 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13459 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv *env, jclass clz, int64_t obj) {
13460 LDKFundingLocked obj_conv;
13461 obj_conv.inner = (void*)(obj & (~1));
13462 obj_conv.is_owned = false;
13463 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
13464 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13465 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13466 CVec_u8Z_free(arg_var);
13470 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13471 LDKu8slice ser_ref;
13472 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13473 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13474 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
13475 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13476 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13477 long ret_ref = (long)ret_var.inner;
13478 if (ret_var.is_owned) {
13481 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13485 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv *env, jclass clz, int64_t obj) {
13487 obj_conv.inner = (void*)(obj & (~1));
13488 obj_conv.is_owned = false;
13489 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
13490 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13491 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13492 CVec_u8Z_free(arg_var);
13496 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13497 LDKu8slice ser_ref;
13498 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13499 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13500 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13501 *ret_conv = Init_read(ser_ref);
13502 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13503 return (long)ret_conv;
13506 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv *env, jclass clz, int64_t obj) {
13507 LDKOpenChannel obj_conv;
13508 obj_conv.inner = (void*)(obj & (~1));
13509 obj_conv.is_owned = false;
13510 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
13511 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13512 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13513 CVec_u8Z_free(arg_var);
13517 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13518 LDKu8slice ser_ref;
13519 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13520 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13521 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
13522 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13523 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13524 long ret_ref = (long)ret_var.inner;
13525 if (ret_var.is_owned) {
13528 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13532 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv *env, jclass clz, int64_t obj) {
13533 LDKRevokeAndACK obj_conv;
13534 obj_conv.inner = (void*)(obj & (~1));
13535 obj_conv.is_owned = false;
13536 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
13537 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13538 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13539 CVec_u8Z_free(arg_var);
13543 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13544 LDKu8slice ser_ref;
13545 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13546 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13547 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
13548 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13549 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13550 long ret_ref = (long)ret_var.inner;
13551 if (ret_var.is_owned) {
13554 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13558 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv *env, jclass clz, int64_t obj) {
13559 LDKShutdown obj_conv;
13560 obj_conv.inner = (void*)(obj & (~1));
13561 obj_conv.is_owned = false;
13562 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
13563 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13564 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13565 CVec_u8Z_free(arg_var);
13569 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13570 LDKu8slice ser_ref;
13571 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13572 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13573 LDKShutdown ret_var = Shutdown_read(ser_ref);
13574 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13575 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13576 long ret_ref = (long)ret_var.inner;
13577 if (ret_var.is_owned) {
13580 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13584 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13585 LDKUpdateFailHTLC obj_conv;
13586 obj_conv.inner = (void*)(obj & (~1));
13587 obj_conv.is_owned = false;
13588 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
13589 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13590 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13591 CVec_u8Z_free(arg_var);
13595 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13596 LDKu8slice ser_ref;
13597 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13598 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13599 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
13600 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13601 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13602 long ret_ref = (long)ret_var.inner;
13603 if (ret_var.is_owned) {
13606 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13610 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13611 LDKUpdateFailMalformedHTLC obj_conv;
13612 obj_conv.inner = (void*)(obj & (~1));
13613 obj_conv.is_owned = false;
13614 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
13615 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13616 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13617 CVec_u8Z_free(arg_var);
13621 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13622 LDKu8slice ser_ref;
13623 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13624 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13625 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
13626 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13627 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13628 long ret_ref = (long)ret_var.inner;
13629 if (ret_var.is_owned) {
13632 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13636 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv *env, jclass clz, int64_t obj) {
13637 LDKUpdateFee obj_conv;
13638 obj_conv.inner = (void*)(obj & (~1));
13639 obj_conv.is_owned = false;
13640 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
13641 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13642 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13643 CVec_u8Z_free(arg_var);
13647 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13648 LDKu8slice ser_ref;
13649 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13650 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13651 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
13652 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13653 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13654 long ret_ref = (long)ret_var.inner;
13655 if (ret_var.is_owned) {
13658 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13662 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13663 LDKUpdateFulfillHTLC obj_conv;
13664 obj_conv.inner = (void*)(obj & (~1));
13665 obj_conv.is_owned = false;
13666 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
13667 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13668 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13669 CVec_u8Z_free(arg_var);
13673 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13674 LDKu8slice ser_ref;
13675 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13676 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13677 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
13678 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13679 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13680 long ret_ref = (long)ret_var.inner;
13681 if (ret_var.is_owned) {
13684 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13688 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv *env, jclass clz, int64_t obj) {
13689 LDKUpdateAddHTLC obj_conv;
13690 obj_conv.inner = (void*)(obj & (~1));
13691 obj_conv.is_owned = false;
13692 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
13693 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13694 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13695 CVec_u8Z_free(arg_var);
13699 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13700 LDKu8slice ser_ref;
13701 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13702 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13703 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
13704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13706 long ret_ref = (long)ret_var.inner;
13707 if (ret_var.is_owned) {
13710 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13714 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv *env, jclass clz, int64_t obj) {
13716 obj_conv.inner = (void*)(obj & (~1));
13717 obj_conv.is_owned = false;
13718 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
13719 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13720 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13721 CVec_u8Z_free(arg_var);
13725 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13726 LDKu8slice ser_ref;
13727 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13728 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13729 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13730 *ret_conv = Ping_read(ser_ref);
13731 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13732 return (long)ret_conv;
13735 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv *env, jclass clz, int64_t obj) {
13737 obj_conv.inner = (void*)(obj & (~1));
13738 obj_conv.is_owned = false;
13739 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
13740 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13741 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13742 CVec_u8Z_free(arg_var);
13746 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13747 LDKu8slice ser_ref;
13748 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13749 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13750 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13751 *ret_conv = Pong_read(ser_ref);
13752 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13753 return (long)ret_conv;
13756 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13757 LDKUnsignedChannelAnnouncement obj_conv;
13758 obj_conv.inner = (void*)(obj & (~1));
13759 obj_conv.is_owned = false;
13760 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
13761 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13762 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13763 CVec_u8Z_free(arg_var);
13767 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13768 LDKu8slice ser_ref;
13769 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13770 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13771 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13772 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
13773 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13774 return (long)ret_conv;
13777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13778 LDKChannelAnnouncement obj_conv;
13779 obj_conv.inner = (void*)(obj & (~1));
13780 obj_conv.is_owned = false;
13781 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
13782 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13783 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13784 CVec_u8Z_free(arg_var);
13788 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13789 LDKu8slice ser_ref;
13790 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13791 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13792 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
13793 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13794 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13795 long ret_ref = (long)ret_var.inner;
13796 if (ret_var.is_owned) {
13799 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13803 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13804 LDKUnsignedChannelUpdate obj_conv;
13805 obj_conv.inner = (void*)(obj & (~1));
13806 obj_conv.is_owned = false;
13807 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
13808 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13809 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13810 CVec_u8Z_free(arg_var);
13814 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13815 LDKu8slice ser_ref;
13816 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13817 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13818 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13819 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
13820 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13821 return (long)ret_conv;
13824 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
13825 LDKChannelUpdate obj_conv;
13826 obj_conv.inner = (void*)(obj & (~1));
13827 obj_conv.is_owned = false;
13828 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
13829 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13830 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13831 CVec_u8Z_free(arg_var);
13835 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13836 LDKu8slice ser_ref;
13837 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13838 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13839 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
13840 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13841 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13842 long ret_ref = (long)ret_var.inner;
13843 if (ret_var.is_owned) {
13846 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13850 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv *env, jclass clz, int64_t obj) {
13851 LDKErrorMessage obj_conv;
13852 obj_conv.inner = (void*)(obj & (~1));
13853 obj_conv.is_owned = false;
13854 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
13855 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13856 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13857 CVec_u8Z_free(arg_var);
13861 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13862 LDKu8slice ser_ref;
13863 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13864 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13865 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13866 *ret_conv = ErrorMessage_read(ser_ref);
13867 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13868 return (long)ret_conv;
13871 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13872 LDKUnsignedNodeAnnouncement obj_conv;
13873 obj_conv.inner = (void*)(obj & (~1));
13874 obj_conv.is_owned = false;
13875 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
13876 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13877 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13878 CVec_u8Z_free(arg_var);
13882 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13883 LDKu8slice ser_ref;
13884 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13885 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13886 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13887 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
13888 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13889 return (long)ret_conv;
13892 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv *env, jclass clz, int64_t obj) {
13893 LDKNodeAnnouncement obj_conv;
13894 obj_conv.inner = (void*)(obj & (~1));
13895 obj_conv.is_owned = false;
13896 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
13897 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13898 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13899 CVec_u8Z_free(arg_var);
13903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13904 LDKu8slice ser_ref;
13905 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13906 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13907 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
13908 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13909 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13910 long ret_ref = (long)ret_var.inner;
13911 if (ret_var.is_owned) {
13914 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13918 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13919 LDKu8slice ser_ref;
13920 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13921 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13922 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13923 *ret_conv = QueryShortChannelIds_read(ser_ref);
13924 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13925 return (long)ret_conv;
13928 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv *env, jclass clz, int64_t obj) {
13929 LDKQueryShortChannelIds obj_conv;
13930 obj_conv.inner = (void*)(obj & (~1));
13931 obj_conv.is_owned = false;
13932 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
13933 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13934 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13935 CVec_u8Z_free(arg_var);
13939 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13940 LDKu8slice ser_ref;
13941 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13942 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13943 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13944 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
13945 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13946 return (long)ret_conv;
13949 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
13950 LDKReplyShortChannelIdsEnd obj_conv;
13951 obj_conv.inner = (void*)(obj & (~1));
13952 obj_conv.is_owned = false;
13953 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
13954 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13955 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13956 CVec_u8Z_free(arg_var);
13960 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13961 LDKu8slice ser_ref;
13962 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13963 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13964 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13965 *ret_conv = QueryChannelRange_read(ser_ref);
13966 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13967 return (long)ret_conv;
13970 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
13971 LDKQueryChannelRange obj_conv;
13972 obj_conv.inner = (void*)(obj & (~1));
13973 obj_conv.is_owned = false;
13974 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
13975 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13976 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13977 CVec_u8Z_free(arg_var);
13981 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
13982 LDKu8slice ser_ref;
13983 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
13984 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
13985 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13986 *ret_conv = ReplyChannelRange_read(ser_ref);
13987 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
13988 return (long)ret_conv;
13991 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
13992 LDKReplyChannelRange obj_conv;
13993 obj_conv.inner = (void*)(obj & (~1));
13994 obj_conv.is_owned = false;
13995 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
13996 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
13997 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
13998 CVec_u8Z_free(arg_var);
14002 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14003 LDKu8slice ser_ref;
14004 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14005 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14006 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
14007 *ret_conv = GossipTimestampFilter_read(ser_ref);
14008 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14009 return (long)ret_conv;
14012 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
14013 LDKGossipTimestampFilter obj_conv;
14014 obj_conv.inner = (void*)(obj & (~1));
14015 obj_conv.is_owned = false;
14016 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
14017 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14018 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14019 CVec_u8Z_free(arg_var);
14023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14024 LDKMessageHandler this_ptr_conv;
14025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14027 MessageHandler_free(this_ptr_conv);
14030 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
14031 LDKMessageHandler this_ptr_conv;
14032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14033 this_ptr_conv.is_owned = false;
14034 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
14038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14039 LDKMessageHandler this_ptr_conv;
14040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14041 this_ptr_conv.is_owned = false;
14042 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
14043 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
14044 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14045 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
14047 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
14050 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr) {
14051 LDKMessageHandler this_ptr_conv;
14052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14053 this_ptr_conv.is_owned = false;
14054 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
14058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14059 LDKMessageHandler this_ptr_conv;
14060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14061 this_ptr_conv.is_owned = false;
14062 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
14063 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
14064 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14065 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
14067 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
14070 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) {
14071 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
14072 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
14073 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14074 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
14076 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
14077 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
14078 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14079 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
14081 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
14082 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14083 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14084 long ret_ref = (long)ret_var.inner;
14085 if (ret_var.is_owned) {
14091 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14092 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
14093 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14094 *ret = SocketDescriptor_clone(orig_conv);
14098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14099 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
14100 FREE((void*)this_ptr);
14101 SocketDescriptor_free(this_ptr_conv);
14104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14105 LDKPeerHandleError this_ptr_conv;
14106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14108 PeerHandleError_free(this_ptr_conv);
14111 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr) {
14112 LDKPeerHandleError this_ptr_conv;
14113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14114 this_ptr_conv.is_owned = false;
14115 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
14119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14120 LDKPeerHandleError this_ptr_conv;
14121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14122 this_ptr_conv.is_owned = false;
14123 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
14126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv *env, jclass clz, jboolean no_connection_possible_arg) {
14127 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
14128 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14129 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14130 long ret_ref = (long)ret_var.inner;
14131 if (ret_var.is_owned) {
14137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14138 LDKPeerManager this_ptr_conv;
14139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14141 PeerManager_free(this_ptr_conv);
14144 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) {
14145 LDKMessageHandler message_handler_conv;
14146 message_handler_conv.inner = (void*)(message_handler & (~1));
14147 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
14148 // Warning: we may need a move here but can't clone!
14149 LDKSecretKey our_node_secret_ref;
14150 CHECK((*env)->GetArrayLength(env, our_node_secret) == 32);
14151 (*env)->GetByteArrayRegion(env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
14152 unsigned char ephemeral_random_data_arr[32];
14153 CHECK((*env)->GetArrayLength(env, ephemeral_random_data) == 32);
14154 (*env)->GetByteArrayRegion(env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
14155 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
14156 LDKLogger logger_conv = *(LDKLogger*)logger;
14157 if (logger_conv.free == LDKLogger_JCalls_free) {
14158 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14159 LDKLogger_JCalls_clone(logger_conv.this_arg);
14161 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
14162 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14163 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14164 long ret_ref = (long)ret_var.inner;
14165 if (ret_var.is_owned) {
14171 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv *env, jclass clz, int64_t this_arg) {
14172 LDKPeerManager this_arg_conv;
14173 this_arg_conv.inner = (void*)(this_arg & (~1));
14174 this_arg_conv.is_owned = false;
14175 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
14176 jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
14178 for (size_t i = 0; i < ret_var.datalen; i++) {
14179 int8_tArray arr_conv_8_arr = (*env)->NewByteArray(env, 33);
14180 (*env)->SetByteArrayRegion(env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
14181 (*env)->SetObjectArrayElement(env, ret_arr, i, arr_conv_8_arr);
14183 FREE(ret_var.data);
14187 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) {
14188 LDKPeerManager this_arg_conv;
14189 this_arg_conv.inner = (void*)(this_arg & (~1));
14190 this_arg_conv.is_owned = false;
14191 LDKPublicKey their_node_id_ref;
14192 CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
14193 (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14194 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
14195 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14196 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14197 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14199 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
14200 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
14201 return (long)ret_conv;
14204 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14205 LDKPeerManager this_arg_conv;
14206 this_arg_conv.inner = (void*)(this_arg & (~1));
14207 this_arg_conv.is_owned = false;
14208 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
14209 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14210 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14211 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14213 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14214 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
14215 return (long)ret_conv;
14218 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) {
14219 LDKPeerManager this_arg_conv;
14220 this_arg_conv.inner = (void*)(this_arg & (~1));
14221 this_arg_conv.is_owned = false;
14222 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14223 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14224 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
14225 return (long)ret_conv;
14228 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) {
14229 LDKPeerManager this_arg_conv;
14230 this_arg_conv.inner = (void*)(this_arg & (~1));
14231 this_arg_conv.is_owned = false;
14232 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
14233 LDKu8slice data_ref;
14234 data_ref.datalen = (*env)->GetArrayLength(env, data);
14235 data_ref.data = (*env)->GetByteArrayElements (env, data, NULL);
14236 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14237 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
14238 (*env)->ReleaseByteArrayElements(env, data, (int8_t*)data_ref.data, 0);
14239 return (long)ret_conv;
14242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv *env, jclass clz, int64_t this_arg) {
14243 LDKPeerManager this_arg_conv;
14244 this_arg_conv.inner = (void*)(this_arg & (~1));
14245 this_arg_conv.is_owned = false;
14246 PeerManager_process_events(&this_arg_conv);
14249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv *env, jclass clz, int64_t this_arg, int64_t descriptor) {
14250 LDKPeerManager this_arg_conv;
14251 this_arg_conv.inner = (void*)(this_arg & (~1));
14252 this_arg_conv.is_owned = false;
14253 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14254 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
14257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv *env, jclass clz, int64_t this_arg) {
14258 LDKPeerManager this_arg_conv;
14259 this_arg_conv.inner = (void*)(this_arg & (~1));
14260 this_arg_conv.is_owned = false;
14261 PeerManager_timer_tick_occured(&this_arg_conv);
14264 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) {
14265 unsigned char commitment_seed_arr[32];
14266 CHECK((*env)->GetArrayLength(env, commitment_seed) == 32);
14267 (*env)->GetByteArrayRegion(env, commitment_seed, 0, 32, commitment_seed_arr);
14268 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
14269 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
14270 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
14274 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) {
14275 LDKPublicKey per_commitment_point_ref;
14276 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14277 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14278 unsigned char base_secret_arr[32];
14279 CHECK((*env)->GetArrayLength(env, base_secret) == 32);
14280 (*env)->GetByteArrayRegion(env, base_secret, 0, 32, base_secret_arr);
14281 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
14282 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14283 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
14284 return (long)ret_conv;
14287 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) {
14288 LDKPublicKey per_commitment_point_ref;
14289 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14290 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14291 LDKPublicKey base_point_ref;
14292 CHECK((*env)->GetArrayLength(env, base_point) == 33);
14293 (*env)->GetByteArrayRegion(env, base_point, 0, 33, base_point_ref.compressed_form);
14294 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14295 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
14296 return (long)ret_conv;
14299 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) {
14300 unsigned char per_commitment_secret_arr[32];
14301 CHECK((*env)->GetArrayLength(env, per_commitment_secret) == 32);
14302 (*env)->GetByteArrayRegion(env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
14303 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
14304 unsigned char countersignatory_revocation_base_secret_arr[32];
14305 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_secret) == 32);
14306 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
14307 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
14308 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14309 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
14310 return (long)ret_conv;
14313 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) {
14314 LDKPublicKey per_commitment_point_ref;
14315 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14316 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14317 LDKPublicKey countersignatory_revocation_base_point_ref;
14318 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base_point) == 33);
14319 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
14320 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14321 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
14322 return (long)ret_conv;
14325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14326 LDKTxCreationKeys this_ptr_conv;
14327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14329 TxCreationKeys_free(this_ptr_conv);
14332 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14333 LDKTxCreationKeys orig_conv;
14334 orig_conv.inner = (void*)(orig & (~1));
14335 orig_conv.is_owned = false;
14336 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
14337 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14338 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14339 long ret_ref = (long)ret_var.inner;
14340 if (ret_var.is_owned) {
14346 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14347 LDKTxCreationKeys this_ptr_conv;
14348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14349 this_ptr_conv.is_owned = false;
14350 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14351 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
14355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14356 LDKTxCreationKeys this_ptr_conv;
14357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14358 this_ptr_conv.is_owned = false;
14359 LDKPublicKey val_ref;
14360 CHECK((*env)->GetArrayLength(env, val) == 33);
14361 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14362 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
14365 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14366 LDKTxCreationKeys this_ptr_conv;
14367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14368 this_ptr_conv.is_owned = false;
14369 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14370 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
14374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14375 LDKTxCreationKeys this_ptr_conv;
14376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14377 this_ptr_conv.is_owned = false;
14378 LDKPublicKey val_ref;
14379 CHECK((*env)->GetArrayLength(env, val) == 33);
14380 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14381 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
14384 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14385 LDKTxCreationKeys this_ptr_conv;
14386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14387 this_ptr_conv.is_owned = false;
14388 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14389 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
14393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14394 LDKTxCreationKeys this_ptr_conv;
14395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14396 this_ptr_conv.is_owned = false;
14397 LDKPublicKey val_ref;
14398 CHECK((*env)->GetArrayLength(env, val) == 33);
14399 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14400 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
14403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14404 LDKTxCreationKeys this_ptr_conv;
14405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14406 this_ptr_conv.is_owned = false;
14407 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14408 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
14412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14413 LDKTxCreationKeys this_ptr_conv;
14414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14415 this_ptr_conv.is_owned = false;
14416 LDKPublicKey val_ref;
14417 CHECK((*env)->GetArrayLength(env, val) == 33);
14418 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14419 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
14422 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv *env, jclass clz, int64_t this_ptr) {
14423 LDKTxCreationKeys this_ptr_conv;
14424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14425 this_ptr_conv.is_owned = false;
14426 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14427 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
14431 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) {
14432 LDKTxCreationKeys this_ptr_conv;
14433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14434 this_ptr_conv.is_owned = false;
14435 LDKPublicKey val_ref;
14436 CHECK((*env)->GetArrayLength(env, val) == 33);
14437 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14438 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
14441 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) {
14442 LDKPublicKey per_commitment_point_arg_ref;
14443 CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
14444 (*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14445 LDKPublicKey revocation_key_arg_ref;
14446 CHECK((*env)->GetArrayLength(env, revocation_key_arg) == 33);
14447 (*env)->GetByteArrayRegion(env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
14448 LDKPublicKey broadcaster_htlc_key_arg_ref;
14449 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_key_arg) == 33);
14450 (*env)->GetByteArrayRegion(env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
14451 LDKPublicKey countersignatory_htlc_key_arg_ref;
14452 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_key_arg) == 33);
14453 (*env)->GetByteArrayRegion(env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
14454 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
14455 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key_arg) == 33);
14456 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
14457 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);
14458 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14459 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14460 long ret_ref = (long)ret_var.inner;
14461 if (ret_var.is_owned) {
14467 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14468 LDKTxCreationKeys obj_conv;
14469 obj_conv.inner = (void*)(obj & (~1));
14470 obj_conv.is_owned = false;
14471 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
14472 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14473 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14474 CVec_u8Z_free(arg_var);
14478 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14479 LDKu8slice ser_ref;
14480 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14481 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14482 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
14483 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14484 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14485 long ret_ref = (long)ret_var.inner;
14486 if (ret_var.is_owned) {
14489 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14494 LDKChannelPublicKeys this_ptr_conv;
14495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14496 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14497 ChannelPublicKeys_free(this_ptr_conv);
14500 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14501 LDKChannelPublicKeys orig_conv;
14502 orig_conv.inner = (void*)(orig & (~1));
14503 orig_conv.is_owned = false;
14504 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
14505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14507 long ret_ref = (long)ret_var.inner;
14508 if (ret_var.is_owned) {
14514 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
14515 LDKChannelPublicKeys this_ptr_conv;
14516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14517 this_ptr_conv.is_owned = false;
14518 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14519 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
14523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14524 LDKChannelPublicKeys this_ptr_conv;
14525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14526 this_ptr_conv.is_owned = false;
14527 LDKPublicKey val_ref;
14528 CHECK((*env)->GetArrayLength(env, val) == 33);
14529 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14530 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
14533 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14534 LDKChannelPublicKeys this_ptr_conv;
14535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14536 this_ptr_conv.is_owned = false;
14537 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14538 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
14542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14543 LDKChannelPublicKeys this_ptr_conv;
14544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14545 this_ptr_conv.is_owned = false;
14546 LDKPublicKey val_ref;
14547 CHECK((*env)->GetArrayLength(env, val) == 33);
14548 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14549 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
14552 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr) {
14553 LDKChannelPublicKeys this_ptr_conv;
14554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14555 this_ptr_conv.is_owned = false;
14556 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14557 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
14561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14562 LDKChannelPublicKeys this_ptr_conv;
14563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14564 this_ptr_conv.is_owned = false;
14565 LDKPublicKey val_ref;
14566 CHECK((*env)->GetArrayLength(env, val) == 33);
14567 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14568 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
14571 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14572 LDKChannelPublicKeys this_ptr_conv;
14573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14574 this_ptr_conv.is_owned = false;
14575 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14576 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
14580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14581 LDKChannelPublicKeys this_ptr_conv;
14582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14583 this_ptr_conv.is_owned = false;
14584 LDKPublicKey val_ref;
14585 CHECK((*env)->GetArrayLength(env, val) == 33);
14586 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14587 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
14590 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14591 LDKChannelPublicKeys this_ptr_conv;
14592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14593 this_ptr_conv.is_owned = false;
14594 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
14595 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
14599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14600 LDKChannelPublicKeys this_ptr_conv;
14601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14602 this_ptr_conv.is_owned = false;
14603 LDKPublicKey val_ref;
14604 CHECK((*env)->GetArrayLength(env, val) == 33);
14605 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
14606 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
14609 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) {
14610 LDKPublicKey funding_pubkey_arg_ref;
14611 CHECK((*env)->GetArrayLength(env, funding_pubkey_arg) == 33);
14612 (*env)->GetByteArrayRegion(env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
14613 LDKPublicKey revocation_basepoint_arg_ref;
14614 CHECK((*env)->GetArrayLength(env, revocation_basepoint_arg) == 33);
14615 (*env)->GetByteArrayRegion(env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
14616 LDKPublicKey payment_point_arg_ref;
14617 CHECK((*env)->GetArrayLength(env, payment_point_arg) == 33);
14618 (*env)->GetByteArrayRegion(env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
14619 LDKPublicKey delayed_payment_basepoint_arg_ref;
14620 CHECK((*env)->GetArrayLength(env, delayed_payment_basepoint_arg) == 33);
14621 (*env)->GetByteArrayRegion(env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
14622 LDKPublicKey htlc_basepoint_arg_ref;
14623 CHECK((*env)->GetArrayLength(env, htlc_basepoint_arg) == 33);
14624 (*env)->GetByteArrayRegion(env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
14625 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);
14626 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14627 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14628 long ret_ref = (long)ret_var.inner;
14629 if (ret_var.is_owned) {
14635 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv *env, jclass clz, int64_t obj) {
14636 LDKChannelPublicKeys obj_conv;
14637 obj_conv.inner = (void*)(obj & (~1));
14638 obj_conv.is_owned = false;
14639 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
14640 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14641 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14642 CVec_u8Z_free(arg_var);
14646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14647 LDKu8slice ser_ref;
14648 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14649 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14650 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
14651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14653 long ret_ref = (long)ret_var.inner;
14654 if (ret_var.is_owned) {
14657 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14661 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) {
14662 LDKPublicKey per_commitment_point_ref;
14663 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14664 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14665 LDKPublicKey broadcaster_delayed_payment_base_ref;
14666 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_base) == 33);
14667 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
14668 LDKPublicKey broadcaster_htlc_base_ref;
14669 CHECK((*env)->GetArrayLength(env, broadcaster_htlc_base) == 33);
14670 (*env)->GetByteArrayRegion(env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
14671 LDKPublicKey countersignatory_revocation_base_ref;
14672 CHECK((*env)->GetArrayLength(env, countersignatory_revocation_base) == 33);
14673 (*env)->GetByteArrayRegion(env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
14674 LDKPublicKey countersignatory_htlc_base_ref;
14675 CHECK((*env)->GetArrayLength(env, countersignatory_htlc_base) == 33);
14676 (*env)->GetByteArrayRegion(env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
14677 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14678 *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);
14679 return (long)ret_conv;
14682 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) {
14683 LDKPublicKey per_commitment_point_ref;
14684 CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
14685 (*env)->GetByteArrayRegion(env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14686 LDKChannelPublicKeys broadcaster_keys_conv;
14687 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
14688 broadcaster_keys_conv.is_owned = false;
14689 LDKChannelPublicKeys countersignatory_keys_conv;
14690 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
14691 countersignatory_keys_conv.is_owned = false;
14692 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14693 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
14694 return (long)ret_conv;
14697 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) {
14698 LDKPublicKey revocation_key_ref;
14699 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14700 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14701 LDKPublicKey broadcaster_delayed_payment_key_ref;
14702 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14703 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14704 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
14705 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14706 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14707 CVec_u8Z_free(arg_var);
14711 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14712 LDKHTLCOutputInCommitment this_ptr_conv;
14713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14715 HTLCOutputInCommitment_free(this_ptr_conv);
14718 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14719 LDKHTLCOutputInCommitment orig_conv;
14720 orig_conv.inner = (void*)(orig & (~1));
14721 orig_conv.is_owned = false;
14722 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
14723 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14724 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14725 long ret_ref = (long)ret_var.inner;
14726 if (ret_var.is_owned) {
14732 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv *env, jclass clz, int64_t this_ptr) {
14733 LDKHTLCOutputInCommitment this_ptr_conv;
14734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14735 this_ptr_conv.is_owned = false;
14736 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
14740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14741 LDKHTLCOutputInCommitment this_ptr_conv;
14742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14743 this_ptr_conv.is_owned = false;
14744 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
14747 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
14748 LDKHTLCOutputInCommitment this_ptr_conv;
14749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14750 this_ptr_conv.is_owned = false;
14751 int64_t ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
14755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14756 LDKHTLCOutputInCommitment this_ptr_conv;
14757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14758 this_ptr_conv.is_owned = false;
14759 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
14762 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr) {
14763 LDKHTLCOutputInCommitment this_ptr_conv;
14764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14765 this_ptr_conv.is_owned = false;
14766 int32_t ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
14770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
14771 LDKHTLCOutputInCommitment this_ptr_conv;
14772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14773 this_ptr_conv.is_owned = false;
14774 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
14777 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr) {
14778 LDKHTLCOutputInCommitment this_ptr_conv;
14779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14780 this_ptr_conv.is_owned = false;
14781 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
14782 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
14786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
14787 LDKHTLCOutputInCommitment this_ptr_conv;
14788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14789 this_ptr_conv.is_owned = false;
14790 LDKThirtyTwoBytes val_ref;
14791 CHECK((*env)->GetArrayLength(env, val) == 32);
14792 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
14793 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
14796 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv *env, jclass clz, int64_t obj) {
14797 LDKHTLCOutputInCommitment obj_conv;
14798 obj_conv.inner = (void*)(obj & (~1));
14799 obj_conv.is_owned = false;
14800 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
14801 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14802 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14803 CVec_u8Z_free(arg_var);
14807 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
14808 LDKu8slice ser_ref;
14809 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
14810 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
14811 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
14812 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14813 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14814 long ret_ref = (long)ret_var.inner;
14815 if (ret_var.is_owned) {
14818 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
14822 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) {
14823 LDKHTLCOutputInCommitment htlc_conv;
14824 htlc_conv.inner = (void*)(htlc & (~1));
14825 htlc_conv.is_owned = false;
14826 LDKTxCreationKeys keys_conv;
14827 keys_conv.inner = (void*)(keys & (~1));
14828 keys_conv.is_owned = false;
14829 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
14830 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14831 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14832 CVec_u8Z_free(arg_var);
14836 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv *env, jclass clz, int8_tArray broadcaster, int8_tArray countersignatory) {
14837 LDKPublicKey broadcaster_ref;
14838 CHECK((*env)->GetArrayLength(env, broadcaster) == 33);
14839 (*env)->GetByteArrayRegion(env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
14840 LDKPublicKey countersignatory_ref;
14841 CHECK((*env)->GetArrayLength(env, countersignatory) == 33);
14842 (*env)->GetByteArrayRegion(env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
14843 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
14844 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14845 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14846 CVec_u8Z_free(arg_var);
14850 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) {
14851 unsigned char prev_hash_arr[32];
14852 CHECK((*env)->GetArrayLength(env, prev_hash) == 32);
14853 (*env)->GetByteArrayRegion(env, prev_hash, 0, 32, prev_hash_arr);
14854 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
14855 LDKHTLCOutputInCommitment htlc_conv;
14856 htlc_conv.inner = (void*)(htlc & (~1));
14857 htlc_conv.is_owned = false;
14858 LDKPublicKey broadcaster_delayed_payment_key_ref;
14859 CHECK((*env)->GetArrayLength(env, broadcaster_delayed_payment_key) == 33);
14860 (*env)->GetByteArrayRegion(env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14861 LDKPublicKey revocation_key_ref;
14862 CHECK((*env)->GetArrayLength(env, revocation_key) == 33);
14863 (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14864 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
14865 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
14866 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
14867 Transaction_free(arg_var);
14871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
14872 LDKChannelTransactionParameters this_ptr_conv;
14873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14874 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14875 ChannelTransactionParameters_free(this_ptr_conv);
14878 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
14879 LDKChannelTransactionParameters orig_conv;
14880 orig_conv.inner = (void*)(orig & (~1));
14881 orig_conv.is_owned = false;
14882 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
14883 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14884 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14885 long ret_ref = (long)ret_var.inner;
14886 if (ret_var.is_owned) {
14892 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
14893 LDKChannelTransactionParameters this_ptr_conv;
14894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14895 this_ptr_conv.is_owned = false;
14896 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
14897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14899 long ret_ref = (long)ret_var.inner;
14900 if (ret_var.is_owned) {
14906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14907 LDKChannelTransactionParameters this_ptr_conv;
14908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14909 this_ptr_conv.is_owned = false;
14910 LDKChannelPublicKeys val_conv;
14911 val_conv.inner = (void*)(val & (~1));
14912 val_conv.is_owned = (val & 1) || (val == 0);
14913 if (val_conv.inner != NULL)
14914 val_conv = ChannelPublicKeys_clone(&val_conv);
14915 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
14918 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
14919 LDKChannelTransactionParameters this_ptr_conv;
14920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14921 this_ptr_conv.is_owned = false;
14922 int16_t ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
14926 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) {
14927 LDKChannelTransactionParameters this_ptr_conv;
14928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14929 this_ptr_conv.is_owned = false;
14930 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
14933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr) {
14934 LDKChannelTransactionParameters this_ptr_conv;
14935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14936 this_ptr_conv.is_owned = false;
14937 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
14941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
14942 LDKChannelTransactionParameters this_ptr_conv;
14943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14944 this_ptr_conv.is_owned = false;
14945 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
14948 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr) {
14949 LDKChannelTransactionParameters this_ptr_conv;
14950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14951 this_ptr_conv.is_owned = false;
14952 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
14953 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14954 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14955 long ret_ref = (long)ret_var.inner;
14956 if (ret_var.is_owned) {
14962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14963 LDKChannelTransactionParameters this_ptr_conv;
14964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14965 this_ptr_conv.is_owned = false;
14966 LDKCounterpartyChannelTransactionParameters val_conv;
14967 val_conv.inner = (void*)(val & (~1));
14968 val_conv.is_owned = (val & 1) || (val == 0);
14969 if (val_conv.inner != NULL)
14970 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
14971 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
14974 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr) {
14975 LDKChannelTransactionParameters this_ptr_conv;
14976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14977 this_ptr_conv.is_owned = false;
14978 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
14979 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14980 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14981 long ret_ref = (long)ret_var.inner;
14982 if (ret_var.is_owned) {
14988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
14989 LDKChannelTransactionParameters this_ptr_conv;
14990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14991 this_ptr_conv.is_owned = false;
14992 LDKOutPoint val_conv;
14993 val_conv.inner = (void*)(val & (~1));
14994 val_conv.is_owned = (val & 1) || (val == 0);
14995 if (val_conv.inner != NULL)
14996 val_conv = OutPoint_clone(&val_conv);
14997 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
15000 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) {
15001 LDKChannelPublicKeys holder_pubkeys_arg_conv;
15002 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
15003 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
15004 if (holder_pubkeys_arg_conv.inner != NULL)
15005 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
15006 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
15007 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
15008 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
15009 if (counterparty_parameters_arg_conv.inner != NULL)
15010 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
15011 LDKOutPoint funding_outpoint_arg_conv;
15012 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
15013 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
15014 if (funding_outpoint_arg_conv.inner != NULL)
15015 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
15016 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);
15017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15019 long ret_ref = (long)ret_var.inner;
15020 if (ret_var.is_owned) {
15026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15027 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15030 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
15033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15034 LDKCounterpartyChannelTransactionParameters orig_conv;
15035 orig_conv.inner = (void*)(orig & (~1));
15036 orig_conv.is_owned = false;
15037 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
15038 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15039 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15040 long ret_ref = (long)ret_var.inner;
15041 if (ret_var.is_owned) {
15047 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr) {
15048 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15050 this_ptr_conv.is_owned = false;
15051 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
15052 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15053 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15054 long ret_ref = (long)ret_var.inner;
15055 if (ret_var.is_owned) {
15061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15062 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15064 this_ptr_conv.is_owned = false;
15065 LDKChannelPublicKeys val_conv;
15066 val_conv.inner = (void*)(val & (~1));
15067 val_conv.is_owned = (val & 1) || (val == 0);
15068 if (val_conv.inner != NULL)
15069 val_conv = ChannelPublicKeys_clone(&val_conv);
15070 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
15073 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr) {
15074 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15076 this_ptr_conv.is_owned = false;
15077 int16_t ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
15081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
15082 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15084 this_ptr_conv.is_owned = false;
15085 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
15088 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) {
15089 LDKChannelPublicKeys pubkeys_arg_conv;
15090 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
15091 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
15092 if (pubkeys_arg_conv.inner != NULL)
15093 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
15094 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
15095 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15096 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15097 long ret_ref = (long)ret_var.inner;
15098 if (ret_var.is_owned) {
15104 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv *env, jclass clz, int64_t this_arg) {
15105 LDKChannelTransactionParameters this_arg_conv;
15106 this_arg_conv.inner = (void*)(this_arg & (~1));
15107 this_arg_conv.is_owned = false;
15108 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
15112 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15113 LDKChannelTransactionParameters this_arg_conv;
15114 this_arg_conv.inner = (void*)(this_arg & (~1));
15115 this_arg_conv.is_owned = false;
15116 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
15117 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15118 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15119 long ret_ref = (long)ret_var.inner;
15120 if (ret_var.is_owned) {
15126 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv *env, jclass clz, int64_t this_arg) {
15127 LDKChannelTransactionParameters this_arg_conv;
15128 this_arg_conv.inner = (void*)(this_arg & (~1));
15129 this_arg_conv.is_owned = false;
15130 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
15131 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15132 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15133 long ret_ref = (long)ret_var.inner;
15134 if (ret_var.is_owned) {
15140 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15141 LDKCounterpartyChannelTransactionParameters obj_conv;
15142 obj_conv.inner = (void*)(obj & (~1));
15143 obj_conv.is_owned = false;
15144 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
15145 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15146 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15147 CVec_u8Z_free(arg_var);
15151 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15152 LDKu8slice ser_ref;
15153 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15154 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15155 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
15156 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15157 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15158 long ret_ref = (long)ret_var.inner;
15159 if (ret_var.is_owned) {
15162 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15166 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv *env, jclass clz, int64_t obj) {
15167 LDKChannelTransactionParameters obj_conv;
15168 obj_conv.inner = (void*)(obj & (~1));
15169 obj_conv.is_owned = false;
15170 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
15171 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15172 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15173 CVec_u8Z_free(arg_var);
15177 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15178 LDKu8slice ser_ref;
15179 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15180 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15181 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
15182 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15183 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15184 long ret_ref = (long)ret_var.inner;
15185 if (ret_var.is_owned) {
15188 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15193 LDKDirectedChannelTransactionParameters this_ptr_conv;
15194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15196 DirectedChannelTransactionParameters_free(this_ptr_conv);
15199 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15200 LDKDirectedChannelTransactionParameters this_arg_conv;
15201 this_arg_conv.inner = (void*)(this_arg & (~1));
15202 this_arg_conv.is_owned = false;
15203 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
15204 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15205 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15206 long ret_ref = (long)ret_var.inner;
15207 if (ret_var.is_owned) {
15213 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv *env, jclass clz, int64_t this_arg) {
15214 LDKDirectedChannelTransactionParameters this_arg_conv;
15215 this_arg_conv.inner = (void*)(this_arg & (~1));
15216 this_arg_conv.is_owned = false;
15217 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
15218 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15219 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15220 long ret_ref = (long)ret_var.inner;
15221 if (ret_var.is_owned) {
15227 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv *env, jclass clz, int64_t this_arg) {
15228 LDKDirectedChannelTransactionParameters this_arg_conv;
15229 this_arg_conv.inner = (void*)(this_arg & (~1));
15230 this_arg_conv.is_owned = false;
15231 int16_t ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
15235 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv *env, jclass clz, int64_t this_arg) {
15236 LDKDirectedChannelTransactionParameters this_arg_conv;
15237 this_arg_conv.inner = (void*)(this_arg & (~1));
15238 this_arg_conv.is_owned = false;
15239 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
15243 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv *env, jclass clz, int64_t this_arg) {
15244 LDKDirectedChannelTransactionParameters this_arg_conv;
15245 this_arg_conv.inner = (void*)(this_arg & (~1));
15246 this_arg_conv.is_owned = false;
15247 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
15248 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15249 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15250 long ret_ref = (long)ret_var.inner;
15251 if (ret_var.is_owned) {
15257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15258 LDKHolderCommitmentTransaction this_ptr_conv;
15259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15261 HolderCommitmentTransaction_free(this_ptr_conv);
15264 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15265 LDKHolderCommitmentTransaction orig_conv;
15266 orig_conv.inner = (void*)(orig & (~1));
15267 orig_conv.is_owned = false;
15268 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
15269 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15270 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15271 long ret_ref = (long)ret_var.inner;
15272 if (ret_var.is_owned) {
15278 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr) {
15279 LDKHolderCommitmentTransaction this_ptr_conv;
15280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15281 this_ptr_conv.is_owned = false;
15282 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15283 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
15287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15288 LDKHolderCommitmentTransaction this_ptr_conv;
15289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15290 this_ptr_conv.is_owned = false;
15291 LDKSignature val_ref;
15292 CHECK((*env)->GetArrayLength(env, val) == 64);
15293 (*env)->GetByteArrayRegion(env, val, 0, 64, val_ref.compact_form);
15294 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
15297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15298 LDKHolderCommitmentTransaction this_ptr_conv;
15299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15300 this_ptr_conv.is_owned = false;
15301 LDKCVec_SignatureZ val_constr;
15302 val_constr.datalen = (*env)->GetArrayLength(env, val);
15303 if (val_constr.datalen > 0)
15304 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15306 val_constr.data = NULL;
15307 for (size_t i = 0; i < val_constr.datalen; i++) {
15308 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, val, i);
15309 LDKSignature arr_conv_8_ref;
15310 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15311 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15312 val_constr.data[i] = arr_conv_8_ref;
15314 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
15317 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15318 LDKHolderCommitmentTransaction obj_conv;
15319 obj_conv.inner = (void*)(obj & (~1));
15320 obj_conv.is_owned = false;
15321 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
15322 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15323 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15324 CVec_u8Z_free(arg_var);
15328 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15329 LDKu8slice ser_ref;
15330 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15331 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15332 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
15333 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15334 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15335 long ret_ref = (long)ret_var.inner;
15336 if (ret_var.is_owned) {
15339 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15343 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) {
15344 LDKCommitmentTransaction commitment_tx_conv;
15345 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
15346 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
15347 if (commitment_tx_conv.inner != NULL)
15348 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
15349 LDKSignature counterparty_sig_ref;
15350 CHECK((*env)->GetArrayLength(env, counterparty_sig) == 64);
15351 (*env)->GetByteArrayRegion(env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
15352 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
15353 counterparty_htlc_sigs_constr.datalen = (*env)->GetArrayLength(env, counterparty_htlc_sigs);
15354 if (counterparty_htlc_sigs_constr.datalen > 0)
15355 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15357 counterparty_htlc_sigs_constr.data = NULL;
15358 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
15359 int8_tArray arr_conv_8 = (*env)->GetObjectArrayElement(env, counterparty_htlc_sigs, i);
15360 LDKSignature arr_conv_8_ref;
15361 CHECK((*env)->GetArrayLength(env, arr_conv_8) == 64);
15362 (*env)->GetByteArrayRegion(env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15363 counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref;
15365 LDKPublicKey holder_funding_key_ref;
15366 CHECK((*env)->GetArrayLength(env, holder_funding_key) == 33);
15367 (*env)->GetByteArrayRegion(env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
15368 LDKPublicKey counterparty_funding_key_ref;
15369 CHECK((*env)->GetArrayLength(env, counterparty_funding_key) == 33);
15370 (*env)->GetByteArrayRegion(env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
15371 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
15372 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15373 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15374 long ret_ref = (long)ret_var.inner;
15375 if (ret_var.is_owned) {
15381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15382 LDKBuiltCommitmentTransaction this_ptr_conv;
15383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15385 BuiltCommitmentTransaction_free(this_ptr_conv);
15388 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15389 LDKBuiltCommitmentTransaction orig_conv;
15390 orig_conv.inner = (void*)(orig & (~1));
15391 orig_conv.is_owned = false;
15392 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
15393 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15394 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15395 long ret_ref = (long)ret_var.inner;
15396 if (ret_var.is_owned) {
15402 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr) {
15403 LDKBuiltCommitmentTransaction this_ptr_conv;
15404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15405 this_ptr_conv.is_owned = false;
15406 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
15407 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15408 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15409 Transaction_free(arg_var);
15413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15414 LDKBuiltCommitmentTransaction this_ptr_conv;
15415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15416 this_ptr_conv.is_owned = false;
15417 LDKTransaction val_ref;
15418 val_ref.datalen = (*env)->GetArrayLength(env, val);
15419 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
15420 (*env)->GetByteArrayRegion(env, val, 0, val_ref.datalen, val_ref.data);
15421 val_ref.data_is_owned = true;
15422 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
15425 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv *env, jclass clz, int64_t this_ptr) {
15426 LDKBuiltCommitmentTransaction this_ptr_conv;
15427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15428 this_ptr_conv.is_owned = false;
15429 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
15430 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
15434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15435 LDKBuiltCommitmentTransaction this_ptr_conv;
15436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15437 this_ptr_conv.is_owned = false;
15438 LDKThirtyTwoBytes val_ref;
15439 CHECK((*env)->GetArrayLength(env, val) == 32);
15440 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
15441 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
15444 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv *env, jclass clz, int8_tArray transaction_arg, int8_tArray txid_arg) {
15445 LDKTransaction transaction_arg_ref;
15446 transaction_arg_ref.datalen = (*env)->GetArrayLength(env, transaction_arg);
15447 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
15448 (*env)->GetByteArrayRegion(env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
15449 transaction_arg_ref.data_is_owned = true;
15450 LDKThirtyTwoBytes txid_arg_ref;
15451 CHECK((*env)->GetArrayLength(env, txid_arg) == 32);
15452 (*env)->GetByteArrayRegion(env, txid_arg, 0, 32, txid_arg_ref.data);
15453 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
15454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15456 long ret_ref = (long)ret_var.inner;
15457 if (ret_var.is_owned) {
15463 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15464 LDKBuiltCommitmentTransaction obj_conv;
15465 obj_conv.inner = (void*)(obj & (~1));
15466 obj_conv.is_owned = false;
15467 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
15468 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15469 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15470 CVec_u8Z_free(arg_var);
15474 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15475 LDKu8slice ser_ref;
15476 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15477 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15478 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
15479 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15480 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15481 long ret_ref = (long)ret_var.inner;
15482 if (ret_var.is_owned) {
15485 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15489 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) {
15490 LDKBuiltCommitmentTransaction this_arg_conv;
15491 this_arg_conv.inner = (void*)(this_arg & (~1));
15492 this_arg_conv.is_owned = false;
15493 LDKu8slice funding_redeemscript_ref;
15494 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15495 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15496 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15497 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
15498 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15502 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) {
15503 LDKBuiltCommitmentTransaction this_arg_conv;
15504 this_arg_conv.inner = (void*)(this_arg & (~1));
15505 this_arg_conv.is_owned = false;
15506 unsigned char funding_key_arr[32];
15507 CHECK((*env)->GetArrayLength(env, funding_key) == 32);
15508 (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
15509 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
15510 LDKu8slice funding_redeemscript_ref;
15511 funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
15512 funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
15513 int8_tArray arg_arr = (*env)->NewByteArray(env, 64);
15514 (*env)->SetByteArrayRegion(env, arg_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
15515 (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15520 LDKCommitmentTransaction this_ptr_conv;
15521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15523 CommitmentTransaction_free(this_ptr_conv);
15526 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15527 LDKCommitmentTransaction orig_conv;
15528 orig_conv.inner = (void*)(orig & (~1));
15529 orig_conv.is_owned = false;
15530 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
15531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15533 long ret_ref = (long)ret_var.inner;
15534 if (ret_var.is_owned) {
15540 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
15541 LDKCommitmentTransaction obj_conv;
15542 obj_conv.inner = (void*)(obj & (~1));
15543 obj_conv.is_owned = false;
15544 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
15545 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15546 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15547 CVec_u8Z_free(arg_var);
15551 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15552 LDKu8slice ser_ref;
15553 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15554 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15555 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
15556 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15557 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15558 long ret_ref = (long)ret_var.inner;
15559 if (ret_var.is_owned) {
15562 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15566 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv *env, jclass clz, int64_t this_arg) {
15567 LDKCommitmentTransaction this_arg_conv;
15568 this_arg_conv.inner = (void*)(this_arg & (~1));
15569 this_arg_conv.is_owned = false;
15570 int64_t ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
15574 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15575 LDKCommitmentTransaction this_arg_conv;
15576 this_arg_conv.inner = (void*)(this_arg & (~1));
15577 this_arg_conv.is_owned = false;
15578 int64_t ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
15582 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
15583 LDKCommitmentTransaction this_arg_conv;
15584 this_arg_conv.inner = (void*)(this_arg & (~1));
15585 this_arg_conv.is_owned = false;
15586 int64_t ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
15590 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv *env, jclass clz, int64_t this_arg) {
15591 LDKCommitmentTransaction this_arg_conv;
15592 this_arg_conv.inner = (void*)(this_arg & (~1));
15593 this_arg_conv.is_owned = false;
15594 int32_t ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
15598 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
15599 LDKCommitmentTransaction this_arg_conv;
15600 this_arg_conv.inner = (void*)(this_arg & (~1));
15601 this_arg_conv.is_owned = false;
15602 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
15603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15605 long ret_ref = (long)ret_var.inner;
15606 if (ret_var.is_owned) {
15612 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) {
15613 LDKCommitmentTransaction this_arg_conv;
15614 this_arg_conv.inner = (void*)(this_arg & (~1));
15615 this_arg_conv.is_owned = false;
15616 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15617 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15618 channel_parameters_conv.is_owned = false;
15619 LDKChannelPublicKeys broadcaster_keys_conv;
15620 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
15621 broadcaster_keys_conv.is_owned = false;
15622 LDKChannelPublicKeys countersignatory_keys_conv;
15623 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
15624 countersignatory_keys_conv.is_owned = false;
15625 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15626 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
15627 return (long)ret_conv;
15630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15631 LDKTrustedCommitmentTransaction this_ptr_conv;
15632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15634 TrustedCommitmentTransaction_free(this_ptr_conv);
15637 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv *env, jclass clz, int64_t this_arg) {
15638 LDKTrustedCommitmentTransaction this_arg_conv;
15639 this_arg_conv.inner = (void*)(this_arg & (~1));
15640 this_arg_conv.is_owned = false;
15641 int8_tArray arg_arr = (*env)->NewByteArray(env, 32);
15642 (*env)->SetByteArrayRegion(env, arg_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
15646 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
15647 LDKTrustedCommitmentTransaction this_arg_conv;
15648 this_arg_conv.inner = (void*)(this_arg & (~1));
15649 this_arg_conv.is_owned = false;
15650 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
15651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15653 long ret_ref = (long)ret_var.inner;
15654 if (ret_var.is_owned) {
15660 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv *env, jclass clz, int64_t this_arg) {
15661 LDKTrustedCommitmentTransaction this_arg_conv;
15662 this_arg_conv.inner = (void*)(this_arg & (~1));
15663 this_arg_conv.is_owned = false;
15664 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_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 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) {
15675 LDKTrustedCommitmentTransaction this_arg_conv;
15676 this_arg_conv.inner = (void*)(this_arg & (~1));
15677 this_arg_conv.is_owned = false;
15678 unsigned char htlc_base_key_arr[32];
15679 CHECK((*env)->GetArrayLength(env, htlc_base_key) == 32);
15680 (*env)->GetByteArrayRegion(env, htlc_base_key, 0, 32, htlc_base_key_arr);
15681 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
15682 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15683 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15684 channel_parameters_conv.is_owned = false;
15685 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15686 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
15687 return (long)ret_conv;
15690 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) {
15691 LDKPublicKey broadcaster_payment_basepoint_ref;
15692 CHECK((*env)->GetArrayLength(env, broadcaster_payment_basepoint) == 33);
15693 (*env)->GetByteArrayRegion(env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
15694 LDKPublicKey countersignatory_payment_basepoint_ref;
15695 CHECK((*env)->GetArrayLength(env, countersignatory_payment_basepoint) == 33);
15696 (*env)->GetByteArrayRegion(env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
15697 int64_t ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
15701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15702 LDKInitFeatures this_ptr_conv;
15703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15704 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15705 InitFeatures_free(this_ptr_conv);
15708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15709 LDKNodeFeatures this_ptr_conv;
15710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15712 NodeFeatures_free(this_ptr_conv);
15715 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15716 LDKChannelFeatures this_ptr_conv;
15717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15719 ChannelFeatures_free(this_ptr_conv);
15722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15723 LDKRouteHop this_ptr_conv;
15724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15725 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15726 RouteHop_free(this_ptr_conv);
15729 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15730 LDKRouteHop orig_conv;
15731 orig_conv.inner = (void*)(orig & (~1));
15732 orig_conv.is_owned = false;
15733 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
15734 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15735 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15736 long ret_ref = (long)ret_var.inner;
15737 if (ret_var.is_owned) {
15743 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr) {
15744 LDKRouteHop this_ptr_conv;
15745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15746 this_ptr_conv.is_owned = false;
15747 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
15748 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
15752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
15753 LDKRouteHop this_ptr_conv;
15754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15755 this_ptr_conv.is_owned = false;
15756 LDKPublicKey val_ref;
15757 CHECK((*env)->GetArrayLength(env, val) == 33);
15758 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
15759 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
15762 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15763 LDKRouteHop this_ptr_conv;
15764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15765 this_ptr_conv.is_owned = false;
15766 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
15767 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15768 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15769 long ret_ref = (long)ret_var.inner;
15770 if (ret_var.is_owned) {
15776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15777 LDKRouteHop this_ptr_conv;
15778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15779 this_ptr_conv.is_owned = false;
15780 LDKNodeFeatures val_conv;
15781 val_conv.inner = (void*)(val & (~1));
15782 val_conv.is_owned = (val & 1) || (val == 0);
15783 // Warning: we may need a move here but can't clone!
15784 RouteHop_set_node_features(&this_ptr_conv, val_conv);
15787 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
15788 LDKRouteHop this_ptr_conv;
15789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15790 this_ptr_conv.is_owned = false;
15791 int64_t ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
15795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15796 LDKRouteHop this_ptr_conv;
15797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15798 this_ptr_conv.is_owned = false;
15799 RouteHop_set_short_channel_id(&this_ptr_conv, val);
15802 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
15803 LDKRouteHop this_ptr_conv;
15804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15805 this_ptr_conv.is_owned = false;
15806 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
15807 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15808 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15809 long ret_ref = (long)ret_var.inner;
15810 if (ret_var.is_owned) {
15816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15817 LDKRouteHop this_ptr_conv;
15818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15819 this_ptr_conv.is_owned = false;
15820 LDKChannelFeatures val_conv;
15821 val_conv.inner = (void*)(val & (~1));
15822 val_conv.is_owned = (val & 1) || (val == 0);
15823 // Warning: we may need a move here but can't clone!
15824 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
15827 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
15828 LDKRouteHop this_ptr_conv;
15829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15830 this_ptr_conv.is_owned = false;
15831 int64_t ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
15835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
15836 LDKRouteHop this_ptr_conv;
15837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15838 this_ptr_conv.is_owned = false;
15839 RouteHop_set_fee_msat(&this_ptr_conv, val);
15842 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
15843 LDKRouteHop this_ptr_conv;
15844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15845 this_ptr_conv.is_owned = false;
15846 int32_t ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
15850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
15851 LDKRouteHop this_ptr_conv;
15852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15853 this_ptr_conv.is_owned = false;
15854 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
15857 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) {
15858 LDKPublicKey pubkey_arg_ref;
15859 CHECK((*env)->GetArrayLength(env, pubkey_arg) == 33);
15860 (*env)->GetByteArrayRegion(env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
15861 LDKNodeFeatures node_features_arg_conv;
15862 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
15863 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
15864 // Warning: we may need a move here but can't clone!
15865 LDKChannelFeatures channel_features_arg_conv;
15866 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
15867 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
15868 // Warning: we may need a move here but can't clone!
15869 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);
15870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15872 long ret_ref = (long)ret_var.inner;
15873 if (ret_var.is_owned) {
15879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15880 LDKRoute this_ptr_conv;
15881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15883 Route_free(this_ptr_conv);
15886 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv *env, jclass clz, int64_t orig) {
15887 LDKRoute orig_conv;
15888 orig_conv.inner = (void*)(orig & (~1));
15889 orig_conv.is_owned = false;
15890 LDKRoute ret_var = Route_clone(&orig_conv);
15891 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15892 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15893 long ret_ref = (long)ret_var.inner;
15894 if (ret_var.is_owned) {
15900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
15901 LDKRoute this_ptr_conv;
15902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15903 this_ptr_conv.is_owned = false;
15904 LDKCVec_CVec_RouteHopZZ val_constr;
15905 val_constr.datalen = (*env)->GetArrayLength(env, val);
15906 if (val_constr.datalen > 0)
15907 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15909 val_constr.data = NULL;
15910 for (size_t m = 0; m < val_constr.datalen; m++) {
15911 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, val, m);
15912 LDKCVec_RouteHopZ arr_conv_12_constr;
15913 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15914 if (arr_conv_12_constr.datalen > 0)
15915 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15917 arr_conv_12_constr.data = NULL;
15918 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15919 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15920 int64_t arr_conv_10 = arr_conv_12_vals[k];
15921 LDKRouteHop arr_conv_10_conv;
15922 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15923 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15924 if (arr_conv_10_conv.inner != NULL)
15925 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15926 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15928 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15929 val_constr.data[m] = arr_conv_12_constr;
15931 Route_set_paths(&this_ptr_conv, val_constr);
15934 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv *env, jclass clz, jobjectArray paths_arg) {
15935 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
15936 paths_arg_constr.datalen = (*env)->GetArrayLength(env, paths_arg);
15937 if (paths_arg_constr.datalen > 0)
15938 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15940 paths_arg_constr.data = NULL;
15941 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
15942 int64_tArray arr_conv_12 = (*env)->GetObjectArrayElement(env, paths_arg, m);
15943 LDKCVec_RouteHopZ arr_conv_12_constr;
15944 arr_conv_12_constr.datalen = (*env)->GetArrayLength(env, arr_conv_12);
15945 if (arr_conv_12_constr.datalen > 0)
15946 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15948 arr_conv_12_constr.data = NULL;
15949 int64_t* arr_conv_12_vals = (*env)->GetLongArrayElements (env, arr_conv_12, NULL);
15950 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15951 int64_t arr_conv_10 = arr_conv_12_vals[k];
15952 LDKRouteHop arr_conv_10_conv;
15953 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15954 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15955 if (arr_conv_10_conv.inner != NULL)
15956 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
15957 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15959 (*env)->ReleaseLongArrayElements(env, arr_conv_12, arr_conv_12_vals, 0);
15960 paths_arg_constr.data[m] = arr_conv_12_constr;
15962 LDKRoute ret_var = Route_new(paths_arg_constr);
15963 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15964 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15965 long ret_ref = (long)ret_var.inner;
15966 if (ret_var.is_owned) {
15972 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
15974 obj_conv.inner = (void*)(obj & (~1));
15975 obj_conv.is_owned = false;
15976 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
15977 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
15978 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
15979 CVec_u8Z_free(arg_var);
15983 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
15984 LDKu8slice ser_ref;
15985 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
15986 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
15987 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15988 *ret_conv = Route_read(ser_ref);
15989 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
15990 return (long)ret_conv;
15993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
15994 LDKRouteHint this_ptr_conv;
15995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15997 RouteHint_free(this_ptr_conv);
16000 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16001 LDKRouteHint orig_conv;
16002 orig_conv.inner = (void*)(orig & (~1));
16003 orig_conv.is_owned = false;
16004 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
16005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16007 long ret_ref = (long)ret_var.inner;
16008 if (ret_var.is_owned) {
16014 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16015 LDKRouteHint this_ptr_conv;
16016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16017 this_ptr_conv.is_owned = false;
16018 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16019 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
16023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16024 LDKRouteHint this_ptr_conv;
16025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16026 this_ptr_conv.is_owned = false;
16027 LDKPublicKey val_ref;
16028 CHECK((*env)->GetArrayLength(env, val) == 33);
16029 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16030 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
16033 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr) {
16034 LDKRouteHint this_ptr_conv;
16035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16036 this_ptr_conv.is_owned = false;
16037 int64_t ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
16041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16042 LDKRouteHint this_ptr_conv;
16043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16044 this_ptr_conv.is_owned = false;
16045 RouteHint_set_short_channel_id(&this_ptr_conv, val);
16048 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16049 LDKRouteHint this_ptr_conv;
16050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16051 this_ptr_conv.is_owned = false;
16052 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
16053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16055 long ret_ref = (long)ret_var.inner;
16056 if (ret_var.is_owned) {
16062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16063 LDKRouteHint this_ptr_conv;
16064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16065 this_ptr_conv.is_owned = false;
16066 LDKRoutingFees val_conv;
16067 val_conv.inner = (void*)(val & (~1));
16068 val_conv.is_owned = (val & 1) || (val == 0);
16069 if (val_conv.inner != NULL)
16070 val_conv = RoutingFees_clone(&val_conv);
16071 RouteHint_set_fees(&this_ptr_conv, val_conv);
16074 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16075 LDKRouteHint this_ptr_conv;
16076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16077 this_ptr_conv.is_owned = false;
16078 int16_t ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
16082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16083 LDKRouteHint this_ptr_conv;
16084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16085 this_ptr_conv.is_owned = false;
16086 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
16089 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16090 LDKRouteHint this_ptr_conv;
16091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16092 this_ptr_conv.is_owned = false;
16093 int64_t ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
16097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16098 LDKRouteHint this_ptr_conv;
16099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16100 this_ptr_conv.is_owned = false;
16101 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
16104 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) {
16105 LDKPublicKey src_node_id_arg_ref;
16106 CHECK((*env)->GetArrayLength(env, src_node_id_arg) == 33);
16107 (*env)->GetByteArrayRegion(env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
16108 LDKRoutingFees fees_arg_conv;
16109 fees_arg_conv.inner = (void*)(fees_arg & (~1));
16110 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
16111 if (fees_arg_conv.inner != NULL)
16112 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
16113 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);
16114 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16115 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16116 long ret_ref = (long)ret_var.inner;
16117 if (ret_var.is_owned) {
16123 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) {
16124 LDKPublicKey our_node_id_ref;
16125 CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
16126 (*env)->GetByteArrayRegion(env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
16127 LDKNetworkGraph network_conv;
16128 network_conv.inner = (void*)(network & (~1));
16129 network_conv.is_owned = false;
16130 LDKPublicKey target_ref;
16131 CHECK((*env)->GetArrayLength(env, target) == 33);
16132 (*env)->GetByteArrayRegion(env, target, 0, 33, target_ref.compressed_form);
16133 LDKCVec_ChannelDetailsZ first_hops_constr;
16134 first_hops_constr.datalen = (*env)->GetArrayLength(env, first_hops);
16135 if (first_hops_constr.datalen > 0)
16136 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16138 first_hops_constr.data = NULL;
16139 int64_t* first_hops_vals = (*env)->GetLongArrayElements (env, first_hops, NULL);
16140 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
16141 int64_t arr_conv_16 = first_hops_vals[q];
16142 LDKChannelDetails arr_conv_16_conv;
16143 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
16144 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
16145 first_hops_constr.data[q] = arr_conv_16_conv;
16147 (*env)->ReleaseLongArrayElements(env, first_hops, first_hops_vals, 0);
16148 LDKCVec_RouteHintZ last_hops_constr;
16149 last_hops_constr.datalen = (*env)->GetArrayLength(env, last_hops);
16150 if (last_hops_constr.datalen > 0)
16151 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16153 last_hops_constr.data = NULL;
16154 int64_t* last_hops_vals = (*env)->GetLongArrayElements (env, last_hops, NULL);
16155 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
16156 int64_t arr_conv_11 = last_hops_vals[l];
16157 LDKRouteHint arr_conv_11_conv;
16158 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
16159 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
16160 if (arr_conv_11_conv.inner != NULL)
16161 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
16162 last_hops_constr.data[l] = arr_conv_11_conv;
16164 (*env)->ReleaseLongArrayElements(env, last_hops, last_hops_vals, 0);
16165 LDKLogger logger_conv = *(LDKLogger*)logger;
16166 if (logger_conv.free == LDKLogger_JCalls_free) {
16167 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16168 LDKLogger_JCalls_clone(logger_conv.this_arg);
16170 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16171 *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);
16172 FREE(first_hops_constr.data);
16173 return (long)ret_conv;
16176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16177 LDKNetworkGraph this_ptr_conv;
16178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16179 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16180 NetworkGraph_free(this_ptr_conv);
16183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16184 LDKLockedNetworkGraph this_ptr_conv;
16185 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16186 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16187 LockedNetworkGraph_free(this_ptr_conv);
16190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16191 LDKNetGraphMsgHandler this_ptr_conv;
16192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16194 NetGraphMsgHandler_free(this_ptr_conv);
16197 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) {
16198 LDKThirtyTwoBytes genesis_hash_ref;
16199 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
16200 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
16201 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16202 LDKLogger logger_conv = *(LDKLogger*)logger;
16203 if (logger_conv.free == LDKLogger_JCalls_free) {
16204 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16205 LDKLogger_JCalls_clone(logger_conv.this_arg);
16207 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
16208 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16209 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16210 long ret_ref = (long)ret_var.inner;
16211 if (ret_var.is_owned) {
16217 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) {
16218 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16219 LDKLogger logger_conv = *(LDKLogger*)logger;
16220 if (logger_conv.free == LDKLogger_JCalls_free) {
16221 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16222 LDKLogger_JCalls_clone(logger_conv.this_arg);
16224 LDKNetworkGraph network_graph_conv;
16225 network_graph_conv.inner = (void*)(network_graph & (~1));
16226 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
16227 // Warning: we may need a move here but can't clone!
16228 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
16229 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16230 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16231 long ret_ref = (long)ret_var.inner;
16232 if (ret_var.is_owned) {
16238 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16239 LDKNetGraphMsgHandler this_arg_conv;
16240 this_arg_conv.inner = (void*)(this_arg & (~1));
16241 this_arg_conv.is_owned = false;
16242 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
16243 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16244 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16245 long ret_ref = (long)ret_var.inner;
16246 if (ret_var.is_owned) {
16252 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
16253 LDKLockedNetworkGraph this_arg_conv;
16254 this_arg_conv.inner = (void*)(this_arg & (~1));
16255 this_arg_conv.is_owned = false;
16256 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
16257 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16258 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16259 long ret_ref = (long)ret_var.inner;
16260 if (ret_var.is_owned) {
16266 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
16267 LDKNetGraphMsgHandler this_arg_conv;
16268 this_arg_conv.inner = (void*)(this_arg & (~1));
16269 this_arg_conv.is_owned = false;
16270 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16271 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
16275 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
16276 LDKNetGraphMsgHandler this_arg_conv;
16277 this_arg_conv.inner = (void*)(this_arg & (~1));
16278 this_arg_conv.is_owned = false;
16279 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16280 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
16284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16285 LDKDirectionalChannelInfo this_ptr_conv;
16286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16288 DirectionalChannelInfo_free(this_ptr_conv);
16291 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16292 LDKDirectionalChannelInfo this_ptr_conv;
16293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16294 this_ptr_conv.is_owned = false;
16295 int32_t ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
16299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16300 LDKDirectionalChannelInfo this_ptr_conv;
16301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16302 this_ptr_conv.is_owned = false;
16303 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
16306 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr) {
16307 LDKDirectionalChannelInfo this_ptr_conv;
16308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16309 this_ptr_conv.is_owned = false;
16310 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
16314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) {
16315 LDKDirectionalChannelInfo this_ptr_conv;
16316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16317 this_ptr_conv.is_owned = false;
16318 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
16321 JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
16322 LDKDirectionalChannelInfo this_ptr_conv;
16323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16324 this_ptr_conv.is_owned = false;
16325 int16_t ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
16329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
16330 LDKDirectionalChannelInfo this_ptr_conv;
16331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16332 this_ptr_conv.is_owned = false;
16333 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
16336 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16337 LDKDirectionalChannelInfo this_ptr_conv;
16338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16339 this_ptr_conv.is_owned = false;
16340 int64_t ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
16344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16345 LDKDirectionalChannelInfo this_ptr_conv;
16346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16347 this_ptr_conv.is_owned = false;
16348 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
16351 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16352 LDKDirectionalChannelInfo this_ptr_conv;
16353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16354 this_ptr_conv.is_owned = false;
16355 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
16356 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16357 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16358 long ret_ref = (long)ret_var.inner;
16359 if (ret_var.is_owned) {
16365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16366 LDKDirectionalChannelInfo this_ptr_conv;
16367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16368 this_ptr_conv.is_owned = false;
16369 LDKRoutingFees val_conv;
16370 val_conv.inner = (void*)(val & (~1));
16371 val_conv.is_owned = (val & 1) || (val == 0);
16372 if (val_conv.inner != NULL)
16373 val_conv = RoutingFees_clone(&val_conv);
16374 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
16377 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16378 LDKDirectionalChannelInfo this_ptr_conv;
16379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16380 this_ptr_conv.is_owned = false;
16381 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
16382 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16383 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16384 long ret_ref = (long)ret_var.inner;
16385 if (ret_var.is_owned) {
16391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16392 LDKDirectionalChannelInfo this_ptr_conv;
16393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16394 this_ptr_conv.is_owned = false;
16395 LDKChannelUpdate val_conv;
16396 val_conv.inner = (void*)(val & (~1));
16397 val_conv.is_owned = (val & 1) || (val == 0);
16398 if (val_conv.inner != NULL)
16399 val_conv = ChannelUpdate_clone(&val_conv);
16400 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
16403 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16404 LDKDirectionalChannelInfo obj_conv;
16405 obj_conv.inner = (void*)(obj & (~1));
16406 obj_conv.is_owned = false;
16407 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
16408 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16409 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16410 CVec_u8Z_free(arg_var);
16414 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16415 LDKu8slice ser_ref;
16416 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16417 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16418 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
16419 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16420 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16421 long ret_ref = (long)ret_var.inner;
16422 if (ret_var.is_owned) {
16425 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16430 LDKChannelInfo this_ptr_conv;
16431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16433 ChannelInfo_free(this_ptr_conv);
16436 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(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 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
16441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16443 long ret_ref = (long)ret_var.inner;
16444 if (ret_var.is_owned) {
16450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16451 LDKChannelInfo this_ptr_conv;
16452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16453 this_ptr_conv.is_owned = false;
16454 LDKChannelFeatures val_conv;
16455 val_conv.inner = (void*)(val & (~1));
16456 val_conv.is_owned = (val & 1) || (val == 0);
16457 // Warning: we may need a move here but can't clone!
16458 ChannelInfo_set_features(&this_ptr_conv, val_conv);
16461 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16462 LDKChannelInfo this_ptr_conv;
16463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16464 this_ptr_conv.is_owned = false;
16465 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16466 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
16470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16471 LDKChannelInfo this_ptr_conv;
16472 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16473 this_ptr_conv.is_owned = false;
16474 LDKPublicKey val_ref;
16475 CHECK((*env)->GetArrayLength(env, val) == 33);
16476 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16477 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
16480 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(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 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&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_1one_1to_1two(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 LDKDirectionalChannelInfo val_conv;
16499 val_conv.inner = (void*)(val & (~1));
16500 val_conv.is_owned = (val & 1) || (val == 0);
16501 // Warning: we may need a move here but can't clone!
16502 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
16505 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr) {
16506 LDKChannelInfo this_ptr_conv;
16507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16508 this_ptr_conv.is_owned = false;
16509 int8_tArray arg_arr = (*env)->NewByteArray(env, 33);
16510 (*env)->SetByteArrayRegion(env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
16514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16515 LDKChannelInfo this_ptr_conv;
16516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16517 this_ptr_conv.is_owned = false;
16518 LDKPublicKey val_ref;
16519 CHECK((*env)->GetArrayLength(env, val) == 33);
16520 (*env)->GetByteArrayRegion(env, val, 0, 33, val_ref.compressed_form);
16521 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
16524 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr) {
16525 LDKChannelInfo this_ptr_conv;
16526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16527 this_ptr_conv.is_owned = false;
16528 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
16529 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16530 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16531 long ret_ref = (long)ret_var.inner;
16532 if (ret_var.is_owned) {
16538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16539 LDKChannelInfo this_ptr_conv;
16540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16541 this_ptr_conv.is_owned = false;
16542 LDKDirectionalChannelInfo val_conv;
16543 val_conv.inner = (void*)(val & (~1));
16544 val_conv.is_owned = (val & 1) || (val == 0);
16545 // Warning: we may need a move here but can't clone!
16546 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
16549 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16550 LDKChannelInfo this_ptr_conv;
16551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16552 this_ptr_conv.is_owned = false;
16553 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
16554 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16555 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16556 long ret_ref = (long)ret_var.inner;
16557 if (ret_var.is_owned) {
16563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16564 LDKChannelInfo this_ptr_conv;
16565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16566 this_ptr_conv.is_owned = false;
16567 LDKChannelAnnouncement val_conv;
16568 val_conv.inner = (void*)(val & (~1));
16569 val_conv.is_owned = (val & 1) || (val == 0);
16570 if (val_conv.inner != NULL)
16571 val_conv = ChannelAnnouncement_clone(&val_conv);
16572 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
16575 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16576 LDKChannelInfo obj_conv;
16577 obj_conv.inner = (void*)(obj & (~1));
16578 obj_conv.is_owned = false;
16579 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
16580 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16581 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16582 CVec_u8Z_free(arg_var);
16586 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16587 LDKu8slice ser_ref;
16588 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16589 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16590 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
16591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16593 long ret_ref = (long)ret_var.inner;
16594 if (ret_var.is_owned) {
16597 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16602 LDKRoutingFees this_ptr_conv;
16603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16605 RoutingFees_free(this_ptr_conv);
16608 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv *env, jclass clz, int64_t orig) {
16609 LDKRoutingFees orig_conv;
16610 orig_conv.inner = (void*)(orig & (~1));
16611 orig_conv.is_owned = false;
16612 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
16613 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16614 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16615 long ret_ref = (long)ret_var.inner;
16616 if (ret_var.is_owned) {
16622 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
16623 LDKRoutingFees this_ptr_conv;
16624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16625 this_ptr_conv.is_owned = false;
16626 int32_t ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
16630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16631 LDKRoutingFees this_ptr_conv;
16632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16633 this_ptr_conv.is_owned = false;
16634 RoutingFees_set_base_msat(&this_ptr_conv, val);
16637 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
16638 LDKRoutingFees this_ptr_conv;
16639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16640 this_ptr_conv.is_owned = false;
16641 int32_t ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
16645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16646 LDKRoutingFees this_ptr_conv;
16647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16648 this_ptr_conv.is_owned = false;
16649 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
16652 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) {
16653 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
16654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16656 long ret_ref = (long)ret_var.inner;
16657 if (ret_var.is_owned) {
16663 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16664 LDKu8slice ser_ref;
16665 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16666 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16667 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16668 *ret_conv = RoutingFees_read(ser_ref);
16669 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16670 return (long)ret_conv;
16673 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
16674 LDKRoutingFees obj_conv;
16675 obj_conv.inner = (void*)(obj & (~1));
16676 obj_conv.is_owned = false;
16677 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
16678 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16679 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16680 CVec_u8Z_free(arg_var);
16684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16685 LDKNodeAnnouncementInfo this_ptr_conv;
16686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16688 NodeAnnouncementInfo_free(this_ptr_conv);
16691 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv *env, jclass clz, int64_t this_ptr) {
16692 LDKNodeAnnouncementInfo this_ptr_conv;
16693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16694 this_ptr_conv.is_owned = false;
16695 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
16696 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16697 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16698 long ret_ref = (long)ret_var.inner;
16699 if (ret_var.is_owned) {
16705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16706 LDKNodeAnnouncementInfo this_ptr_conv;
16707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16708 this_ptr_conv.is_owned = false;
16709 LDKNodeFeatures val_conv;
16710 val_conv.inner = (void*)(val & (~1));
16711 val_conv.is_owned = (val & 1) || (val == 0);
16712 // Warning: we may need a move here but can't clone!
16713 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
16716 JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr) {
16717 LDKNodeAnnouncementInfo this_ptr_conv;
16718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16719 this_ptr_conv.is_owned = false;
16720 int32_t ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
16724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
16725 LDKNodeAnnouncementInfo this_ptr_conv;
16726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16727 this_ptr_conv.is_owned = false;
16728 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
16731 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr) {
16732 LDKNodeAnnouncementInfo this_ptr_conv;
16733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16734 this_ptr_conv.is_owned = false;
16735 int8_tArray ret_arr = (*env)->NewByteArray(env, 3);
16736 (*env)->SetByteArrayRegion(env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
16740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16741 LDKNodeAnnouncementInfo this_ptr_conv;
16742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16743 this_ptr_conv.is_owned = false;
16744 LDKThreeBytes val_ref;
16745 CHECK((*env)->GetArrayLength(env, val) == 3);
16746 (*env)->GetByteArrayRegion(env, val, 0, 3, val_ref.data);
16747 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
16750 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv *env, jclass clz, int64_t this_ptr) {
16751 LDKNodeAnnouncementInfo this_ptr_conv;
16752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16753 this_ptr_conv.is_owned = false;
16754 int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
16755 (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
16759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv *env, jclass clz, int64_t this_ptr, int8_tArray val) {
16760 LDKNodeAnnouncementInfo this_ptr_conv;
16761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16762 this_ptr_conv.is_owned = false;
16763 LDKThirtyTwoBytes val_ref;
16764 CHECK((*env)->GetArrayLength(env, val) == 32);
16765 (*env)->GetByteArrayRegion(env, val, 0, 32, val_ref.data);
16766 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
16769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16770 LDKNodeAnnouncementInfo this_ptr_conv;
16771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16772 this_ptr_conv.is_owned = false;
16773 LDKCVec_NetAddressZ val_constr;
16774 val_constr.datalen = (*env)->GetArrayLength(env, val);
16775 if (val_constr.datalen > 0)
16776 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16778 val_constr.data = NULL;
16779 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16780 for (size_t m = 0; m < val_constr.datalen; m++) {
16781 int64_t arr_conv_12 = val_vals[m];
16782 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
16783 FREE((void*)arr_conv_12);
16784 val_constr.data[m] = arr_conv_12_conv;
16786 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16787 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
16790 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr) {
16791 LDKNodeAnnouncementInfo this_ptr_conv;
16792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16793 this_ptr_conv.is_owned = false;
16794 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
16795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16797 long ret_ref = (long)ret_var.inner;
16798 if (ret_var.is_owned) {
16804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16805 LDKNodeAnnouncementInfo this_ptr_conv;
16806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16807 this_ptr_conv.is_owned = false;
16808 LDKNodeAnnouncement val_conv;
16809 val_conv.inner = (void*)(val & (~1));
16810 val_conv.is_owned = (val & 1) || (val == 0);
16811 if (val_conv.inner != NULL)
16812 val_conv = NodeAnnouncement_clone(&val_conv);
16813 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
16816 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) {
16817 LDKNodeFeatures features_arg_conv;
16818 features_arg_conv.inner = (void*)(features_arg & (~1));
16819 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16820 // Warning: we may need a move here but can't clone!
16821 LDKThreeBytes rgb_arg_ref;
16822 CHECK((*env)->GetArrayLength(env, rgb_arg) == 3);
16823 (*env)->GetByteArrayRegion(env, rgb_arg, 0, 3, rgb_arg_ref.data);
16824 LDKThirtyTwoBytes alias_arg_ref;
16825 CHECK((*env)->GetArrayLength(env, alias_arg) == 32);
16826 (*env)->GetByteArrayRegion(env, alias_arg, 0, 32, alias_arg_ref.data);
16827 LDKCVec_NetAddressZ addresses_arg_constr;
16828 addresses_arg_constr.datalen = (*env)->GetArrayLength(env, addresses_arg);
16829 if (addresses_arg_constr.datalen > 0)
16830 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16832 addresses_arg_constr.data = NULL;
16833 int64_t* addresses_arg_vals = (*env)->GetLongArrayElements (env, addresses_arg, NULL);
16834 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
16835 int64_t arr_conv_12 = addresses_arg_vals[m];
16836 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
16837 FREE((void*)arr_conv_12);
16838 addresses_arg_constr.data[m] = arr_conv_12_conv;
16840 (*env)->ReleaseLongArrayElements(env, addresses_arg, addresses_arg_vals, 0);
16841 LDKNodeAnnouncement announcement_message_arg_conv;
16842 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
16843 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
16844 if (announcement_message_arg_conv.inner != NULL)
16845 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
16846 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
16847 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16848 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16849 long ret_ref = (long)ret_var.inner;
16850 if (ret_var.is_owned) {
16856 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16857 LDKNodeAnnouncementInfo obj_conv;
16858 obj_conv.inner = (void*)(obj & (~1));
16859 obj_conv.is_owned = false;
16860 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
16861 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16862 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16863 CVec_u8Z_free(arg_var);
16867 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16868 LDKu8slice ser_ref;
16869 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
16870 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
16871 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16872 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
16873 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
16874 return (long)ret_conv;
16877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
16878 LDKNodeInfo this_ptr_conv;
16879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16881 NodeInfo_free(this_ptr_conv);
16884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
16885 LDKNodeInfo this_ptr_conv;
16886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16887 this_ptr_conv.is_owned = false;
16888 LDKCVec_u64Z val_constr;
16889 val_constr.datalen = (*env)->GetArrayLength(env, val);
16890 if (val_constr.datalen > 0)
16891 val_constr.data = MALLOC(val_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16893 val_constr.data = NULL;
16894 int64_t* val_vals = (*env)->GetLongArrayElements (env, val, NULL);
16895 for (size_t g = 0; g < val_constr.datalen; g++) {
16896 int64_t arr_conv_6 = val_vals[g];
16897 val_constr.data[g] = arr_conv_6;
16899 (*env)->ReleaseLongArrayElements(env, val, val_vals, 0);
16900 NodeInfo_set_channels(&this_ptr_conv, val_constr);
16903 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr) {
16904 LDKNodeInfo this_ptr_conv;
16905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16906 this_ptr_conv.is_owned = false;
16907 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16918 LDKNodeInfo this_ptr_conv;
16919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16920 this_ptr_conv.is_owned = false;
16921 LDKRoutingFees val_conv;
16922 val_conv.inner = (void*)(val & (~1));
16923 val_conv.is_owned = (val & 1) || (val == 0);
16924 if (val_conv.inner != NULL)
16925 val_conv = RoutingFees_clone(&val_conv);
16926 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
16929 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
16930 LDKNodeInfo this_ptr_conv;
16931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16932 this_ptr_conv.is_owned = false;
16933 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
16934 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16935 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16936 long ret_ref = (long)ret_var.inner;
16937 if (ret_var.is_owned) {
16943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
16944 LDKNodeInfo this_ptr_conv;
16945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16946 this_ptr_conv.is_owned = false;
16947 LDKNodeAnnouncementInfo val_conv;
16948 val_conv.inner = (void*)(val & (~1));
16949 val_conv.is_owned = (val & 1) || (val == 0);
16950 // Warning: we may need a move here but can't clone!
16951 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
16954 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) {
16955 LDKCVec_u64Z channels_arg_constr;
16956 channels_arg_constr.datalen = (*env)->GetArrayLength(env, channels_arg);
16957 if (channels_arg_constr.datalen > 0)
16958 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(int64_t), "LDKCVec_u64Z Elements");
16960 channels_arg_constr.data = NULL;
16961 int64_t* channels_arg_vals = (*env)->GetLongArrayElements (env, channels_arg, NULL);
16962 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
16963 int64_t arr_conv_6 = channels_arg_vals[g];
16964 channels_arg_constr.data[g] = arr_conv_6;
16966 (*env)->ReleaseLongArrayElements(env, channels_arg, channels_arg_vals, 0);
16967 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
16968 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
16969 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
16970 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
16971 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
16972 LDKNodeAnnouncementInfo announcement_info_arg_conv;
16973 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
16974 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
16975 // Warning: we may need a move here but can't clone!
16976 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
16977 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16978 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16979 long ret_ref = (long)ret_var.inner;
16980 if (ret_var.is_owned) {
16986 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv *env, jclass clz, int64_t obj) {
16987 LDKNodeInfo obj_conv;
16988 obj_conv.inner = (void*)(obj & (~1));
16989 obj_conv.is_owned = false;
16990 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
16991 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
16992 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
16993 CVec_u8Z_free(arg_var);
16997 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
16998 LDKu8slice ser_ref;
16999 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17000 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17001 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
17002 *ret_conv = NodeInfo_read(ser_ref);
17003 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17004 return (long)ret_conv;
17007 JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv *env, jclass clz, int64_t obj) {
17008 LDKNetworkGraph obj_conv;
17009 obj_conv.inner = (void*)(obj & (~1));
17010 obj_conv.is_owned = false;
17011 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
17012 int8_tArray arg_arr = (*env)->NewByteArray(env, arg_var.datalen);
17013 (*env)->SetByteArrayRegion(env, arg_arr, 0, arg_var.datalen, arg_var.data);
17014 CVec_u8Z_free(arg_var);
17018 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
17019 LDKu8slice ser_ref;
17020 ser_ref.datalen = (*env)->GetArrayLength(env, ser);
17021 ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
17022 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
17023 *ret_conv = NetworkGraph_read(ser_ref);
17024 (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
17025 return (long)ret_conv;
17028 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash) {
17029 LDKThirtyTwoBytes genesis_hash_ref;
17030 CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
17031 (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
17032 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
17033 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
17034 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
17035 long ret_ref = (long)ret_var.inner;
17036 if (ret_var.is_owned) {
17042 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) {
17043 LDKNetworkGraph this_arg_conv;
17044 this_arg_conv.inner = (void*)(this_arg & (~1));
17045 this_arg_conv.is_owned = false;
17046 LDKNodeAnnouncement 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_node_from_announcement(&this_arg_conv, &msg_conv);
17051 return (long)ret_conv;
17054 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) {
17055 LDKNetworkGraph this_arg_conv;
17056 this_arg_conv.inner = (void*)(this_arg & (~1));
17057 this_arg_conv.is_owned = false;
17058 LDKUnsignedNodeAnnouncement msg_conv;
17059 msg_conv.inner = (void*)(msg & (~1));
17060 msg_conv.is_owned = false;
17061 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17062 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
17063 return (long)ret_conv;
17066 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) {
17067 LDKNetworkGraph this_arg_conv;
17068 this_arg_conv.inner = (void*)(this_arg & (~1));
17069 this_arg_conv.is_owned = false;
17070 LDKChannelAnnouncement msg_conv;
17071 msg_conv.inner = (void*)(msg & (~1));
17072 msg_conv.is_owned = false;
17073 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17074 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17075 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17076 return (long)ret_conv;
17079 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) {
17080 LDKNetworkGraph this_arg_conv;
17081 this_arg_conv.inner = (void*)(this_arg & (~1));
17082 this_arg_conv.is_owned = false;
17083 LDKUnsignedChannelAnnouncement msg_conv;
17084 msg_conv.inner = (void*)(msg & (~1));
17085 msg_conv.is_owned = false;
17086 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17087 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17088 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17089 return (long)ret_conv;
17092 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) {
17093 LDKNetworkGraph this_arg_conv;
17094 this_arg_conv.inner = (void*)(this_arg & (~1));
17095 this_arg_conv.is_owned = false;
17096 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
17099 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17100 LDKNetworkGraph this_arg_conv;
17101 this_arg_conv.inner = (void*)(this_arg & (~1));
17102 this_arg_conv.is_owned = false;
17103 LDKChannelUpdate msg_conv;
17104 msg_conv.inner = (void*)(msg & (~1));
17105 msg_conv.is_owned = false;
17106 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17107 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
17108 return (long)ret_conv;
17111 JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
17112 LDKNetworkGraph this_arg_conv;
17113 this_arg_conv.inner = (void*)(this_arg & (~1));
17114 this_arg_conv.is_owned = false;
17115 LDKUnsignedChannelUpdate msg_conv;
17116 msg_conv.inner = (void*)(msg & (~1));
17117 msg_conv.is_owned = false;
17118 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17119 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
17120 return (long)ret_conv;