1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
7 // Always run a, then assert it is true:
8 #define DO_ASSERT(a) do { bool _assert_val = (a); assert(_assert_val); } while(0)
9 // Assert a is true or do nothing
10 #define CHECK(a) DO_ASSERT(a)
12 // Running a leak check across all the allocations and frees of the JDK is a mess,
13 // so instead we implement our own naive leak checker here, relying on the -wrap
14 // linker option to wrap malloc/calloc/realloc/free, tracking everyhing allocated
15 // and free'd in Rust or C across the generated bindings shared library.
19 static mtx_t allocation_mtx;
21 void __attribute__((constructor)) init_mtx() {
22 DO_ASSERT(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
26 typedef struct allocation {
27 struct allocation* next;
29 const char* struct_name;
33 static allocation* allocation_ll = NULL;
35 void* __real_malloc(size_t len);
36 void* __real_calloc(size_t nmemb, size_t len);
37 static void new_allocation(void* res, const char* struct_name) {
38 allocation* new_alloc = __real_malloc(sizeof(allocation));
40 new_alloc->struct_name = struct_name;
41 new_alloc->bt_len = backtrace(new_alloc->bt, BT_MAX);
42 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
43 new_alloc->next = allocation_ll;
44 allocation_ll = new_alloc;
45 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
47 static void* MALLOC(size_t len, const char* struct_name) {
48 void* res = __real_malloc(len);
49 new_allocation(res, struct_name);
52 void __real_free(void* ptr);
53 static void alloc_freed(void* ptr) {
55 DO_ASSERT(mtx_lock(&allocation_mtx) == thrd_success);
56 allocation* it = allocation_ll;
57 while (it->ptr != ptr) {
58 p = it; it = it->next;
60 fprintf(stderr, "Tried to free unknown pointer %p at:\n", ptr);
62 int bt_len = backtrace(bt, BT_MAX);
63 backtrace_symbols_fd(bt, bt_len, STDERR_FILENO);
64 fprintf(stderr, "\n\n");
65 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
66 return; // addrsan should catch malloc-unknown and print more info than we have
69 if (p) { p->next = it->next; } else { allocation_ll = it->next; }
70 DO_ASSERT(mtx_unlock(&allocation_mtx) == thrd_success);
71 DO_ASSERT(it->ptr == ptr);
74 static void FREE(void* ptr) {
75 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
80 void* __wrap_malloc(size_t len) {
81 void* res = __real_malloc(len);
82 new_allocation(res, "malloc call");
85 void* __wrap_calloc(size_t nmemb, size_t len) {
86 void* res = __real_calloc(nmemb, len);
87 new_allocation(res, "calloc call");
90 void __wrap_free(void* ptr) {
91 if (ptr == NULL) return;
96 void* __real_realloc(void* ptr, size_t newlen);
97 void* __wrap_realloc(void* ptr, size_t len) {
98 if (ptr != NULL) alloc_freed(ptr);
99 void* res = __real_realloc(ptr, len);
100 new_allocation(res, "realloc call");
103 void __wrap_reallocarray(void* ptr, size_t new_sz) {
104 // Rust doesn't seem to use reallocarray currently
108 void __attribute__((destructor)) check_leaks() {
109 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
110 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
111 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
112 fprintf(stderr, "\n\n");
114 DO_ASSERT(allocation_ll == NULL);
116 static jclass arr_of_B_clz = NULL;
117 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass _b) {
118 arr_of_B_clz = (*env)->FindClass(env, "[B");
119 CHECK(arr_of_B_clz != NULL);
120 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
123 static jmethodID ordinal_meth = NULL;
124 static jmethodID slicedef_meth = NULL;
125 static jclass slicedef_cls = NULL;
126 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
127 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
128 CHECK(ordinal_meth != NULL);
129 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
130 CHECK(slicedef_meth != NULL);
131 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
132 CHECK(slicedef_cls != NULL);
135 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
136 return *((bool*)ptr);
138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
139 return *((long*)ptr);
141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
144 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
145 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
146 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
149 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
150 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
151 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
152 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
155 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
156 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
157 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
158 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
159 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
162 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
163 LDKTransaction *txdata = (LDKTransaction*)ptr;
165 slice.data = txdata->data;
166 slice.datalen = txdata->datalen;
167 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
169 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
170 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
171 txdata->datalen = (*env)->GetArrayLength(env, bytes);
172 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
173 txdata->data_is_owned = false;
174 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
178 LDKTransaction *tx = (LDKTransaction*)ptr;
179 tx->data_is_owned = true;
180 Transaction_free(*tx);
183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
184 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
185 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
186 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
187 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
188 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
189 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
190 return (long)vec->datalen;
192 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
193 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
194 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
195 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
196 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
197 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
198 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
204 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
205 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
206 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
207 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
209 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
210 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
211 case 0: return LDKAccessError_UnknownChain;
212 case 1: return LDKAccessError_UnknownTx;
216 static jclass LDKAccessError_class = NULL;
217 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
218 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
219 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
220 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
221 CHECK(LDKAccessError_class != NULL);
222 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
223 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
224 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
225 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
227 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
229 case LDKAccessError_UnknownChain:
230 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
231 case LDKAccessError_UnknownTx:
232 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
237 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
238 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
239 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
240 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
244 static jclass LDKChannelMonitorUpdateErr_class = NULL;
245 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
246 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
247 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
248 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
249 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
250 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
251 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
252 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
253 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
255 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
257 case LDKChannelMonitorUpdateErr_TemporaryFailure:
258 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
259 case LDKChannelMonitorUpdateErr_PermanentFailure:
260 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
265 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
266 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
267 case 0: return LDKConfirmationTarget_Background;
268 case 1: return LDKConfirmationTarget_Normal;
269 case 2: return LDKConfirmationTarget_HighPriority;
273 static jclass LDKConfirmationTarget_class = NULL;
274 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
275 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
276 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
277 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
278 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
279 CHECK(LDKConfirmationTarget_class != NULL);
280 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
281 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
282 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
283 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
284 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
285 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
287 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
289 case LDKConfirmationTarget_Background:
290 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
291 case LDKConfirmationTarget_Normal:
292 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
293 case LDKConfirmationTarget_HighPriority:
294 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
299 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
300 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
301 case 0: return LDKLevel_Off;
302 case 1: return LDKLevel_Error;
303 case 2: return LDKLevel_Warn;
304 case 3: return LDKLevel_Info;
305 case 4: return LDKLevel_Debug;
306 case 5: return LDKLevel_Trace;
310 static jclass LDKLevel_class = NULL;
311 static jfieldID LDKLevel_LDKLevel_Off = NULL;
312 static jfieldID LDKLevel_LDKLevel_Error = NULL;
313 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
314 static jfieldID LDKLevel_LDKLevel_Info = NULL;
315 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
316 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
317 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
318 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
319 CHECK(LDKLevel_class != NULL);
320 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
321 CHECK(LDKLevel_LDKLevel_Off != NULL);
322 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
323 CHECK(LDKLevel_LDKLevel_Error != NULL);
324 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
325 CHECK(LDKLevel_LDKLevel_Warn != NULL);
326 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
327 CHECK(LDKLevel_LDKLevel_Info != NULL);
328 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
329 CHECK(LDKLevel_LDKLevel_Debug != NULL);
330 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
331 CHECK(LDKLevel_LDKLevel_Trace != NULL);
333 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
336 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
338 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
340 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
342 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
344 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
346 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
351 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
352 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
353 case 0: return LDKNetwork_Bitcoin;
354 case 1: return LDKNetwork_Testnet;
355 case 2: return LDKNetwork_Regtest;
359 static jclass LDKNetwork_class = NULL;
360 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
361 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
362 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
363 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
364 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
365 CHECK(LDKNetwork_class != NULL);
366 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
367 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
368 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
369 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
370 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
371 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
373 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
375 case LDKNetwork_Bitcoin:
376 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
377 case LDKNetwork_Testnet:
378 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
379 case LDKNetwork_Regtest:
380 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
385 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
386 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
387 case 0: return LDKSecp256k1Error_IncorrectSignature;
388 case 1: return LDKSecp256k1Error_InvalidMessage;
389 case 2: return LDKSecp256k1Error_InvalidPublicKey;
390 case 3: return LDKSecp256k1Error_InvalidSignature;
391 case 4: return LDKSecp256k1Error_InvalidSecretKey;
392 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
393 case 6: return LDKSecp256k1Error_InvalidTweak;
394 case 7: return LDKSecp256k1Error_NotEnoughMemory;
395 case 8: return LDKSecp256k1Error_CallbackPanicked;
399 static jclass LDKSecp256k1Error_class = NULL;
400 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
401 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
402 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
403 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
404 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
405 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
406 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
407 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
408 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
409 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
410 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
411 CHECK(LDKSecp256k1Error_class != NULL);
412 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
413 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
414 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
415 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
416 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
417 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
418 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
419 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
420 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
421 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
422 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
423 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
424 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
425 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
426 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
427 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
428 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
429 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
431 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
433 case LDKSecp256k1Error_IncorrectSignature:
434 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
435 case LDKSecp256k1Error_InvalidMessage:
436 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
437 case LDKSecp256k1Error_InvalidPublicKey:
438 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
439 case LDKSecp256k1Error_InvalidSignature:
440 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
441 case LDKSecp256k1Error_InvalidSecretKey:
442 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
443 case LDKSecp256k1Error_InvalidRecoveryId:
444 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
445 case LDKSecp256k1Error_InvalidTweak:
446 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
447 case LDKSecp256k1Error_NotEnoughMemory:
448 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
449 case LDKSecp256k1Error_CallbackPanicked:
450 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
455 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
456 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
457 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u8Z_1new(JNIEnv *env, jclass _b, jbyteArray elems){
460 LDKCVec_u8Z *ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
461 ret->datalen = (*env)->GetArrayLength(env, elems);
462 if (ret->datalen == 0) {
465 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVec_u8Z Data");
466 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
467 for (size_t i = 0; i < ret->datalen; i++) {
468 ret->data[i] = java_elems[i];
470 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
475 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
480 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
481 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
485 LDKC2Tuple_u64u64Z *tuple = (LDKC2Tuple_u64u64Z*)ptr;
488 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
489 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
490 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
491 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
492 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
493 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
495 LDKSpendableOutputDescriptor_StaticOutput_class =
496 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
497 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
498 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
499 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
500 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
501 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
502 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
503 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
504 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
505 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
506 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
507 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
508 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
509 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
511 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
512 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
514 case LDKSpendableOutputDescriptor_StaticOutput: {
515 LDKOutPoint outpoint_var = obj->static_output.outpoint;
516 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
517 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
518 long outpoint_ref = (long)outpoint_var.inner & ~1;
519 long output_ref = (long)&obj->static_output.output;
520 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, (long)output_ref);
522 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
523 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
524 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
525 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
526 long outpoint_ref = (long)outpoint_var.inner & ~1;
527 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
528 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
529 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
530 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
531 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
532 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
533 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);
535 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
536 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
537 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
538 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
539 long outpoint_ref = (long)outpoint_var.inner & ~1;
540 long output_ref = (long)&obj->static_output_counterparty_payment.output;
541 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
542 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, (long)output_ref, key_derivation_params_ref);
547 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
548 LDKCVec_SpendableOutputDescriptorZ *vec = (LDKCVec_SpendableOutputDescriptorZ*)ptr;
549 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SpendableOutputDescriptorZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
552 LDKCVec_SpendableOutputDescriptorZ *ret = MALLOC(sizeof(LDKCVec_SpendableOutputDescriptorZ), "LDKCVec_SpendableOutputDescriptorZ");
553 ret->datalen = (*env)->GetArrayLength(env, elems);
554 if (ret->datalen == 0) {
557 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVec_SpendableOutputDescriptorZ Data");
558 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
559 for (size_t i = 0; i < ret->datalen; i++) {
560 jlong arr_elem = java_elems[i];
561 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
562 FREE((void*)arr_elem);
563 ret->data[i] = arr_elem_conv;
565 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
569 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
570 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
571 static jclass LDKErrorAction_IgnoreError_class = NULL;
572 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
573 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
574 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
576 LDKErrorAction_DisconnectPeer_class =
577 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
578 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
579 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
580 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
581 LDKErrorAction_IgnoreError_class =
582 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
583 CHECK(LDKErrorAction_IgnoreError_class != NULL);
584 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
585 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
586 LDKErrorAction_SendErrorMessage_class =
587 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
588 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
589 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
590 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
592 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
593 LDKErrorAction *obj = (LDKErrorAction*)ptr;
595 case LDKErrorAction_DisconnectPeer: {
596 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
597 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
598 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
599 long msg_ref = (long)msg_var.inner & ~1;
600 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
602 case LDKErrorAction_IgnoreError: {
603 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
605 case LDKErrorAction_SendErrorMessage: {
606 LDKErrorMessage msg_var = obj->send_error_message.msg;
607 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
608 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
609 long msg_ref = (long)msg_var.inner & ~1;
610 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
615 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
616 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
617 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
618 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
619 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
620 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
622 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
623 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
624 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
625 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
626 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
627 LDKHTLCFailChannelUpdate_ChannelClosed_class =
628 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
629 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
630 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
631 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
632 LDKHTLCFailChannelUpdate_NodeFailure_class =
633 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
634 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
635 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
636 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
638 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
639 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
641 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
642 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
643 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
644 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
645 long msg_ref = (long)msg_var.inner & ~1;
646 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
648 case LDKHTLCFailChannelUpdate_ChannelClosed: {
649 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
651 case LDKHTLCFailChannelUpdate_NodeFailure: {
652 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
653 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
654 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
659 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
660 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
661 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
662 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
663 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
664 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
665 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
666 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
667 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
668 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
669 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
670 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
671 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
672 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
673 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
674 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
675 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
676 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
677 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
678 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
679 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
680 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
681 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
682 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
683 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
684 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
685 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
686 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
687 static jclass LDKMessageSendEvent_HandleError_class = NULL;
688 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
689 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
690 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
691 static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
692 static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
693 static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
694 static jmethodID LDKMessageSendEvent_SendShortIdsQuery_meth = NULL;
695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
696 LDKMessageSendEvent_SendAcceptChannel_class =
697 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
698 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
699 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
700 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
701 LDKMessageSendEvent_SendOpenChannel_class =
702 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
703 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
704 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
705 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
706 LDKMessageSendEvent_SendFundingCreated_class =
707 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
708 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
709 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
710 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
711 LDKMessageSendEvent_SendFundingSigned_class =
712 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
713 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
714 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
715 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
716 LDKMessageSendEvent_SendFundingLocked_class =
717 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
718 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
719 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
720 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
721 LDKMessageSendEvent_SendAnnouncementSignatures_class =
722 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
723 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
724 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
725 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
726 LDKMessageSendEvent_UpdateHTLCs_class =
727 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
728 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
729 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
730 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
731 LDKMessageSendEvent_SendRevokeAndACK_class =
732 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
733 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
734 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
735 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
736 LDKMessageSendEvent_SendClosingSigned_class =
737 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
738 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
739 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
740 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
741 LDKMessageSendEvent_SendShutdown_class =
742 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
743 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
744 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
745 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
746 LDKMessageSendEvent_SendChannelReestablish_class =
747 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
748 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
749 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
750 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
751 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
752 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
753 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
754 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
755 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
756 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
757 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
758 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
759 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
760 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
761 LDKMessageSendEvent_BroadcastChannelUpdate_class =
762 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
763 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
764 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
765 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
766 LDKMessageSendEvent_HandleError_class =
767 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
768 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
769 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
770 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
771 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
772 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
773 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
774 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
775 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
776 LDKMessageSendEvent_SendChannelRangeQuery_class =
777 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
778 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
779 LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "<init>", "([BJ)V");
780 CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL);
781 LDKMessageSendEvent_SendShortIdsQuery_class =
782 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;"));
783 CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL);
784 LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "<init>", "([BJ)V");
785 CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL);
787 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
788 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
790 case LDKMessageSendEvent_SendAcceptChannel: {
791 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
792 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
793 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
794 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
795 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
796 long msg_ref = (long)msg_var.inner & ~1;
797 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
799 case LDKMessageSendEvent_SendOpenChannel: {
800 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
801 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
802 LDKOpenChannel msg_var = obj->send_open_channel.msg;
803 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
804 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
805 long msg_ref = (long)msg_var.inner & ~1;
806 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
808 case LDKMessageSendEvent_SendFundingCreated: {
809 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
810 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
811 LDKFundingCreated msg_var = obj->send_funding_created.msg;
812 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
813 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
814 long msg_ref = (long)msg_var.inner & ~1;
815 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
817 case LDKMessageSendEvent_SendFundingSigned: {
818 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
819 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
820 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
821 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
822 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
823 long msg_ref = (long)msg_var.inner & ~1;
824 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
826 case LDKMessageSendEvent_SendFundingLocked: {
827 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
828 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
829 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
830 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
831 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
832 long msg_ref = (long)msg_var.inner & ~1;
833 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
835 case LDKMessageSendEvent_SendAnnouncementSignatures: {
836 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
837 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
838 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
839 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
840 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
841 long msg_ref = (long)msg_var.inner & ~1;
842 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
844 case LDKMessageSendEvent_UpdateHTLCs: {
845 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
846 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
847 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
848 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
849 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
850 long updates_ref = (long)updates_var.inner & ~1;
851 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
853 case LDKMessageSendEvent_SendRevokeAndACK: {
854 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
855 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
856 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
857 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
858 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
859 long msg_ref = (long)msg_var.inner & ~1;
860 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
862 case LDKMessageSendEvent_SendClosingSigned: {
863 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
864 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
865 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
866 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
867 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
868 long msg_ref = (long)msg_var.inner & ~1;
869 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
871 case LDKMessageSendEvent_SendShutdown: {
872 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
873 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
874 LDKShutdown msg_var = obj->send_shutdown.msg;
875 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
876 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
877 long msg_ref = (long)msg_var.inner & ~1;
878 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
880 case LDKMessageSendEvent_SendChannelReestablish: {
881 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
882 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
883 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
884 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
885 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
886 long msg_ref = (long)msg_var.inner & ~1;
887 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
889 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
890 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.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 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
895 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
896 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
897 long update_msg_ref = (long)update_msg_var.inner & ~1;
898 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
900 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
901 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
902 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
903 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
904 long msg_ref = (long)msg_var.inner & ~1;
905 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
907 case LDKMessageSendEvent_BroadcastChannelUpdate: {
908 LDKChannelUpdate msg_var = obj->broadcast_channel_update.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_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
914 case LDKMessageSendEvent_HandleError: {
915 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
916 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
917 long action_ref = (long)&obj->handle_error.action;
918 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
920 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
921 long update_ref = (long)&obj->payment_failure_network_update.update;
922 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
924 case LDKMessageSendEvent_SendChannelRangeQuery: {
925 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
926 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
927 LDKQueryChannelRange msg_var = obj->send_channel_range_query.msg;
928 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
929 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
930 long msg_ref = (long)msg_var.inner & ~1;
931 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelRangeQuery_class, LDKMessageSendEvent_SendChannelRangeQuery_meth, node_id_arr, msg_ref);
933 case LDKMessageSendEvent_SendShortIdsQuery: {
934 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
935 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_short_ids_query.node_id.compressed_form);
936 LDKQueryShortChannelIds msg_var = obj->send_short_ids_query.msg;
937 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
938 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
939 long msg_ref = (long)msg_var.inner & ~1;
940 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShortIdsQuery_class, LDKMessageSendEvent_SendShortIdsQuery_meth, node_id_arr, msg_ref);
945 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
946 LDKCVec_MessageSendEventZ *vec = (LDKCVec_MessageSendEventZ*)ptr;
947 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MessageSendEventZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
950 LDKCVec_MessageSendEventZ *ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
951 ret->datalen = (*env)->GetArrayLength(env, elems);
952 if (ret->datalen == 0) {
955 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVec_MessageSendEventZ Data");
956 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
957 for (size_t i = 0; i < ret->datalen; i++) {
958 jlong arr_elem = java_elems[i];
959 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
960 FREE((void*)arr_elem);
961 ret->data[i] = arr_elem_conv;
963 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
967 static jclass LDKEvent_FundingGenerationReady_class = NULL;
968 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
969 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
970 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
971 static jclass LDKEvent_PaymentReceived_class = NULL;
972 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
973 static jclass LDKEvent_PaymentSent_class = NULL;
974 static jmethodID LDKEvent_PaymentSent_meth = NULL;
975 static jclass LDKEvent_PaymentFailed_class = NULL;
976 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
977 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
978 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
979 static jclass LDKEvent_SpendableOutputs_class = NULL;
980 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
982 LDKEvent_FundingGenerationReady_class =
983 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
984 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
985 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
986 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
987 LDKEvent_FundingBroadcastSafe_class =
988 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
989 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
990 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
991 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
992 LDKEvent_PaymentReceived_class =
993 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
994 CHECK(LDKEvent_PaymentReceived_class != NULL);
995 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
996 CHECK(LDKEvent_PaymentReceived_meth != NULL);
997 LDKEvent_PaymentSent_class =
998 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
999 CHECK(LDKEvent_PaymentSent_class != NULL);
1000 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1001 CHECK(LDKEvent_PaymentSent_meth != NULL);
1002 LDKEvent_PaymentFailed_class =
1003 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1004 CHECK(LDKEvent_PaymentFailed_class != NULL);
1005 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1006 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1007 LDKEvent_PendingHTLCsForwardable_class =
1008 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1009 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1010 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1011 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1012 LDKEvent_SpendableOutputs_class =
1013 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1014 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1015 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1016 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1018 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1019 LDKEvent *obj = (LDKEvent*)ptr;
1021 case LDKEvent_FundingGenerationReady: {
1022 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
1023 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1024 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1025 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
1026 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1027 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);
1029 case LDKEvent_FundingBroadcastSafe: {
1030 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1031 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1032 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1033 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1034 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1036 case LDKEvent_PaymentReceived: {
1037 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1038 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1039 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
1040 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1041 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1043 case LDKEvent_PaymentSent: {
1044 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
1045 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1046 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1048 case LDKEvent_PaymentFailed: {
1049 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1050 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1051 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1053 case LDKEvent_PendingHTLCsForwardable: {
1054 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1056 case LDKEvent_SpendableOutputs: {
1057 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1058 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
1059 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
1060 for (size_t b = 0; b < outputs_var.datalen; b++) {
1061 long arr_conv_27_ref = (long)&outputs_var.data[b];
1062 outputs_arr_ptr[b] = arr_conv_27_ref;
1064 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
1065 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1070 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1071 LDKCVec_EventZ *vec = (LDKCVec_EventZ*)ptr;
1072 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1074 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1EventZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
1075 LDKCVec_EventZ *ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1076 ret->datalen = (*env)->GetArrayLength(env, elems);
1077 if (ret->datalen == 0) {
1080 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVec_EventZ Data");
1081 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1082 for (size_t i = 0; i < ret->datalen; i++) {
1083 jlong arr_elem = java_elems[i];
1084 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1085 FREE((void*)arr_elem);
1086 ret->data[i] = arr_elem_conv;
1088 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
1093 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
1095 LDKTransaction b_ref;
1096 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
1097 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
1098 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
1099 b_ref.data_is_owned = false;
1103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
1104 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
1107 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
1108 LDKC2Tuple_usizeTransactionZ *tuple = (LDKC2Tuple_usizeTransactionZ*)ptr;
1109 LDKTransaction b_var = tuple->b;
1110 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
1111 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
1114 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1115 LDKCVec_C2Tuple_usizeTransactionZZ *vec = (LDKCVec_C2Tuple_usizeTransactionZZ*)ptr;
1116 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2Tuple_usizeTransactionZ));
1118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1usizeTransactionZZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
1119 LDKCVec_C2Tuple_usizeTransactionZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "LDKCVec_C2Tuple_usizeTransactionZZ");
1120 ret->datalen = (*env)->GetArrayLength(env, elems);
1121 if (ret->datalen == 0) {
1124 ret->data = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ) * ret->datalen, "LDKCVec_C2Tuple_usizeTransactionZZ Data");
1125 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1126 for (size_t i = 0; i < ret->datalen; i++) {
1127 jlong arr_elem = java_elems[i];
1128 LDKC2Tuple_usizeTransactionZ arr_elem_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_elem;
1129 FREE((void*)arr_elem);
1130 ret->data[i] = arr_elem_conv;
1132 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1137 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
1139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1140 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
1141 CHECK(val->result_ok);
1142 return *val->contents.result;
1144 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1145 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
1146 CHECK(!val->result_ok);
1147 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
1150 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1151 LDKCVec_MonitorEventZ *vec = (LDKCVec_MonitorEventZ*)ptr;
1152 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1153 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1154 for (size_t i = 0; i < vec->datalen; i++) {
1155 CHECK((((long)vec->data[i].inner) & 1) == 0);
1156 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1158 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1161 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1MonitorEventZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
1162 LDKCVec_MonitorEventZ *ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
1163 ret->datalen = (*env)->GetArrayLength(env, elems);
1164 if (ret->datalen == 0) {
1167 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVec_MonitorEventZ Data");
1168 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1169 for (size_t i = 0; i < ret->datalen; i++) {
1170 jlong arr_elem = java_elems[i];
1171 LDKMonitorEvent arr_elem_conv;
1172 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1173 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1174 if (arr_elem_conv.inner != NULL)
1175 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
1176 ret->data[i] = arr_elem_conv;
1178 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1182 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1183 return ((LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg)->result_ok;
1185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1186 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
1187 CHECK(val->result_ok);
1188 LDKChannelMonitorUpdate res_var = (*val->contents.result);
1189 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1190 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1191 long res_ref = (long)res_var.inner & ~1;
1194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelMonitorUpdateDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1195 LDKCResult_ChannelMonitorUpdateDecodeErrorZ *val = (LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)arg;
1196 CHECK(!val->result_ok);
1197 LDKDecodeError err_var = (*val->contents.err);
1198 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1199 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1200 long err_ref = (long)err_var.inner & ~1;
1203 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1204 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
1206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1207 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
1208 CHECK(val->result_ok);
1209 return *val->contents.result;
1211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1212 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
1213 CHECK(!val->result_ok);
1214 LDKMonitorUpdateError err_var = (*val->contents.err);
1215 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1216 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1217 long err_ref = (long)err_var.inner & ~1;
1220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
1221 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1223 a_conv.inner = (void*)(a & (~1));
1224 a_conv.is_owned = (a & 1) || (a == 0);
1225 if (a_conv.inner != NULL)
1226 a_conv = OutPoint_clone(&a_conv);
1229 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
1230 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
1231 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
1235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
1236 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
1237 LDKOutPoint a_var = tuple->a;
1238 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1239 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1240 long a_ref = (long)a_var.inner & ~1;
1243 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
1244 LDKC2Tuple_OutPointScriptZ *tuple = (LDKC2Tuple_OutPointScriptZ*)ptr;
1245 LDKCVec_u8Z b_var = tuple->b;
1246 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
1247 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
1250 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1TransactionZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1251 LDKCVec_TransactionZ *vec = (LDKCVec_TransactionZ*)ptr;
1252 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
1254 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1new(JNIEnv *_env, jclass _b, jint a, jlong b) {
1255 LDKC2Tuple_u32TxOutZ* ret = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
1257 LDKTxOut b_conv = *(LDKTxOut*)b;
1262 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
1263 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
1266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u32TxOutZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
1267 LDKC2Tuple_u32TxOutZ *tuple = (LDKC2Tuple_u32TxOutZ*)ptr;
1268 long b_ref = (long)&tuple->b;
1271 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1272 LDKCVec_C2Tuple_u32TxOutZZ *vec = (LDKCVec_C2Tuple_u32TxOutZZ*)ptr;
1273 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2Tuple_u32TxOutZ));
1275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1u32TxOutZZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
1276 LDKCVec_C2Tuple_u32TxOutZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_u32TxOutZZ), "LDKCVec_C2Tuple_u32TxOutZZ");
1277 ret->datalen = (*env)->GetArrayLength(env, elems);
1278 if (ret->datalen == 0) {
1281 ret->data = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ) * ret->datalen, "LDKCVec_C2Tuple_u32TxOutZZ Data");
1282 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1283 for (size_t i = 0; i < ret->datalen; i++) {
1284 jlong arr_elem = java_elems[i];
1285 LDKC2Tuple_u32TxOutZ arr_elem_conv = *(LDKC2Tuple_u32TxOutZ*)arr_elem;
1286 FREE((void*)arr_elem);
1287 ret->data[i] = arr_elem_conv;
1289 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
1294 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
1295 LDKThirtyTwoBytes a_ref;
1296 CHECK((*_env)->GetArrayLength (_env, a) == 32);
1297 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
1299 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
1300 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
1301 if (b_constr.datalen > 0)
1302 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
1304 b_constr.data = NULL;
1305 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
1306 for (size_t a = 0; a < b_constr.datalen; a++) {
1307 long arr_conv_26 = b_vals[a];
1308 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
1309 FREE((void*)arr_conv_26);
1310 b_constr.data[a] = arr_conv_26_conv;
1312 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
1316 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
1317 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
1318 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
1319 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
1322 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
1323 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *tuple = (LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)ptr;
1324 LDKCVec_C2Tuple_u32TxOutZZ b_var = tuple->b;
1325 jlongArray b_arr = (*_env)->NewLongArray(_env, b_var.datalen);
1326 jlong *b_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, b_arr, NULL);
1327 for (size_t a = 0; a < b_var.datalen; a++) {
1328 long arr_conv_26_ref = (long)&b_var.data[a];
1329 b_arr_ptr[a] = arr_conv_26_ref;
1331 (*_env)->ReleasePrimitiveArrayCritical(_env, b_arr, b_arr_ptr, 0);
1334 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1335 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *vec = (LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ*)ptr;
1336 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ));
1338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
1339 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ");
1340 ret->datalen = (*env)->GetArrayLength(env, elems);
1341 if (ret->datalen == 0) {
1344 ret->data = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) * ret->datalen, "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Data");
1345 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1346 for (size_t i = 0; i < ret->datalen; i++) {
1347 jlong arr_elem = java_elems[i];
1348 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_elem_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_elem;
1349 FREE((void*)arr_elem);
1350 ret->data[i] = arr_elem_conv;
1352 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1356 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1SignatureZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1357 LDKCVec_SignatureZ *vec = (LDKCVec_SignatureZ*)ptr;
1358 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
1360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
1361 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1363 CHECK((*_env)->GetArrayLength (_env, a) == 64);
1364 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
1366 LDKCVec_SignatureZ b_constr;
1367 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
1368 if (b_constr.datalen > 0)
1369 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
1371 b_constr.data = NULL;
1372 for (size_t i = 0; i < b_constr.datalen; i++) {
1373 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
1374 LDKSignature arr_conv_8_ref;
1375 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
1376 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
1377 b_constr.data[i] = arr_conv_8_ref;
1382 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
1383 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
1384 jbyteArray a_arr = (*_env)->NewByteArray(_env, 64);
1385 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 64, tuple->a.compact_form);
1388 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
1389 LDKC2Tuple_SignatureCVec_SignatureZZ *tuple = (LDKC2Tuple_SignatureCVec_SignatureZZ*)ptr;
1390 LDKCVec_SignatureZ b_var = tuple->b;
1391 jobjectArray b_arr = (*_env)->NewObjectArray(_env, b_var.datalen, arr_of_B_clz, NULL);
1392 for (size_t i = 0; i < b_var.datalen; i++) {
1393 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
1394 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
1395 (*_env)->SetObjectArrayElement(_env, b_arr, i, arr_conv_8_arr);
1399 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1400 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
1402 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1403 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
1404 CHECK(val->result_ok);
1405 long res_ref = (long)&(*val->contents.result);
1408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1409 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
1410 CHECK(!val->result_ok);
1411 return *val->contents.err;
1413 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1414 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
1416 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1417 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
1418 CHECK(val->result_ok);
1419 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
1420 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
1423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1424 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
1425 CHECK(!val->result_ok);
1426 return *val->contents.err;
1428 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1429 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
1431 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1432 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
1433 CHECK(val->result_ok);
1434 LDKCVec_SignatureZ res_var = (*val->contents.result);
1435 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, arr_of_B_clz, NULL);
1436 for (size_t i = 0; i < res_var.datalen; i++) {
1437 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
1438 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
1439 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
1443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1444 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
1445 CHECK(!val->result_ok);
1446 return *val->contents.err;
1448 typedef struct LDKChannelKeys_JCalls {
1449 atomic_size_t refcnt;
1452 jmethodID get_per_commitment_point_meth;
1453 jmethodID release_commitment_secret_meth;
1454 jmethodID key_derivation_params_meth;
1455 jmethodID sign_counterparty_commitment_meth;
1456 jmethodID sign_holder_commitment_meth;
1457 jmethodID sign_holder_commitment_htlc_transactions_meth;
1458 jmethodID sign_justice_transaction_meth;
1459 jmethodID sign_counterparty_htlc_transaction_meth;
1460 jmethodID sign_closing_transaction_meth;
1461 jmethodID sign_channel_announcement_meth;
1462 jmethodID ready_channel_meth;
1463 jmethodID write_meth;
1464 } LDKChannelKeys_JCalls;
1465 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1466 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1468 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1469 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1471 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1472 LDKPublicKey arg_ref;
1473 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1474 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1477 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1478 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1480 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1481 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1483 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1484 LDKThirtyTwoBytes arg_ref;
1485 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1486 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1489 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1490 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1492 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1493 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1495 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1496 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1500 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx) {
1501 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1503 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1504 LDKCommitmentTransaction commitment_tx_var = *commitment_tx;
1505 if (commitment_tx->inner != NULL)
1506 commitment_tx_var = CommitmentTransaction_clone(commitment_tx);
1507 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1508 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1509 long commitment_tx_ref = (long)commitment_tx_var.inner;
1510 if (commitment_tx_var.is_owned) {
1511 commitment_tx_ref |= 1;
1513 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1515 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref);
1516 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1520 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) {
1521 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1523 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1524 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1525 if (commitment_tx->inner != NULL)
1526 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1527 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1528 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1529 long commitment_tx_ref = (long)commitment_tx_var.inner;
1530 if (commitment_tx_var.is_owned) {
1531 commitment_tx_ref |= 1;
1533 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1535 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, commitment_tx_ref);
1536 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1540 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) {
1541 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1543 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1544 LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
1545 if (commitment_tx->inner != NULL)
1546 commitment_tx_var = HolderCommitmentTransaction_clone(commitment_tx);
1547 CHECK((((long)commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1548 CHECK((((long)&commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1549 long commitment_tx_ref = (long)commitment_tx_var.inner;
1550 if (commitment_tx_var.is_owned) {
1551 commitment_tx_ref |= 1;
1553 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1555 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, commitment_tx_ref);
1556 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1560 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc) {
1561 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1563 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1564 LDKTransaction justice_tx_var = justice_tx;
1565 jbyteArray justice_tx_arr = (*_env)->NewByteArray(_env, justice_tx_var.datalen);
1566 (*_env)->SetByteArrayRegion(_env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1567 Transaction_free(justice_tx_var);
1568 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1569 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1570 LDKHTLCOutputInCommitment htlc_var = *htlc;
1571 if (htlc->inner != NULL)
1572 htlc_var = HTLCOutputInCommitment_clone(htlc);
1573 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1574 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1575 long htlc_ref = (long)htlc_var.inner;
1576 if (htlc_var.is_owned) {
1579 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1581 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);
1582 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1586 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc) {
1587 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1589 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1590 LDKTransaction htlc_tx_var = htlc_tx;
1591 jbyteArray htlc_tx_arr = (*_env)->NewByteArray(_env, htlc_tx_var.datalen);
1592 (*_env)->SetByteArrayRegion(_env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
1593 Transaction_free(htlc_tx_var);
1594 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1595 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1596 LDKHTLCOutputInCommitment htlc_var = *htlc;
1597 if (htlc->inner != NULL)
1598 htlc_var = HTLCOutputInCommitment_clone(htlc);
1599 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1600 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1601 long htlc_ref = (long)htlc_var.inner;
1602 if (htlc_var.is_owned) {
1605 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1607 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);
1608 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1612 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, struct LDKTransaction closing_tx) {
1613 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1615 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1616 LDKTransaction closing_tx_var = closing_tx;
1617 jbyteArray closing_tx_arr = (*_env)->NewByteArray(_env, closing_tx_var.datalen);
1618 (*_env)->SetByteArrayRegion(_env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
1619 Transaction_free(closing_tx_var);
1620 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1622 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
1623 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1627 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg) {
1628 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1630 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1631 LDKUnsignedChannelAnnouncement msg_var = *msg;
1632 if (msg->inner != NULL)
1633 msg_var = UnsignedChannelAnnouncement_clone(msg);
1634 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1635 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1636 long msg_ref = (long)msg_var.inner;
1637 if (msg_var.is_owned) {
1640 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1642 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
1643 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1647 void ready_channel_jcall(void* this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters) {
1648 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1650 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1651 LDKChannelTransactionParameters channel_parameters_var = *channel_parameters;
1652 if (channel_parameters->inner != NULL)
1653 channel_parameters_var = ChannelTransactionParameters_clone(channel_parameters);
1654 CHECK((((long)channel_parameters_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1655 CHECK((((long)&channel_parameters_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1656 long channel_parameters_ref = (long)channel_parameters_var.inner;
1657 if (channel_parameters_var.is_owned) {
1658 channel_parameters_ref |= 1;
1660 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1662 return (*_env)->CallVoidMethod(_env, obj, j_calls->ready_channel_meth, channel_parameters_ref);
1664 LDKCVec_u8Z write_jcall(const void* this_arg) {
1665 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1667 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1668 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1670 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->write_meth);
1671 LDKCVec_u8Z arg_ref;
1672 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
1673 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
1674 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
1677 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1678 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1679 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1681 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1682 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1686 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1687 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1688 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1689 return (void*) this_arg;
1691 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
1692 jclass c = (*env)->GetObjectClass(env, o);
1694 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1695 atomic_init(&calls->refcnt, 1);
1696 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1697 calls->o = (*env)->NewWeakGlobalRef(env, o);
1698 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1699 CHECK(calls->get_per_commitment_point_meth != NULL);
1700 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1701 CHECK(calls->release_commitment_secret_meth != NULL);
1702 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1703 CHECK(calls->key_derivation_params_meth != NULL);
1704 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
1705 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1706 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1707 CHECK(calls->sign_holder_commitment_meth != NULL);
1708 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1709 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1710 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
1711 CHECK(calls->sign_justice_transaction_meth != NULL);
1712 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
1713 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1714 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
1715 CHECK(calls->sign_closing_transaction_meth != NULL);
1716 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1717 CHECK(calls->sign_channel_announcement_meth != NULL);
1718 calls->ready_channel_meth = (*env)->GetMethodID(env, c, "ready_channel", "(J)V");
1719 CHECK(calls->ready_channel_meth != NULL);
1720 calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
1721 CHECK(calls->write_meth != NULL);
1723 LDKChannelPublicKeys pubkeys_conv;
1724 pubkeys_conv.inner = (void*)(pubkeys & (~1));
1725 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
1726 if (pubkeys_conv.inner != NULL)
1727 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
1729 LDKChannelKeys ret = {
1730 .this_arg = (void*) calls,
1731 .get_per_commitment_point = get_per_commitment_point_jcall,
1732 .release_commitment_secret = release_commitment_secret_jcall,
1733 .key_derivation_params = key_derivation_params_jcall,
1734 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1735 .sign_holder_commitment = sign_holder_commitment_jcall,
1736 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1737 .sign_justice_transaction = sign_justice_transaction_jcall,
1738 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1739 .sign_closing_transaction = sign_closing_transaction_jcall,
1740 .sign_channel_announcement = sign_channel_announcement_jcall,
1741 .ready_channel = ready_channel_jcall,
1742 .clone = LDKChannelKeys_JCalls_clone,
1743 .write = write_jcall,
1744 .free = LDKChannelKeys_JCalls_free,
1745 .pubkeys = pubkeys_conv,
1746 .set_pubkeys = NULL,
1750 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
1751 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1752 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
1753 return (long)res_ptr;
1755 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1756 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1760 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1761 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1762 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1763 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1767 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1768 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1769 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1770 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1775 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1776 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1777 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1778 return (long)ret_ref;
1781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong commitment_tx) {
1782 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1783 LDKCommitmentTransaction commitment_tx_conv;
1784 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1785 commitment_tx_conv.is_owned = false;
1786 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1787 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1788 return (long)ret_conv;
1791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong commitment_tx) {
1792 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1793 LDKHolderCommitmentTransaction commitment_tx_conv;
1794 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1795 commitment_tx_conv.is_owned = false;
1796 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1797 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &commitment_tx_conv);
1798 return (long)ret_conv;
1801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong this_arg, jlong commitment_tx) {
1802 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1803 LDKHolderCommitmentTransaction commitment_tx_conv;
1804 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
1805 commitment_tx_conv.is_owned = false;
1806 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1807 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &commitment_tx_conv);
1808 return (long)ret_conv;
1811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
1812 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1813 LDKTransaction justice_tx_ref;
1814 justice_tx_ref.datalen = (*_env)->GetArrayLength (_env, justice_tx);
1815 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
1816 (*_env)->GetByteArrayRegion(_env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
1817 justice_tx_ref.data_is_owned = true;
1818 unsigned char per_commitment_key_arr[32];
1819 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
1820 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1821 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1822 LDKHTLCOutputInCommitment htlc_conv;
1823 htlc_conv.inner = (void*)(htlc & (~1));
1824 htlc_conv.is_owned = false;
1825 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1826 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
1827 return (long)ret_conv;
1830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
1831 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1832 LDKTransaction htlc_tx_ref;
1833 htlc_tx_ref.datalen = (*_env)->GetArrayLength (_env, htlc_tx);
1834 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
1835 (*_env)->GetByteArrayRegion(_env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
1836 htlc_tx_ref.data_is_owned = true;
1837 LDKPublicKey per_commitment_point_ref;
1838 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
1839 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1840 LDKHTLCOutputInCommitment htlc_conv;
1841 htlc_conv.inner = (void*)(htlc & (~1));
1842 htlc_conv.is_owned = false;
1843 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1844 *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);
1845 return (long)ret_conv;
1848 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray closing_tx) {
1849 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1850 LDKTransaction closing_tx_ref;
1851 closing_tx_ref.datalen = (*_env)->GetArrayLength (_env, closing_tx);
1852 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
1853 (*_env)->GetByteArrayRegion(_env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
1854 closing_tx_ref.data_is_owned = true;
1855 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1856 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
1857 return (long)ret_conv;
1860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
1861 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1862 LDKUnsignedChannelAnnouncement msg_conv;
1863 msg_conv.inner = (void*)(msg & (~1));
1864 msg_conv.is_owned = false;
1865 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1866 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1867 return (long)ret_conv;
1870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1ready_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_parameters) {
1871 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1872 LDKChannelTransactionParameters channel_parameters_conv;
1873 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
1874 channel_parameters_conv.is_owned = false;
1875 (this_arg_conv->ready_channel)(this_arg_conv->this_arg, &channel_parameters_conv);
1878 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv * _env, jclass _b, jlong this_arg) {
1879 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1880 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
1881 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
1882 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
1883 CVec_u8Z_free(arg_var);
1887 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
1888 if (this_arg->set_pubkeys != NULL)
1889 this_arg->set_pubkeys(this_arg);
1890 return this_arg->pubkeys;
1892 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
1893 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1894 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
1895 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1896 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1897 long ret_ref = (long)ret_var.inner;
1898 if (ret_var.is_owned) {
1904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
1905 LDKC2Tuple_BlockHashChannelMonitorZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
1906 LDKThirtyTwoBytes a_ref;
1907 CHECK((*_env)->GetArrayLength (_env, a) == 32);
1908 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
1910 LDKChannelMonitor b_conv;
1911 b_conv.inner = (void*)(b & (~1));
1912 b_conv.is_owned = (b & 1) || (b == 0);
1913 // Warning: we may need a move here but can't clone!
1917 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
1918 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1919 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
1920 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
1923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelMonitorZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
1924 LDKC2Tuple_BlockHashChannelMonitorZ *tuple = (LDKC2Tuple_BlockHashChannelMonitorZ*)ptr;
1925 LDKChannelMonitor b_var = tuple->b;
1926 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1927 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1928 long b_ref = (long)b_var.inner & ~1;
1931 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1932 return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
1934 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1935 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1936 CHECK(val->result_ok);
1937 long res_ref = (long)&(*val->contents.result);
1940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1941 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg;
1942 CHECK(!val->result_ok);
1943 LDKDecodeError err_var = (*val->contents.err);
1944 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1945 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1946 long err_ref = (long)err_var.inner & ~1;
1949 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1950 return ((LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg)->result_ok;
1952 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1953 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1954 CHECK(val->result_ok);
1955 long res_ref = (long)&(*val->contents.result);
1958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1959 LDKCResult_SpendableOutputDescriptorDecodeErrorZ *val = (LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)arg;
1960 CHECK(!val->result_ok);
1961 LDKDecodeError err_var = (*val->contents.err);
1962 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1963 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1964 long err_ref = (long)err_var.inner & ~1;
1967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1968 return ((LDKCResult_ChanKeySignerDecodeErrorZ*)arg)->result_ok;
1970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1971 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1972 CHECK(val->result_ok);
1973 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1974 *ret = (*val->contents.result);
1977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChanKeySignerDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1978 LDKCResult_ChanKeySignerDecodeErrorZ *val = (LDKCResult_ChanKeySignerDecodeErrorZ*)arg;
1979 CHECK(!val->result_ok);
1980 LDKDecodeError err_var = (*val->contents.err);
1981 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1982 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1983 long err_ref = (long)err_var.inner & ~1;
1986 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1987 return ((LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg)->result_ok;
1989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1990 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
1991 CHECK(val->result_ok);
1992 LDKInMemoryChannelKeys res_var = (*val->contents.result);
1993 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1994 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1995 long res_ref = (long)res_var.inner & ~1;
1998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InMemoryChannelKeysDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1999 LDKCResult_InMemoryChannelKeysDecodeErrorZ *val = (LDKCResult_InMemoryChannelKeysDecodeErrorZ*)arg;
2000 CHECK(!val->result_ok);
2001 LDKDecodeError err_var = (*val->contents.err);
2002 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2003 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2004 long err_ref = (long)err_var.inner & ~1;
2007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2008 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
2010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
2011 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
2012 CHECK(val->result_ok);
2013 long res_ref = (long)&(*val->contents.result);
2014 return (long)res_ref;
2016 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
2017 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
2018 CHECK(!val->result_ok);
2019 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
2022 static jclass LDKAPIError_APIMisuseError_class = NULL;
2023 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
2024 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
2025 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
2026 static jclass LDKAPIError_RouteError_class = NULL;
2027 static jmethodID LDKAPIError_RouteError_meth = NULL;
2028 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
2029 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
2030 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
2031 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
2032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
2033 LDKAPIError_APIMisuseError_class =
2034 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
2035 CHECK(LDKAPIError_APIMisuseError_class != NULL);
2036 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
2037 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
2038 LDKAPIError_FeeRateTooHigh_class =
2039 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
2040 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
2041 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
2042 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
2043 LDKAPIError_RouteError_class =
2044 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
2045 CHECK(LDKAPIError_RouteError_class != NULL);
2046 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
2047 CHECK(LDKAPIError_RouteError_meth != NULL);
2048 LDKAPIError_ChannelUnavailable_class =
2049 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
2050 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
2051 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
2052 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
2053 LDKAPIError_MonitorUpdateFailed_class =
2054 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
2055 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
2056 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
2057 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
2059 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2060 LDKAPIError *obj = (LDKAPIError*)ptr;
2062 case LDKAPIError_APIMisuseError: {
2063 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
2064 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
2065 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
2066 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
2068 case LDKAPIError_FeeRateTooHigh: {
2069 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
2070 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
2071 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
2072 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
2074 case LDKAPIError_RouteError: {
2075 LDKStr err_str = obj->route_error.err;
2076 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
2077 memcpy(err_buf, err_str.chars, err_str.len);
2078 err_buf[err_str.len] = 0;
2079 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
2081 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
2083 case LDKAPIError_ChannelUnavailable: {
2084 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
2085 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
2086 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
2087 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
2089 case LDKAPIError_MonitorUpdateFailed: {
2090 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
2095 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2096 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
2098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
2099 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
2100 CHECK(val->result_ok);
2101 return *val->contents.result;
2103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
2104 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
2105 CHECK(!val->result_ok);
2106 long err_ref = (long)&(*val->contents.err);
2109 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2110 LDKCVec_ChannelDetailsZ *vec = (LDKCVec_ChannelDetailsZ*)ptr;
2111 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2112 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2113 for (size_t i = 0; i < vec->datalen; i++) {
2114 CHECK((((long)vec->data[i].inner) & 1) == 0);
2115 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2117 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelDetailsZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
2121 LDKCVec_ChannelDetailsZ *ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2122 ret->datalen = (*env)->GetArrayLength(env, elems);
2123 if (ret->datalen == 0) {
2126 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVec_ChannelDetailsZ Data");
2127 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2128 for (size_t i = 0; i < ret->datalen; i++) {
2129 jlong arr_elem = java_elems[i];
2130 LDKChannelDetails arr_elem_conv;
2131 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2132 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2133 if (arr_elem_conv.inner != NULL)
2134 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2135 ret->data[i] = arr_elem_conv;
2137 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2141 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2142 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
2144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
2145 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
2146 CHECK(val->result_ok);
2147 return *val->contents.result;
2149 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
2150 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
2151 CHECK(!val->result_ok);
2152 LDKPaymentSendFailure err_var = (*val->contents.err);
2153 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2154 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2155 long err_ref = (long)err_var.inner & ~1;
2158 static jclass LDKNetAddress_IPv4_class = NULL;
2159 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2160 static jclass LDKNetAddress_IPv6_class = NULL;
2161 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2162 static jclass LDKNetAddress_OnionV2_class = NULL;
2163 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2164 static jclass LDKNetAddress_OnionV3_class = NULL;
2165 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2167 LDKNetAddress_IPv4_class =
2168 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2169 CHECK(LDKNetAddress_IPv4_class != NULL);
2170 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2171 CHECK(LDKNetAddress_IPv4_meth != NULL);
2172 LDKNetAddress_IPv6_class =
2173 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2174 CHECK(LDKNetAddress_IPv6_class != NULL);
2175 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2176 CHECK(LDKNetAddress_IPv6_meth != NULL);
2177 LDKNetAddress_OnionV2_class =
2178 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2179 CHECK(LDKNetAddress_OnionV2_class != NULL);
2180 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2181 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2182 LDKNetAddress_OnionV3_class =
2183 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2184 CHECK(LDKNetAddress_OnionV3_class != NULL);
2185 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2186 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2188 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2189 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2191 case LDKNetAddress_IPv4: {
2192 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2193 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2194 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2196 case LDKNetAddress_IPv6: {
2197 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2198 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2199 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2201 case LDKNetAddress_OnionV2: {
2202 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2203 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2204 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2206 case LDKNetAddress_OnionV3: {
2207 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2208 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2209 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);
2214 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2215 LDKCVec_NetAddressZ *vec = (LDKCVec_NetAddressZ*)ptr;
2216 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NetAddressZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
2219 LDKCVec_NetAddressZ *ret = MALLOC(sizeof(LDKCVec_NetAddressZ), "LDKCVec_NetAddressZ");
2220 ret->datalen = (*env)->GetArrayLength(env, elems);
2221 if (ret->datalen == 0) {
2224 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVec_NetAddressZ Data");
2225 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2226 for (size_t i = 0; i < ret->datalen; i++) {
2227 jlong arr_elem = java_elems[i];
2228 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2229 FREE((void*)arr_elem);
2230 ret->data[i] = arr_elem_conv;
2232 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2236 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2237 LDKCVec_ChannelMonitorZ *vec = (LDKCVec_ChannelMonitorZ*)ptr;
2238 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2239 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2240 for (size_t i = 0; i < vec->datalen; i++) {
2241 CHECK((((long)vec->data[i].inner) & 1) == 0);
2242 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2244 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1ChannelMonitorZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
2248 LDKCVec_ChannelMonitorZ *ret = MALLOC(sizeof(LDKCVec_ChannelMonitorZ), "LDKCVec_ChannelMonitorZ");
2249 ret->datalen = (*env)->GetArrayLength(env, elems);
2250 if (ret->datalen == 0) {
2253 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVec_ChannelMonitorZ Data");
2254 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2255 for (size_t i = 0; i < ret->datalen; i++) {
2256 jlong arr_elem = java_elems[i];
2257 LDKChannelMonitor arr_elem_conv;
2258 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2259 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2260 // Warning: we may need a move here but can't clone!
2261 ret->data[i] = arr_elem_conv;
2263 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2267 typedef struct LDKWatch_JCalls {
2268 atomic_size_t refcnt;
2271 jmethodID watch_channel_meth;
2272 jmethodID update_channel_meth;
2273 jmethodID release_pending_monitor_events_meth;
2275 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor) {
2276 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2278 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2279 LDKOutPoint funding_txo_var = funding_txo;
2280 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2281 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2282 long funding_txo_ref = (long)funding_txo_var.inner;
2283 if (funding_txo_var.is_owned) {
2284 funding_txo_ref |= 1;
2286 LDKChannelMonitor monitor_var = monitor;
2287 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2288 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2289 long monitor_ref = (long)monitor_var.inner;
2290 if (monitor_var.is_owned) {
2293 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2295 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2296 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2300 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update) {
2301 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2303 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2304 LDKOutPoint funding_txo_var = funding_txo;
2305 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2306 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2307 long funding_txo_ref = (long)funding_txo_var.inner;
2308 if (funding_txo_var.is_owned) {
2309 funding_txo_ref |= 1;
2311 LDKChannelMonitorUpdate update_var = update;
2312 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2313 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2314 long update_ref = (long)update_var.inner;
2315 if (update_var.is_owned) {
2318 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2320 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2321 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2325 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2326 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2328 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2329 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2331 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2332 LDKCVec_MonitorEventZ arg_constr;
2333 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2334 if (arg_constr.datalen > 0)
2335 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2337 arg_constr.data = NULL;
2338 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2339 for (size_t o = 0; o < arg_constr.datalen; o++) {
2340 long arr_conv_14 = arg_vals[o];
2341 LDKMonitorEvent arr_conv_14_conv;
2342 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2343 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2344 if (arr_conv_14_conv.inner != NULL)
2345 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2346 arg_constr.data[o] = arr_conv_14_conv;
2348 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2351 static void LDKWatch_JCalls_free(void* this_arg) {
2352 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2353 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2355 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2356 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2360 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2361 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2362 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2363 return (void*) this_arg;
2365 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2366 jclass c = (*env)->GetObjectClass(env, o);
2368 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2369 atomic_init(&calls->refcnt, 1);
2370 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2371 calls->o = (*env)->NewWeakGlobalRef(env, o);
2372 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2373 CHECK(calls->watch_channel_meth != NULL);
2374 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2375 CHECK(calls->update_channel_meth != NULL);
2376 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2377 CHECK(calls->release_pending_monitor_events_meth != NULL);
2380 .this_arg = (void*) calls,
2381 .watch_channel = watch_channel_jcall,
2382 .update_channel = update_channel_jcall,
2383 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2384 .free = LDKWatch_JCalls_free,
2388 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2389 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2390 *res_ptr = LDKWatch_init(env, _a, o);
2391 return (long)res_ptr;
2393 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2394 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2399 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2400 LDKOutPoint funding_txo_conv;
2401 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2402 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2403 if (funding_txo_conv.inner != NULL)
2404 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2405 LDKChannelMonitor monitor_conv;
2406 monitor_conv.inner = (void*)(monitor & (~1));
2407 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2408 // Warning: we may need a move here but can't clone!
2409 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2410 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2411 return (long)ret_conv;
2414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2415 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2416 LDKOutPoint funding_txo_conv;
2417 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2418 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2419 if (funding_txo_conv.inner != NULL)
2420 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2421 LDKChannelMonitorUpdate update_conv;
2422 update_conv.inner = (void*)(update & (~1));
2423 update_conv.is_owned = (update & 1) || (update == 0);
2424 if (update_conv.inner != NULL)
2425 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2426 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2427 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2428 return (long)ret_conv;
2431 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2432 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2433 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2434 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2435 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2436 for (size_t o = 0; o < ret_var.datalen; o++) {
2437 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2438 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2439 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2440 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2441 if (arr_conv_14_var.is_owned) {
2442 arr_conv_14_ref |= 1;
2444 ret_arr_ptr[o] = arr_conv_14_ref;
2446 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2451 typedef struct LDKBroadcasterInterface_JCalls {
2452 atomic_size_t refcnt;
2455 jmethodID broadcast_transaction_meth;
2456 } LDKBroadcasterInterface_JCalls;
2457 void broadcast_transaction_jcall(const void* this_arg, struct LDKTransaction tx) {
2458 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2460 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2461 LDKTransaction tx_var = tx;
2462 jbyteArray tx_arr = (*_env)->NewByteArray(_env, tx_var.datalen);
2463 (*_env)->SetByteArrayRegion(_env, tx_arr, 0, tx_var.datalen, tx_var.data);
2464 Transaction_free(tx_var);
2465 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2467 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2469 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2470 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2471 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2473 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2474 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2478 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2479 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2480 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2481 return (void*) this_arg;
2483 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2484 jclass c = (*env)->GetObjectClass(env, o);
2486 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2487 atomic_init(&calls->refcnt, 1);
2488 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2489 calls->o = (*env)->NewWeakGlobalRef(env, o);
2490 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2491 CHECK(calls->broadcast_transaction_meth != NULL);
2493 LDKBroadcasterInterface ret = {
2494 .this_arg = (void*) calls,
2495 .broadcast_transaction = broadcast_transaction_jcall,
2496 .free = LDKBroadcasterInterface_JCalls_free,
2500 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2501 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2502 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2503 return (long)res_ptr;
2505 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2506 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray tx) {
2511 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2512 LDKTransaction tx_ref;
2513 tx_ref.datalen = (*_env)->GetArrayLength (_env, tx);
2514 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2515 (*_env)->GetByteArrayRegion(_env, tx, 0, tx_ref.datalen, tx_ref.data);
2516 tx_ref.data_is_owned = true;
2517 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2520 typedef struct LDKKeysInterface_JCalls {
2521 atomic_size_t refcnt;
2524 jmethodID get_node_secret_meth;
2525 jmethodID get_destination_script_meth;
2526 jmethodID get_shutdown_pubkey_meth;
2527 jmethodID get_channel_keys_meth;
2528 jmethodID get_secure_random_bytes_meth;
2529 jmethodID read_chan_signer_meth;
2530 } LDKKeysInterface_JCalls;
2531 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2532 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2534 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2535 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2537 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2538 LDKSecretKey arg_ref;
2539 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2540 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2543 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2544 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2546 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2547 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2549 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2550 LDKCVec_u8Z arg_ref;
2551 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2552 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2553 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
2556 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2557 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2559 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2560 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2562 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2563 LDKPublicKey arg_ref;
2564 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2565 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2568 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2569 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2571 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2572 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2574 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2575 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2576 ret_conv = ChannelKeys_clone(ret);
2579 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2580 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2582 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2583 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2585 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2586 LDKThirtyTwoBytes arg_ref;
2587 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2588 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2591 LDKCResult_ChanKeySignerDecodeErrorZ read_chan_signer_jcall(const void* this_arg, struct LDKu8slice reader) {
2592 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2594 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2595 LDKu8slice reader_var = reader;
2596 jbyteArray reader_arr = (*_env)->NewByteArray(_env, reader_var.datalen);
2597 (*_env)->SetByteArrayRegion(_env, reader_arr, 0, reader_var.datalen, reader_var.data);
2598 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2600 LDKCResult_ChanKeySignerDecodeErrorZ* ret = (LDKCResult_ChanKeySignerDecodeErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->read_chan_signer_meth, reader_arr);
2601 LDKCResult_ChanKeySignerDecodeErrorZ ret_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)ret;
2605 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2606 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2607 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2609 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2610 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2614 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2615 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2616 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2617 return (void*) this_arg;
2619 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2620 jclass c = (*env)->GetObjectClass(env, o);
2622 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2623 atomic_init(&calls->refcnt, 1);
2624 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2625 calls->o = (*env)->NewWeakGlobalRef(env, o);
2626 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2627 CHECK(calls->get_node_secret_meth != NULL);
2628 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2629 CHECK(calls->get_destination_script_meth != NULL);
2630 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2631 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2632 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2633 CHECK(calls->get_channel_keys_meth != NULL);
2634 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2635 CHECK(calls->get_secure_random_bytes_meth != NULL);
2636 calls->read_chan_signer_meth = (*env)->GetMethodID(env, c, "read_chan_signer", "([B)J");
2637 CHECK(calls->read_chan_signer_meth != NULL);
2639 LDKKeysInterface ret = {
2640 .this_arg = (void*) calls,
2641 .get_node_secret = get_node_secret_jcall,
2642 .get_destination_script = get_destination_script_jcall,
2643 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2644 .get_channel_keys = get_channel_keys_jcall,
2645 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2646 .read_chan_signer = read_chan_signer_jcall,
2647 .free = LDKKeysInterface_JCalls_free,
2651 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2652 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2653 *res_ptr = LDKKeysInterface_init(env, _a, o);
2654 return (long)res_ptr;
2656 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2657 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2661 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2662 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2663 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2664 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2668 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2669 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2670 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2671 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2672 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2673 CVec_u8Z_free(arg_var);
2677 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2678 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2679 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2680 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jboolean inbound, jlong channel_value_satoshis) {
2685 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2686 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2687 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2691 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2692 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2693 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2694 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1signer(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray reader) {
2699 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2700 LDKu8slice reader_ref;
2701 reader_ref.datalen = (*_env)->GetArrayLength (_env, reader);
2702 reader_ref.data = (*_env)->GetByteArrayElements (_env, reader, NULL);
2703 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
2704 *ret_conv = (this_arg_conv->read_chan_signer)(this_arg_conv->this_arg, reader_ref);
2705 (*_env)->ReleaseByteArrayElements(_env, reader, (int8_t*)reader_ref.data, 0);
2706 return (long)ret_conv;
2709 typedef struct LDKFeeEstimator_JCalls {
2710 atomic_size_t refcnt;
2713 jmethodID get_est_sat_per_1000_weight_meth;
2714 } LDKFeeEstimator_JCalls;
2715 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, enum LDKConfirmationTarget confirmation_target) {
2716 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2718 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2719 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2720 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2722 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2724 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2725 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2726 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2728 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2729 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2733 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2734 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2735 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2736 return (void*) this_arg;
2738 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2739 jclass c = (*env)->GetObjectClass(env, o);
2741 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2742 atomic_init(&calls->refcnt, 1);
2743 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2744 calls->o = (*env)->NewWeakGlobalRef(env, o);
2745 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2746 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2748 LDKFeeEstimator ret = {
2749 .this_arg = (void*) calls,
2750 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2751 .free = LDKFeeEstimator_JCalls_free,
2755 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2756 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2757 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2758 return (long)res_ptr;
2760 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2761 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2765 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1get_1est_1sat_1per_11000_1weight(JNIEnv * _env, jclass _b, jlong this_arg, jclass confirmation_target) {
2766 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2767 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2768 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2772 typedef struct LDKLogger_JCalls {
2773 atomic_size_t refcnt;
2778 void log_jcall(const void* this_arg, const char *record) {
2779 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2781 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2782 jstring record_conv = (*_env)->NewStringUTF(_env, record);
2783 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2785 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
2787 static void LDKLogger_JCalls_free(void* this_arg) {
2788 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2789 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2791 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2792 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2796 static void* LDKLogger_JCalls_clone(const void* this_arg) {
2797 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
2798 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2799 return (void*) this_arg;
2801 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
2802 jclass c = (*env)->GetObjectClass(env, o);
2804 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
2805 atomic_init(&calls->refcnt, 1);
2806 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2807 calls->o = (*env)->NewWeakGlobalRef(env, o);
2808 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
2809 CHECK(calls->log_meth != NULL);
2812 .this_arg = (void*) calls,
2814 .free = LDKLogger_JCalls_free,
2818 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
2819 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
2820 *res_ptr = LDKLogger_init(env, _a, o);
2821 return (long)res_ptr;
2823 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2824 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
2828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
2829 LDKC2Tuple_BlockHashChannelManagerZ* ret = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
2830 LDKThirtyTwoBytes a_ref;
2831 CHECK((*_env)->GetArrayLength (_env, a) == 32);
2832 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
2834 LDKChannelManager b_conv;
2835 b_conv.inner = (void*)(b & (~1));
2836 b_conv.is_owned = (b & 1) || (b == 0);
2837 // Warning: we may need a move here but can't clone!
2841 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
2842 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2843 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
2844 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
2847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1BlockHashChannelManagerZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
2848 LDKC2Tuple_BlockHashChannelManagerZ *tuple = (LDKC2Tuple_BlockHashChannelManagerZ*)ptr;
2849 LDKChannelManager b_var = tuple->b;
2850 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2851 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2852 long b_ref = (long)b_var.inner & ~1;
2855 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2856 return ((LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg)->result_ok;
2858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
2859 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2860 CHECK(val->result_ok);
2861 long res_ref = (long)&(*val->contents.result);
2864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
2865 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)arg;
2866 CHECK(!val->result_ok);
2867 LDKDecodeError err_var = (*val->contents.err);
2868 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2869 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2870 long err_ref = (long)err_var.inner & ~1;
2873 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2874 return ((LDKCResult_NetAddressu8Z*)arg)->result_ok;
2876 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
2877 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2878 CHECK(val->result_ok);
2879 long res_ref = (long)&(*val->contents.result);
2882 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetAddressu8Z_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
2883 LDKCResult_NetAddressu8Z *val = (LDKCResult_NetAddressu8Z*)arg;
2884 CHECK(!val->result_ok);
2885 return *val->contents.err;
2887 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
2888 return ((LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg)->result_ok;
2890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
2891 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2892 CHECK(val->result_ok);
2893 LDKCResult_NetAddressu8Z* res_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
2894 *res_conv = (*val->contents.result);
2895 return (long)res_conv;
2897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CResult_1NetAddressu8ZDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
2898 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ *val = (LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)arg;
2899 CHECK(!val->result_ok);
2900 LDKDecodeError err_var = (*val->contents.err);
2901 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2902 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2903 long err_ref = (long)err_var.inner & ~1;
2906 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2907 LDKCVec_u64Z *vec = (LDKCVec_u64Z*)ptr;
2908 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
2910 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1u64Z_1new(JNIEnv *env, jclass _b, jlongArray elems){
2911 LDKCVec_u64Z *ret = MALLOC(sizeof(LDKCVec_u64Z), "LDKCVec_u64Z");
2912 ret->datalen = (*env)->GetArrayLength(env, elems);
2913 if (ret->datalen == 0) {
2916 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVec_u64Z Data");
2917 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2918 for (size_t i = 0; i < ret->datalen; i++) {
2919 ret->data[i] = java_elems[i];
2921 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2925 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2926 LDKCVec_UpdateAddHTLCZ *vec = (LDKCVec_UpdateAddHTLCZ*)ptr;
2927 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2928 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2929 for (size_t i = 0; i < vec->datalen; i++) {
2930 CHECK((((long)vec->data[i].inner) & 1) == 0);
2931 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2933 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2936 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateAddHTLCZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
2937 LDKCVec_UpdateAddHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateAddHTLCZ), "LDKCVec_UpdateAddHTLCZ");
2938 ret->datalen = (*env)->GetArrayLength(env, elems);
2939 if (ret->datalen == 0) {
2942 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVec_UpdateAddHTLCZ Data");
2943 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2944 for (size_t i = 0; i < ret->datalen; i++) {
2945 jlong arr_elem = java_elems[i];
2946 LDKUpdateAddHTLC arr_elem_conv;
2947 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2948 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2949 if (arr_elem_conv.inner != NULL)
2950 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
2951 ret->data[i] = arr_elem_conv;
2953 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2957 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2958 LDKCVec_UpdateFulfillHTLCZ *vec = (LDKCVec_UpdateFulfillHTLCZ*)ptr;
2959 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2960 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2961 for (size_t i = 0; i < vec->datalen; i++) {
2962 CHECK((((long)vec->data[i].inner) & 1) == 0);
2963 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2965 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFulfillHTLCZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
2969 LDKCVec_UpdateFulfillHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFulfillHTLCZ), "LDKCVec_UpdateFulfillHTLCZ");
2970 ret->datalen = (*env)->GetArrayLength(env, elems);
2971 if (ret->datalen == 0) {
2974 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVec_UpdateFulfillHTLCZ Data");
2975 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2976 for (size_t i = 0; i < ret->datalen; i++) {
2977 jlong arr_elem = java_elems[i];
2978 LDKUpdateFulfillHTLC arr_elem_conv;
2979 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2980 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2981 if (arr_elem_conv.inner != NULL)
2982 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
2983 ret->data[i] = arr_elem_conv;
2985 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2989 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2990 LDKCVec_UpdateFailHTLCZ *vec = (LDKCVec_UpdateFailHTLCZ*)ptr;
2991 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2992 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2993 for (size_t i = 0; i < vec->datalen; i++) {
2994 CHECK((((long)vec->data[i].inner) & 1) == 0);
2995 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2997 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailHTLCZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
3001 LDKCVec_UpdateFailHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailHTLCZ), "LDKCVec_UpdateFailHTLCZ");
3002 ret->datalen = (*env)->GetArrayLength(env, elems);
3003 if (ret->datalen == 0) {
3006 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVec_UpdateFailHTLCZ Data");
3007 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3008 for (size_t i = 0; i < ret->datalen; i++) {
3009 jlong arr_elem = java_elems[i];
3010 LDKUpdateFailHTLC arr_elem_conv;
3011 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3012 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3013 if (arr_elem_conv.inner != NULL)
3014 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3015 ret->data[i] = arr_elem_conv;
3017 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3021 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3022 LDKCVec_UpdateFailMalformedHTLCZ *vec = (LDKCVec_UpdateFailMalformedHTLCZ*)ptr;
3023 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3024 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3025 for (size_t i = 0; i < vec->datalen; i++) {
3026 CHECK((((long)vec->data[i].inner) & 1) == 0);
3027 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3029 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3032 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1UpdateFailMalformedHTLCZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
3033 LDKCVec_UpdateFailMalformedHTLCZ *ret = MALLOC(sizeof(LDKCVec_UpdateFailMalformedHTLCZ), "LDKCVec_UpdateFailMalformedHTLCZ");
3034 ret->datalen = (*env)->GetArrayLength(env, elems);
3035 if (ret->datalen == 0) {
3038 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVec_UpdateFailMalformedHTLCZ Data");
3039 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3040 for (size_t i = 0; i < ret->datalen; i++) {
3041 jlong arr_elem = java_elems[i];
3042 LDKUpdateFailMalformedHTLC arr_elem_conv;
3043 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3044 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3045 if (arr_elem_conv.inner != NULL)
3046 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3047 ret->data[i] = arr_elem_conv;
3049 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3053 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3054 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3056 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3057 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3058 CHECK(val->result_ok);
3059 return *val->contents.result;
3061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3062 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3063 CHECK(!val->result_ok);
3064 LDKLightningError err_var = (*val->contents.err);
3065 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3066 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3067 long err_ref = (long)err_var.inner & ~1;
3070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv *_env, jclass _b, jlong a, jlong b, jlong c) {
3071 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
3072 LDKChannelAnnouncement a_conv;
3073 a_conv.inner = (void*)(a & (~1));
3074 a_conv.is_owned = (a & 1) || (a == 0);
3075 if (a_conv.inner != NULL)
3076 a_conv = ChannelAnnouncement_clone(&a_conv);
3078 LDKChannelUpdate b_conv;
3079 b_conv.inner = (void*)(b & (~1));
3080 b_conv.is_owned = (b & 1) || (b == 0);
3081 if (b_conv.inner != NULL)
3082 b_conv = ChannelUpdate_clone(&b_conv);
3084 LDKChannelUpdate c_conv;
3085 c_conv.inner = (void*)(c & (~1));
3086 c_conv.is_owned = (c & 1) || (c == 0);
3087 if (c_conv.inner != NULL)
3088 c_conv = ChannelUpdate_clone(&c_conv);
3092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
3093 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3094 LDKChannelAnnouncement a_var = tuple->a;
3095 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3096 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3097 long a_ref = (long)a_var.inner & ~1;
3100 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
3101 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3102 LDKChannelUpdate b_var = tuple->b;
3103 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3104 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3105 long b_ref = (long)b_var.inner & ~1;
3108 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *_env, jclass _b, jlong ptr) {
3109 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *tuple = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)ptr;
3110 LDKChannelUpdate c_var = tuple->c;
3111 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3112 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3113 long c_ref = (long)c_var.inner & ~1;
3116 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3117 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *vec = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)ptr;
3118 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ));
3120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
3121 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3122 ret->datalen = (*env)->GetArrayLength(env, elems);
3123 if (ret->datalen == 0) {
3126 ret->data = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) * ret->datalen, "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Data");
3127 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3128 for (size_t i = 0; i < ret->datalen; i++) {
3129 jlong arr_elem = java_elems[i];
3130 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_elem_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_elem;
3131 FREE((void*)arr_elem);
3132 ret->data[i] = arr_elem_conv;
3134 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3138 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3139 LDKCVec_NodeAnnouncementZ *vec = (LDKCVec_NodeAnnouncementZ*)ptr;
3140 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3141 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3142 for (size_t i = 0; i < vec->datalen; i++) {
3143 CHECK((((long)vec->data[i].inner) & 1) == 0);
3144 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3146 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3149 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
3150 LDKCVec_NodeAnnouncementZ *ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3151 ret->datalen = (*env)->GetArrayLength(env, elems);
3152 if (ret->datalen == 0) {
3155 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVec_NodeAnnouncementZ Data");
3156 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3157 for (size_t i = 0; i < ret->datalen; i++) {
3158 jlong arr_elem = java_elems[i];
3159 LDKNodeAnnouncement arr_elem_conv;
3160 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3161 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3162 if (arr_elem_conv.inner != NULL)
3163 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3164 ret->data[i] = arr_elem_conv;
3166 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3170 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3171 return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
3173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3174 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
3175 CHECK(val->result_ok);
3176 return *val->contents.result;
3178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3179 LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)arg;
3180 CHECK(!val->result_ok);
3181 LDKLightningError err_var = (*val->contents.err);
3182 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3183 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3184 long err_ref = (long)err_var.inner & ~1;
3187 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3188 return ((LDKCResult_ChannelReestablishDecodeErrorZ*)arg)->result_ok;
3190 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3191 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
3192 CHECK(val->result_ok);
3193 LDKChannelReestablish res_var = (*val->contents.result);
3194 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3195 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3196 long res_ref = (long)res_var.inner & ~1;
3199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelReestablishDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3200 LDKCResult_ChannelReestablishDecodeErrorZ *val = (LDKCResult_ChannelReestablishDecodeErrorZ*)arg;
3201 CHECK(!val->result_ok);
3202 LDKDecodeError err_var = (*val->contents.err);
3203 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3204 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3205 long err_ref = (long)err_var.inner & ~1;
3208 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3209 return ((LDKCResult_InitDecodeErrorZ*)arg)->result_ok;
3211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3212 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
3213 CHECK(val->result_ok);
3214 LDKInit res_var = (*val->contents.result);
3215 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3216 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3217 long res_ref = (long)res_var.inner & ~1;
3220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3221 LDKCResult_InitDecodeErrorZ *val = (LDKCResult_InitDecodeErrorZ*)arg;
3222 CHECK(!val->result_ok);
3223 LDKDecodeError err_var = (*val->contents.err);
3224 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3225 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3226 long err_ref = (long)err_var.inner & ~1;
3229 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3230 return ((LDKCResult_PingDecodeErrorZ*)arg)->result_ok;
3232 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3233 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
3234 CHECK(val->result_ok);
3235 LDKPing res_var = (*val->contents.result);
3236 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3237 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3238 long res_ref = (long)res_var.inner & ~1;
3241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PingDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3242 LDKCResult_PingDecodeErrorZ *val = (LDKCResult_PingDecodeErrorZ*)arg;
3243 CHECK(!val->result_ok);
3244 LDKDecodeError err_var = (*val->contents.err);
3245 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3246 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3247 long err_ref = (long)err_var.inner & ~1;
3250 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3251 return ((LDKCResult_PongDecodeErrorZ*)arg)->result_ok;
3253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3254 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
3255 CHECK(val->result_ok);
3256 LDKPong res_var = (*val->contents.result);
3257 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3258 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3259 long res_ref = (long)res_var.inner & ~1;
3262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PongDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3263 LDKCResult_PongDecodeErrorZ *val = (LDKCResult_PongDecodeErrorZ*)arg;
3264 CHECK(!val->result_ok);
3265 LDKDecodeError err_var = (*val->contents.err);
3266 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3267 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3268 long err_ref = (long)err_var.inner & ~1;
3271 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3272 return ((LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg)->result_ok;
3274 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3275 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
3276 CHECK(val->result_ok);
3277 LDKUnsignedChannelAnnouncement res_var = (*val->contents.result);
3278 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3279 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3280 long res_ref = (long)res_var.inner & ~1;
3283 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelAnnouncementDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3284 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)arg;
3285 CHECK(!val->result_ok);
3286 LDKDecodeError err_var = (*val->contents.err);
3287 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3288 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3289 long err_ref = (long)err_var.inner & ~1;
3292 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3293 return ((LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg)->result_ok;
3295 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3296 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
3297 CHECK(val->result_ok);
3298 LDKUnsignedChannelUpdate res_var = (*val->contents.result);
3299 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3300 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3301 long res_ref = (long)res_var.inner & ~1;
3304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedChannelUpdateDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3305 LDKCResult_UnsignedChannelUpdateDecodeErrorZ *val = (LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)arg;
3306 CHECK(!val->result_ok);
3307 LDKDecodeError err_var = (*val->contents.err);
3308 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3309 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3310 long err_ref = (long)err_var.inner & ~1;
3313 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3314 return ((LDKCResult_ErrorMessageDecodeErrorZ*)arg)->result_ok;
3316 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3317 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
3318 CHECK(val->result_ok);
3319 LDKErrorMessage res_var = (*val->contents.result);
3320 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3321 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3322 long res_ref = (long)res_var.inner & ~1;
3325 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ErrorMessageDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3326 LDKCResult_ErrorMessageDecodeErrorZ *val = (LDKCResult_ErrorMessageDecodeErrorZ*)arg;
3327 CHECK(!val->result_ok);
3328 LDKDecodeError err_var = (*val->contents.err);
3329 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3330 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3331 long err_ref = (long)err_var.inner & ~1;
3334 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3335 return ((LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg)->result_ok;
3337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3338 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
3339 CHECK(val->result_ok);
3340 LDKUnsignedNodeAnnouncement res_var = (*val->contents.result);
3341 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3342 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3343 long res_ref = (long)res_var.inner & ~1;
3346 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1UnsignedNodeAnnouncementDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3347 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *val = (LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)arg;
3348 CHECK(!val->result_ok);
3349 LDKDecodeError err_var = (*val->contents.err);
3350 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3351 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3352 long err_ref = (long)err_var.inner & ~1;
3355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3356 return ((LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg)->result_ok;
3358 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3359 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
3360 CHECK(val->result_ok);
3361 LDKQueryShortChannelIds res_var = (*val->contents.result);
3362 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3363 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3364 long res_ref = (long)res_var.inner & ~1;
3367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryShortChannelIdsDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3368 LDKCResult_QueryShortChannelIdsDecodeErrorZ *val = (LDKCResult_QueryShortChannelIdsDecodeErrorZ*)arg;
3369 CHECK(!val->result_ok);
3370 LDKDecodeError err_var = (*val->contents.err);
3371 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3372 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3373 long err_ref = (long)err_var.inner & ~1;
3376 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3377 return ((LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg)->result_ok;
3379 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3380 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
3381 CHECK(val->result_ok);
3382 LDKReplyShortChannelIdsEnd res_var = (*val->contents.result);
3383 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3384 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3385 long res_ref = (long)res_var.inner & ~1;
3388 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyShortChannelIdsEndDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3389 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *val = (LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)arg;
3390 CHECK(!val->result_ok);
3391 LDKDecodeError err_var = (*val->contents.err);
3392 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3393 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3394 long err_ref = (long)err_var.inner & ~1;
3397 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3398 return ((LDKCResult_QueryChannelRangeDecodeErrorZ*)arg)->result_ok;
3400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3401 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
3402 CHECK(val->result_ok);
3403 LDKQueryChannelRange res_var = (*val->contents.result);
3404 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3405 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3406 long res_ref = (long)res_var.inner & ~1;
3409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1QueryChannelRangeDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3410 LDKCResult_QueryChannelRangeDecodeErrorZ *val = (LDKCResult_QueryChannelRangeDecodeErrorZ*)arg;
3411 CHECK(!val->result_ok);
3412 LDKDecodeError err_var = (*val->contents.err);
3413 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3414 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3415 long err_ref = (long)err_var.inner & ~1;
3418 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3419 return ((LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg)->result_ok;
3421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3422 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
3423 CHECK(val->result_ok);
3424 LDKReplyChannelRange res_var = (*val->contents.result);
3425 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3426 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3427 long res_ref = (long)res_var.inner & ~1;
3430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ReplyChannelRangeDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3431 LDKCResult_ReplyChannelRangeDecodeErrorZ *val = (LDKCResult_ReplyChannelRangeDecodeErrorZ*)arg;
3432 CHECK(!val->result_ok);
3433 LDKDecodeError err_var = (*val->contents.err);
3434 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3435 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3436 long err_ref = (long)err_var.inner & ~1;
3439 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3440 return ((LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg)->result_ok;
3442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3443 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
3444 CHECK(val->result_ok);
3445 LDKGossipTimestampFilter res_var = (*val->contents.result);
3446 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3447 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3448 long res_ref = (long)res_var.inner & ~1;
3451 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1GossipTimestampFilterDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3452 LDKCResult_GossipTimestampFilterDecodeErrorZ *val = (LDKCResult_GossipTimestampFilterDecodeErrorZ*)arg;
3453 CHECK(!val->result_ok);
3454 LDKDecodeError err_var = (*val->contents.err);
3455 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3456 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3457 long err_ref = (long)err_var.inner & ~1;
3460 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1PublicKeyZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3461 LDKCVec_PublicKeyZ *vec = (LDKCVec_PublicKeyZ*)ptr;
3462 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3465 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3468 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3469 CHECK(val->result_ok);
3470 LDKCVec_u8Z res_var = (*val->contents.result);
3471 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
3472 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
3475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3476 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3477 CHECK(!val->result_ok);
3478 LDKPeerHandleError err_var = (*val->contents.err);
3479 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3480 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3481 long err_ref = (long)err_var.inner & ~1;
3484 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3485 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
3487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3488 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
3489 CHECK(val->result_ok);
3490 return *val->contents.result;
3492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3493 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
3494 CHECK(!val->result_ok);
3495 LDKPeerHandleError err_var = (*val->contents.err);
3496 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3497 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3498 long err_ref = (long)err_var.inner & ~1;
3501 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3502 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3505 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3506 CHECK(val->result_ok);
3507 return *val->contents.result;
3509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3510 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3511 CHECK(!val->result_ok);
3512 LDKPeerHandleError err_var = (*val->contents.err);
3513 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3514 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3515 long err_ref = (long)err_var.inner & ~1;
3518 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3519 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3521 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3522 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3523 CHECK(val->result_ok);
3524 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
3525 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
3528 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3529 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3530 CHECK(!val->result_ok);
3531 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3534 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3535 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3537 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3538 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3539 CHECK(val->result_ok);
3540 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
3541 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
3544 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3545 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3546 CHECK(!val->result_ok);
3547 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3551 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3554 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3555 CHECK(val->result_ok);
3556 LDKTxCreationKeys res_var = (*val->contents.result);
3557 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3558 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3559 long res_ref = (long)res_var.inner & ~1;
3562 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3563 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3564 CHECK(!val->result_ok);
3565 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3568 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3569 return ((LDKCResult_TrustedCommitmentTransactionNoneZ*)arg)->result_ok;
3571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3572 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
3573 CHECK(val->result_ok);
3574 LDKTrustedCommitmentTransaction res_var = (*val->contents.result);
3575 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3576 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3577 long res_ref = (long)res_var.inner & ~1;
3580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedCommitmentTransactionNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3581 LDKCResult_TrustedCommitmentTransactionNoneZ *val = (LDKCResult_TrustedCommitmentTransactionNoneZ*)arg;
3582 CHECK(!val->result_ok);
3583 return *val->contents.err;
3585 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3586 LDKCVec_RouteHopZ *vec = (LDKCVec_RouteHopZ*)ptr;
3587 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3588 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3589 for (size_t i = 0; i < vec->datalen; i++) {
3590 CHECK((((long)vec->data[i].inner) & 1) == 0);
3591 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3593 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHopZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
3597 LDKCVec_RouteHopZ *ret = MALLOC(sizeof(LDKCVec_RouteHopZ), "LDKCVec_RouteHopZ");
3598 ret->datalen = (*env)->GetArrayLength(env, elems);
3599 if (ret->datalen == 0) {
3602 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVec_RouteHopZ Data");
3603 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3604 for (size_t i = 0; i < ret->datalen; i++) {
3605 jlong arr_elem = java_elems[i];
3606 LDKRouteHop arr_elem_conv;
3607 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3608 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3609 if (arr_elem_conv.inner != NULL)
3610 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3611 ret->data[i] = arr_elem_conv;
3613 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3617 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVec_1CVec_1RouteHopZZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3618 LDKCVec_CVec_RouteHopZZ *vec = (LDKCVec_CVec_RouteHopZZ*)ptr;
3619 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVec_RouteHopZ));
3621 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3622 return ((LDKCResult_RouteDecodeErrorZ*)arg)->result_ok;
3624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3625 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
3626 CHECK(val->result_ok);
3627 LDKRoute res_var = (*val->contents.result);
3628 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3629 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3630 long res_ref = (long)res_var.inner & ~1;
3633 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3634 LDKCResult_RouteDecodeErrorZ *val = (LDKCResult_RouteDecodeErrorZ*)arg;
3635 CHECK(!val->result_ok);
3636 LDKDecodeError err_var = (*val->contents.err);
3637 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3638 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3639 long err_ref = (long)err_var.inner & ~1;
3642 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3643 LDKCVec_RouteHintZ *vec = (LDKCVec_RouteHintZ*)ptr;
3644 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3645 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3646 for (size_t i = 0; i < vec->datalen; i++) {
3647 CHECK((((long)vec->data[i].inner) & 1) == 0);
3648 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3650 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1RouteHintZ_1new(JNIEnv *env, jclass _b, jlongArray elems){
3654 LDKCVec_RouteHintZ *ret = MALLOC(sizeof(LDKCVec_RouteHintZ), "LDKCVec_RouteHintZ");
3655 ret->datalen = (*env)->GetArrayLength(env, elems);
3656 if (ret->datalen == 0) {
3659 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVec_RouteHintZ Data");
3660 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3661 for (size_t i = 0; i < ret->datalen; i++) {
3662 jlong arr_elem = java_elems[i];
3663 LDKRouteHint arr_elem_conv;
3664 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3665 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3666 if (arr_elem_conv.inner != NULL)
3667 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
3668 ret->data[i] = arr_elem_conv;
3670 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3674 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3675 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
3677 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3678 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3679 CHECK(val->result_ok);
3680 LDKRoute res_var = (*val->contents.result);
3681 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3682 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3683 long res_ref = (long)res_var.inner & ~1;
3686 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3687 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
3688 CHECK(!val->result_ok);
3689 LDKLightningError err_var = (*val->contents.err);
3690 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3691 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3692 long err_ref = (long)err_var.inner & ~1;
3695 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3696 return ((LDKCResult_RoutingFeesDecodeErrorZ*)arg)->result_ok;
3698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3699 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
3700 CHECK(val->result_ok);
3701 LDKRoutingFees res_var = (*val->contents.result);
3702 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3703 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3704 long res_ref = (long)res_var.inner & ~1;
3707 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RoutingFeesDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3708 LDKCResult_RoutingFeesDecodeErrorZ *val = (LDKCResult_RoutingFeesDecodeErrorZ*)arg;
3709 CHECK(!val->result_ok);
3710 LDKDecodeError err_var = (*val->contents.err);
3711 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3712 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3713 long err_ref = (long)err_var.inner & ~1;
3716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3717 return ((LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg)->result_ok;
3719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3720 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
3721 CHECK(val->result_ok);
3722 LDKNodeAnnouncementInfo res_var = (*val->contents.result);
3723 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3724 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3725 long res_ref = (long)res_var.inner & ~1;
3728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeAnnouncementInfoDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3729 LDKCResult_NodeAnnouncementInfoDecodeErrorZ *val = (LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)arg;
3730 CHECK(!val->result_ok);
3731 LDKDecodeError err_var = (*val->contents.err);
3732 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3733 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3734 long err_ref = (long)err_var.inner & ~1;
3737 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3738 return ((LDKCResult_NodeInfoDecodeErrorZ*)arg)->result_ok;
3740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3741 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3742 CHECK(val->result_ok);
3743 LDKNodeInfo res_var = (*val->contents.result);
3744 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3745 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3746 long res_ref = (long)res_var.inner & ~1;
3749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeInfoDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3750 LDKCResult_NodeInfoDecodeErrorZ *val = (LDKCResult_NodeInfoDecodeErrorZ*)arg;
3751 CHECK(!val->result_ok);
3752 LDKDecodeError err_var = (*val->contents.err);
3753 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3754 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3755 long err_ref = (long)err_var.inner & ~1;
3758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3759 return ((LDKCResult_NetworkGraphDecodeErrorZ*)arg)->result_ok;
3761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3762 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3763 CHECK(val->result_ok);
3764 LDKNetworkGraph res_var = (*val->contents.result);
3765 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3766 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3767 long res_ref = (long)res_var.inner & ~1;
3770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NetworkGraphDecodeErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3771 LDKCResult_NetworkGraphDecodeErrorZ *val = (LDKCResult_NetworkGraphDecodeErrorZ*)arg;
3772 CHECK(!val->result_ok);
3773 LDKDecodeError err_var = (*val->contents.err);
3774 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3775 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3776 long err_ref = (long)err_var.inner & ~1;
3779 typedef struct LDKMessageSendEventsProvider_JCalls {
3780 atomic_size_t refcnt;
3783 jmethodID get_and_clear_pending_msg_events_meth;
3784 } LDKMessageSendEventsProvider_JCalls;
3785 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
3786 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3788 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3789 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3791 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
3792 LDKCVec_MessageSendEventZ arg_constr;
3793 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3794 if (arg_constr.datalen > 0)
3795 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
3797 arg_constr.data = NULL;
3798 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3799 for (size_t s = 0; s < arg_constr.datalen; s++) {
3800 long arr_conv_18 = arg_vals[s];
3801 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
3802 FREE((void*)arr_conv_18);
3803 arg_constr.data[s] = arr_conv_18_conv;
3805 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3808 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
3809 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3810 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3812 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3813 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3817 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
3818 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
3819 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3820 return (void*) this_arg;
3822 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
3823 jclass c = (*env)->GetObjectClass(env, o);
3825 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
3826 atomic_init(&calls->refcnt, 1);
3827 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3828 calls->o = (*env)->NewWeakGlobalRef(env, o);
3829 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
3830 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
3832 LDKMessageSendEventsProvider ret = {
3833 .this_arg = (void*) calls,
3834 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
3835 .free = LDKMessageSendEventsProvider_JCalls_free,
3839 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
3840 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
3841 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
3842 return (long)res_ptr;
3844 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3845 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
3849 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
3850 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
3851 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
3852 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3853 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3854 for (size_t s = 0; s < ret_var.datalen; s++) {
3855 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
3856 *arr_conv_18_copy = ret_var.data[s];
3857 long arr_conv_18_ref = (long)arr_conv_18_copy;
3858 ret_arr_ptr[s] = arr_conv_18_ref;
3860 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3865 typedef struct LDKEventsProvider_JCalls {
3866 atomic_size_t refcnt;
3869 jmethodID get_and_clear_pending_events_meth;
3870 } LDKEventsProvider_JCalls;
3871 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
3872 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3874 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3875 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3877 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
3878 LDKCVec_EventZ arg_constr;
3879 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
3880 if (arg_constr.datalen > 0)
3881 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
3883 arg_constr.data = NULL;
3884 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
3885 for (size_t h = 0; h < arg_constr.datalen; h++) {
3886 long arr_conv_7 = arg_vals[h];
3887 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
3888 FREE((void*)arr_conv_7);
3889 arg_constr.data[h] = arr_conv_7_conv;
3891 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
3894 static void LDKEventsProvider_JCalls_free(void* this_arg) {
3895 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3896 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3898 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3899 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3903 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
3904 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
3905 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3906 return (void*) this_arg;
3908 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
3909 jclass c = (*env)->GetObjectClass(env, o);
3911 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
3912 atomic_init(&calls->refcnt, 1);
3913 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3914 calls->o = (*env)->NewWeakGlobalRef(env, o);
3915 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
3916 CHECK(calls->get_and_clear_pending_events_meth != NULL);
3918 LDKEventsProvider ret = {
3919 .this_arg = (void*) calls,
3920 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
3921 .free = LDKEventsProvider_JCalls_free,
3925 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
3926 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
3927 *res_ptr = LDKEventsProvider_init(env, _a, o);
3928 return (long)res_ptr;
3930 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3931 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
3935 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
3936 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
3937 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
3938 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3939 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3940 for (size_t h = 0; h < ret_var.datalen; h++) {
3941 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
3942 *arr_conv_7_copy = ret_var.data[h];
3943 long arr_conv_7_ref = (long)arr_conv_7_copy;
3944 ret_arr_ptr[h] = arr_conv_7_ref;
3946 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3951 typedef struct LDKAccess_JCalls {
3952 atomic_size_t refcnt;
3955 jmethodID get_utxo_meth;
3957 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
3958 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3960 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3961 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
3962 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
3963 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3965 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
3966 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
3970 static void LDKAccess_JCalls_free(void* this_arg) {
3971 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3972 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3974 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3975 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3979 static void* LDKAccess_JCalls_clone(const void* this_arg) {
3980 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
3981 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3982 return (void*) this_arg;
3984 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
3985 jclass c = (*env)->GetObjectClass(env, o);
3987 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
3988 atomic_init(&calls->refcnt, 1);
3989 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3990 calls->o = (*env)->NewWeakGlobalRef(env, o);
3991 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
3992 CHECK(calls->get_utxo_meth != NULL);
3995 .this_arg = (void*) calls,
3996 .get_utxo = get_utxo_jcall,
3997 .free = LDKAccess_JCalls_free,
4001 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
4002 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
4003 *res_ptr = LDKAccess_init(env, _a, o);
4004 return (long)res_ptr;
4006 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4007 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
4011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray genesis_hash, jlong short_channel_id) {
4012 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
4013 unsigned char genesis_hash_arr[32];
4014 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
4015 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
4016 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
4017 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4018 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
4019 return (long)ret_conv;
4022 typedef struct LDKFilter_JCalls {
4023 atomic_size_t refcnt;
4026 jmethodID register_tx_meth;
4027 jmethodID register_output_meth;
4029 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey) {
4030 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4032 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4033 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
4034 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
4035 LDKu8slice script_pubkey_var = script_pubkey;
4036 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
4037 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4038 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4040 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
4042 void register_output_jcall(const void* this_arg, const struct LDKOutPoint *NONNULL_PTR outpoint, struct LDKu8slice script_pubkey) {
4043 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4045 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4046 LDKOutPoint outpoint_var = *outpoint;
4047 if (outpoint->inner != NULL)
4048 outpoint_var = OutPoint_clone(outpoint);
4049 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4050 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4051 long outpoint_ref = (long)outpoint_var.inner;
4052 if (outpoint_var.is_owned) {
4055 LDKu8slice script_pubkey_var = script_pubkey;
4056 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
4057 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
4058 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4060 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
4062 static void LDKFilter_JCalls_free(void* this_arg) {
4063 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4064 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4066 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4067 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4071 static void* LDKFilter_JCalls_clone(const void* this_arg) {
4072 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
4073 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4074 return (void*) this_arg;
4076 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
4077 jclass c = (*env)->GetObjectClass(env, o);
4079 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
4080 atomic_init(&calls->refcnt, 1);
4081 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4082 calls->o = (*env)->NewWeakGlobalRef(env, o);
4083 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
4084 CHECK(calls->register_tx_meth != NULL);
4085 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
4086 CHECK(calls->register_output_meth != NULL);
4089 .this_arg = (void*) calls,
4090 .register_tx = register_tx_jcall,
4091 .register_output = register_output_jcall,
4092 .free = LDKFilter_JCalls_free,
4096 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
4097 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
4098 *res_ptr = LDKFilter_init(env, _a, o);
4099 return (long)res_ptr;
4101 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4102 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
4106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
4107 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4108 unsigned char txid_arr[32];
4109 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
4110 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
4111 unsigned char (*txid_ref)[32] = &txid_arr;
4112 LDKu8slice script_pubkey_ref;
4113 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
4114 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
4115 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
4116 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
4120 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
4121 LDKOutPoint outpoint_conv;
4122 outpoint_conv.inner = (void*)(outpoint & (~1));
4123 outpoint_conv.is_owned = false;
4124 LDKu8slice script_pubkey_ref;
4125 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
4126 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
4127 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
4128 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
4131 typedef struct LDKPersist_JCalls {
4132 atomic_size_t refcnt;
4135 jmethodID persist_new_channel_meth;
4136 jmethodID update_persisted_channel_meth;
4137 } LDKPersist_JCalls;
4138 LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_jcall(const void* this_arg, struct LDKOutPoint id, const struct LDKChannelMonitor *NONNULL_PTR data) {
4139 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4141 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4142 LDKOutPoint id_var = id;
4143 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4144 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4145 long id_ref = (long)id_var.inner;
4146 if (id_var.is_owned) {
4149 LDKChannelMonitor data_var = *data;
4150 // Warning: we may need a move here but can't clone!
4151 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4152 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4153 long data_ref = (long)data_var.inner;
4154 if (data_var.is_owned) {
4157 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4159 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->persist_new_channel_meth, id_ref, data_ref);
4160 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
4164 LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_jcall(const void* this_arg, struct LDKOutPoint id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data) {
4165 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4167 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4168 LDKOutPoint id_var = id;
4169 CHECK((((long)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4170 CHECK((((long)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4171 long id_ref = (long)id_var.inner;
4172 if (id_var.is_owned) {
4175 LDKChannelMonitorUpdate update_var = *update;
4176 if (update->inner != NULL)
4177 update_var = ChannelMonitorUpdate_clone(update);
4178 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4179 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4180 long update_ref = (long)update_var.inner;
4181 if (update_var.is_owned) {
4184 LDKChannelMonitor data_var = *data;
4185 // Warning: we may need a move here but can't clone!
4186 CHECK((((long)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4187 CHECK((((long)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4188 long data_ref = (long)data_var.inner;
4189 if (data_var.is_owned) {
4192 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4194 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_persisted_channel_meth, id_ref, update_ref, data_ref);
4195 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
4199 static void LDKPersist_JCalls_free(void* this_arg) {
4200 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4201 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4203 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4204 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4208 static void* LDKPersist_JCalls_clone(const void* this_arg) {
4209 LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
4210 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4211 return (void*) this_arg;
4213 static inline LDKPersist LDKPersist_init (JNIEnv * env, jclass _a, jobject o) {
4214 jclass c = (*env)->GetObjectClass(env, o);
4216 LDKPersist_JCalls *calls = MALLOC(sizeof(LDKPersist_JCalls), "LDKPersist_JCalls");
4217 atomic_init(&calls->refcnt, 1);
4218 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4219 calls->o = (*env)->NewWeakGlobalRef(env, o);
4220 calls->persist_new_channel_meth = (*env)->GetMethodID(env, c, "persist_new_channel", "(JJ)J");
4221 CHECK(calls->persist_new_channel_meth != NULL);
4222 calls->update_persisted_channel_meth = (*env)->GetMethodID(env, c, "update_persisted_channel", "(JJJ)J");
4223 CHECK(calls->update_persisted_channel_meth != NULL);
4226 .this_arg = (void*) calls,
4227 .persist_new_channel = persist_new_channel_jcall,
4228 .update_persisted_channel = update_persisted_channel_jcall,
4229 .free = LDKPersist_JCalls_free,
4233 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKPersist_1new (JNIEnv * env, jclass _a, jobject o) {
4234 LDKPersist *res_ptr = MALLOC(sizeof(LDKPersist), "LDKPersist");
4235 *res_ptr = LDKPersist_init(env, _a, o);
4236 return (long)res_ptr;
4238 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPersist_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4239 jobject ret = (*env)->NewLocalRef(env, ((LDKPersist_JCalls*)val)->o);
4243 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Persist_1persist_1new_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong id, jlong data) {
4244 LDKPersist* this_arg_conv = (LDKPersist*)this_arg;
4245 LDKOutPoint id_conv;
4246 id_conv.inner = (void*)(id & (~1));
4247 id_conv.is_owned = (id & 1) || (id == 0);
4248 if (id_conv.inner != NULL)
4249 id_conv = OutPoint_clone(&id_conv);
4250 LDKChannelMonitor data_conv;
4251 data_conv.inner = (void*)(data & (~1));
4252 data_conv.is_owned = false;
4253 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4254 *ret_conv = (this_arg_conv->persist_new_channel)(this_arg_conv->this_arg, id_conv, &data_conv);
4255 return (long)ret_conv;
4258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Persist_1update_1persisted_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong id, jlong update, jlong 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 LDKChannelMonitorUpdate update_conv;
4266 update_conv.inner = (void*)(update & (~1));
4267 update_conv.is_owned = false;
4268 LDKChannelMonitor data_conv;
4269 data_conv.inner = (void*)(data & (~1));
4270 data_conv.is_owned = false;
4271 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4272 *ret_conv = (this_arg_conv->update_persisted_channel)(this_arg_conv->this_arg, id_conv, &update_conv, &data_conv);
4273 return (long)ret_conv;
4276 typedef struct LDKChannelMessageHandler_JCalls {
4277 atomic_size_t refcnt;
4280 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4281 jmethodID handle_open_channel_meth;
4282 jmethodID handle_accept_channel_meth;
4283 jmethodID handle_funding_created_meth;
4284 jmethodID handle_funding_signed_meth;
4285 jmethodID handle_funding_locked_meth;
4286 jmethodID handle_shutdown_meth;
4287 jmethodID handle_closing_signed_meth;
4288 jmethodID handle_update_add_htlc_meth;
4289 jmethodID handle_update_fulfill_htlc_meth;
4290 jmethodID handle_update_fail_htlc_meth;
4291 jmethodID handle_update_fail_malformed_htlc_meth;
4292 jmethodID handle_commitment_signed_meth;
4293 jmethodID handle_revoke_and_ack_meth;
4294 jmethodID handle_update_fee_meth;
4295 jmethodID handle_announcement_signatures_meth;
4296 jmethodID peer_disconnected_meth;
4297 jmethodID peer_connected_meth;
4298 jmethodID handle_channel_reestablish_meth;
4299 jmethodID handle_error_meth;
4300 } LDKChannelMessageHandler_JCalls;
4301 void handle_open_channel_jcall(const void* this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg) {
4302 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4304 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4305 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4306 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4307 LDKInitFeatures their_features_var = their_features;
4308 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4309 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4310 long their_features_ref = (long)their_features_var.inner;
4311 if (their_features_var.is_owned) {
4312 their_features_ref |= 1;
4314 LDKOpenChannel msg_var = *msg;
4315 if (msg->inner != NULL)
4316 msg_var = OpenChannel_clone(msg);
4317 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4318 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4319 long msg_ref = (long)msg_var.inner;
4320 if (msg_var.is_owned) {
4323 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4325 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4327 void handle_accept_channel_jcall(const void* this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg) {
4328 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4330 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4331 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4332 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4333 LDKInitFeatures their_features_var = their_features;
4334 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4335 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4336 long their_features_ref = (long)their_features_var.inner;
4337 if (their_features_var.is_owned) {
4338 their_features_ref |= 1;
4340 LDKAcceptChannel msg_var = *msg;
4341 if (msg->inner != NULL)
4342 msg_var = AcceptChannel_clone(msg);
4343 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4344 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4345 long msg_ref = (long)msg_var.inner;
4346 if (msg_var.is_owned) {
4349 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4351 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
4353 void handle_funding_created_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg) {
4354 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4356 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4357 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4358 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4359 LDKFundingCreated msg_var = *msg;
4360 if (msg->inner != NULL)
4361 msg_var = FundingCreated_clone(msg);
4362 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4363 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4364 long msg_ref = (long)msg_var.inner;
4365 if (msg_var.is_owned) {
4368 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4370 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
4372 void handle_funding_signed_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg) {
4373 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4375 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4376 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4377 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4378 LDKFundingSigned msg_var = *msg;
4379 if (msg->inner != NULL)
4380 msg_var = FundingSigned_clone(msg);
4381 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4382 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4383 long msg_ref = (long)msg_var.inner;
4384 if (msg_var.is_owned) {
4387 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4389 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
4391 void handle_funding_locked_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg) {
4392 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4394 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4395 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4396 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4397 LDKFundingLocked msg_var = *msg;
4398 if (msg->inner != NULL)
4399 msg_var = FundingLocked_clone(msg);
4400 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4401 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4402 long msg_ref = (long)msg_var.inner;
4403 if (msg_var.is_owned) {
4406 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4408 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
4410 void handle_shutdown_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg) {
4411 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4413 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4414 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4415 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4416 LDKShutdown msg_var = *msg;
4417 if (msg->inner != NULL)
4418 msg_var = Shutdown_clone(msg);
4419 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4420 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4421 long msg_ref = (long)msg_var.inner;
4422 if (msg_var.is_owned) {
4425 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4427 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
4429 void handle_closing_signed_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg) {
4430 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4432 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4433 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4434 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4435 LDKClosingSigned msg_var = *msg;
4436 if (msg->inner != NULL)
4437 msg_var = ClosingSigned_clone(msg);
4438 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4439 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4440 long msg_ref = (long)msg_var.inner;
4441 if (msg_var.is_owned) {
4444 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4446 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
4448 void handle_update_add_htlc_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg) {
4449 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4451 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4452 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4453 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4454 LDKUpdateAddHTLC msg_var = *msg;
4455 if (msg->inner != NULL)
4456 msg_var = UpdateAddHTLC_clone(msg);
4457 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4458 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4459 long msg_ref = (long)msg_var.inner;
4460 if (msg_var.is_owned) {
4463 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4465 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
4467 void handle_update_fulfill_htlc_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg) {
4468 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4470 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4471 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4472 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4473 LDKUpdateFulfillHTLC msg_var = *msg;
4474 if (msg->inner != NULL)
4475 msg_var = UpdateFulfillHTLC_clone(msg);
4476 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4477 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4478 long msg_ref = (long)msg_var.inner;
4479 if (msg_var.is_owned) {
4482 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4484 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
4486 void handle_update_fail_htlc_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg) {
4487 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4489 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4490 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4491 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4492 LDKUpdateFailHTLC msg_var = *msg;
4493 if (msg->inner != NULL)
4494 msg_var = UpdateFailHTLC_clone(msg);
4495 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4496 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4497 long msg_ref = (long)msg_var.inner;
4498 if (msg_var.is_owned) {
4501 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4503 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
4505 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg) {
4506 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4508 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4509 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4510 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4511 LDKUpdateFailMalformedHTLC msg_var = *msg;
4512 if (msg->inner != NULL)
4513 msg_var = UpdateFailMalformedHTLC_clone(msg);
4514 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4515 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4516 long msg_ref = (long)msg_var.inner;
4517 if (msg_var.is_owned) {
4520 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4522 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
4524 void handle_commitment_signed_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg) {
4525 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4527 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4528 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4529 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4530 LDKCommitmentSigned msg_var = *msg;
4531 if (msg->inner != NULL)
4532 msg_var = CommitmentSigned_clone(msg);
4533 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4534 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4535 long msg_ref = (long)msg_var.inner;
4536 if (msg_var.is_owned) {
4539 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4541 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
4543 void handle_revoke_and_ack_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg) {
4544 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4546 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4547 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4548 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4549 LDKRevokeAndACK msg_var = *msg;
4550 if (msg->inner != NULL)
4551 msg_var = RevokeAndACK_clone(msg);
4552 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4553 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4554 long msg_ref = (long)msg_var.inner;
4555 if (msg_var.is_owned) {
4558 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4560 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
4562 void handle_update_fee_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg) {
4563 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4565 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4566 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4567 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4568 LDKUpdateFee msg_var = *msg;
4569 if (msg->inner != NULL)
4570 msg_var = UpdateFee_clone(msg);
4571 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4572 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4573 long msg_ref = (long)msg_var.inner;
4574 if (msg_var.is_owned) {
4577 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4579 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
4581 void handle_announcement_signatures_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg) {
4582 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4584 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4585 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4586 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4587 LDKAnnouncementSignatures msg_var = *msg;
4588 if (msg->inner != NULL)
4589 msg_var = AnnouncementSignatures_clone(msg);
4590 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4591 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4592 long msg_ref = (long)msg_var.inner;
4593 if (msg_var.is_owned) {
4596 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4598 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
4600 void peer_disconnected_jcall(const void* this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible) {
4601 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4603 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4604 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4605 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4606 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4608 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
4610 void peer_connected_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg) {
4611 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4613 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4614 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4615 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4616 LDKInit msg_var = *msg;
4617 if (msg->inner != NULL)
4618 msg_var = Init_clone(msg);
4619 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4620 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4621 long msg_ref = (long)msg_var.inner;
4622 if (msg_var.is_owned) {
4625 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4627 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
4629 void handle_channel_reestablish_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg) {
4630 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4632 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4633 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4634 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4635 LDKChannelReestablish msg_var = *msg;
4636 if (msg->inner != NULL)
4637 msg_var = ChannelReestablish_clone(msg);
4638 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4639 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4640 long msg_ref = (long)msg_var.inner;
4641 if (msg_var.is_owned) {
4644 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4646 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
4648 void handle_error_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg) {
4649 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4651 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4652 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
4653 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
4654 LDKErrorMessage msg_var = *msg;
4655 if (msg->inner != NULL)
4656 msg_var = ErrorMessage_clone(msg);
4657 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4658 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4659 long msg_ref = (long)msg_var.inner;
4660 if (msg_var.is_owned) {
4663 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4665 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
4667 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
4668 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4669 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4671 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4672 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4676 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
4677 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
4678 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4679 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
4680 return (void*) this_arg;
4682 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
4683 jclass c = (*env)->GetObjectClass(env, o);
4685 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
4686 atomic_init(&calls->refcnt, 1);
4687 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4688 calls->o = (*env)->NewWeakGlobalRef(env, o);
4689 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
4690 CHECK(calls->handle_open_channel_meth != NULL);
4691 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
4692 CHECK(calls->handle_accept_channel_meth != NULL);
4693 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
4694 CHECK(calls->handle_funding_created_meth != NULL);
4695 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
4696 CHECK(calls->handle_funding_signed_meth != NULL);
4697 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
4698 CHECK(calls->handle_funding_locked_meth != NULL);
4699 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
4700 CHECK(calls->handle_shutdown_meth != NULL);
4701 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
4702 CHECK(calls->handle_closing_signed_meth != NULL);
4703 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
4704 CHECK(calls->handle_update_add_htlc_meth != NULL);
4705 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
4706 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
4707 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
4708 CHECK(calls->handle_update_fail_htlc_meth != NULL);
4709 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
4710 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
4711 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
4712 CHECK(calls->handle_commitment_signed_meth != NULL);
4713 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
4714 CHECK(calls->handle_revoke_and_ack_meth != NULL);
4715 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
4716 CHECK(calls->handle_update_fee_meth != NULL);
4717 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
4718 CHECK(calls->handle_announcement_signatures_meth != NULL);
4719 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
4720 CHECK(calls->peer_disconnected_meth != NULL);
4721 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
4722 CHECK(calls->peer_connected_meth != NULL);
4723 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
4724 CHECK(calls->handle_channel_reestablish_meth != NULL);
4725 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
4726 CHECK(calls->handle_error_meth != NULL);
4728 LDKChannelMessageHandler ret = {
4729 .this_arg = (void*) calls,
4730 .handle_open_channel = handle_open_channel_jcall,
4731 .handle_accept_channel = handle_accept_channel_jcall,
4732 .handle_funding_created = handle_funding_created_jcall,
4733 .handle_funding_signed = handle_funding_signed_jcall,
4734 .handle_funding_locked = handle_funding_locked_jcall,
4735 .handle_shutdown = handle_shutdown_jcall,
4736 .handle_closing_signed = handle_closing_signed_jcall,
4737 .handle_update_add_htlc = handle_update_add_htlc_jcall,
4738 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
4739 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
4740 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
4741 .handle_commitment_signed = handle_commitment_signed_jcall,
4742 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
4743 .handle_update_fee = handle_update_fee_jcall,
4744 .handle_announcement_signatures = handle_announcement_signatures_jcall,
4745 .peer_disconnected = peer_disconnected_jcall,
4746 .peer_connected = peer_connected_jcall,
4747 .handle_channel_reestablish = handle_channel_reestablish_jcall,
4748 .handle_error = handle_error_jcall,
4749 .free = LDKChannelMessageHandler_JCalls_free,
4750 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
4752 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
4755 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
4756 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
4757 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
4758 return (long)res_ptr;
4760 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4761 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
4765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1open_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
4766 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4767 LDKPublicKey their_node_id_ref;
4768 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4769 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4770 LDKInitFeatures their_features_conv;
4771 their_features_conv.inner = (void*)(their_features & (~1));
4772 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4773 // Warning: we may need a move here but can't clone!
4774 LDKOpenChannel msg_conv;
4775 msg_conv.inner = (void*)(msg & (~1));
4776 msg_conv.is_owned = false;
4777 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1accept_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong their_features, jlong msg) {
4781 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4782 LDKPublicKey their_node_id_ref;
4783 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4784 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4785 LDKInitFeatures their_features_conv;
4786 their_features_conv.inner = (void*)(their_features & (~1));
4787 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
4788 // Warning: we may need a move here but can't clone!
4789 LDKAcceptChannel msg_conv;
4790 msg_conv.inner = (void*)(msg & (~1));
4791 msg_conv.is_owned = false;
4792 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
4795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1created(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4796 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4797 LDKPublicKey their_node_id_ref;
4798 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4799 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4800 LDKFundingCreated msg_conv;
4801 msg_conv.inner = (void*)(msg & (~1));
4802 msg_conv.is_owned = false;
4803 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4807 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4808 LDKPublicKey their_node_id_ref;
4809 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4810 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4811 LDKFundingSigned msg_conv;
4812 msg_conv.inner = (void*)(msg & (~1));
4813 msg_conv.is_owned = false;
4814 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1funding_1locked(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4818 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4819 LDKPublicKey their_node_id_ref;
4820 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4821 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4822 LDKFundingLocked msg_conv;
4823 msg_conv.inner = (void*)(msg & (~1));
4824 msg_conv.is_owned = false;
4825 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4829 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4830 LDKPublicKey their_node_id_ref;
4831 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4832 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4833 LDKShutdown msg_conv;
4834 msg_conv.inner = (void*)(msg & (~1));
4835 msg_conv.is_owned = false;
4836 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1closing_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4840 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4841 LDKPublicKey their_node_id_ref;
4842 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4843 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4844 LDKClosingSigned msg_conv;
4845 msg_conv.inner = (void*)(msg & (~1));
4846 msg_conv.is_owned = false;
4847 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1add_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4851 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4852 LDKPublicKey their_node_id_ref;
4853 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4854 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4855 LDKUpdateAddHTLC msg_conv;
4856 msg_conv.inner = (void*)(msg & (~1));
4857 msg_conv.is_owned = false;
4858 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fulfill_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4862 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4863 LDKPublicKey their_node_id_ref;
4864 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4865 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4866 LDKUpdateFulfillHTLC msg_conv;
4867 msg_conv.inner = (void*)(msg & (~1));
4868 msg_conv.is_owned = false;
4869 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4873 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4874 LDKPublicKey their_node_id_ref;
4875 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4876 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4877 LDKUpdateFailHTLC msg_conv;
4878 msg_conv.inner = (void*)(msg & (~1));
4879 msg_conv.is_owned = false;
4880 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fail_1malformed_1htlc(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4884 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4885 LDKPublicKey their_node_id_ref;
4886 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4887 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4888 LDKUpdateFailMalformedHTLC msg_conv;
4889 msg_conv.inner = (void*)(msg & (~1));
4890 msg_conv.is_owned = false;
4891 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4895 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4896 LDKPublicKey their_node_id_ref;
4897 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4898 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4899 LDKCommitmentSigned msg_conv;
4900 msg_conv.inner = (void*)(msg & (~1));
4901 msg_conv.is_owned = false;
4902 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1revoke_1and_1ack(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4906 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4907 LDKPublicKey their_node_id_ref;
4908 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4909 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4910 LDKRevokeAndACK msg_conv;
4911 msg_conv.inner = (void*)(msg & (~1));
4912 msg_conv.is_owned = false;
4913 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1update_1fee(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4917 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4918 LDKPublicKey their_node_id_ref;
4919 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4920 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4921 LDKUpdateFee msg_conv;
4922 msg_conv.inner = (void*)(msg & (~1));
4923 msg_conv.is_owned = false;
4924 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1announcement_1signatures(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4928 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4929 LDKPublicKey their_node_id_ref;
4930 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4931 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4932 LDKAnnouncementSignatures msg_conv;
4933 msg_conv.inner = (void*)(msg & (~1));
4934 msg_conv.is_owned = false;
4935 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jboolean no_connection_possible) {
4939 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4940 LDKPublicKey their_node_id_ref;
4941 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4942 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4943 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
4946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4947 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4948 LDKPublicKey their_node_id_ref;
4949 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4950 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4952 msg_conv.inner = (void*)(msg & (~1));
4953 msg_conv.is_owned = false;
4954 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1channel_1reestablish(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4958 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4959 LDKPublicKey their_node_id_ref;
4960 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4961 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4962 LDKChannelReestablish msg_conv;
4963 msg_conv.inner = (void*)(msg & (~1));
4964 msg_conv.is_owned = false;
4965 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
4969 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
4970 LDKPublicKey their_node_id_ref;
4971 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
4972 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
4973 LDKErrorMessage msg_conv;
4974 msg_conv.inner = (void*)(msg & (~1));
4975 msg_conv.is_owned = false;
4976 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
4979 typedef struct LDKRoutingMessageHandler_JCalls {
4980 atomic_size_t refcnt;
4983 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
4984 jmethodID handle_node_announcement_meth;
4985 jmethodID handle_channel_announcement_meth;
4986 jmethodID handle_channel_update_meth;
4987 jmethodID handle_htlc_fail_channel_update_meth;
4988 jmethodID get_next_channel_announcements_meth;
4989 jmethodID get_next_node_announcements_meth;
4990 jmethodID sync_routing_table_meth;
4991 jmethodID handle_reply_channel_range_meth;
4992 jmethodID handle_reply_short_channel_ids_end_meth;
4993 jmethodID handle_query_channel_range_meth;
4994 jmethodID handle_query_short_channel_ids_meth;
4995 } LDKRoutingMessageHandler_JCalls;
4996 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg) {
4997 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4999 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5000 LDKNodeAnnouncement msg_var = *msg;
5001 if (msg->inner != NULL)
5002 msg_var = NodeAnnouncement_clone(msg);
5003 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5004 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5005 long msg_ref = (long)msg_var.inner;
5006 if (msg_var.is_owned) {
5009 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5011 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg_ref);
5012 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5016 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg) {
5017 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5019 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5020 LDKChannelAnnouncement msg_var = *msg;
5021 if (msg->inner != NULL)
5022 msg_var = ChannelAnnouncement_clone(msg);
5023 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5024 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5025 long msg_ref = (long)msg_var.inner;
5026 if (msg_var.is_owned) {
5029 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5031 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
5032 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5036 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg) {
5037 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5039 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5040 LDKChannelUpdate msg_var = *msg;
5041 if (msg->inner != NULL)
5042 msg_var = ChannelUpdate_clone(msg);
5043 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5044 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5045 long msg_ref = (long)msg_var.inner;
5046 if (msg_var.is_owned) {
5049 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5051 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg_ref);
5052 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
5056 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update) {
5057 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5059 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5060 long ret_update = (long)update;
5061 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5063 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
5065 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
5066 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5068 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5069 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5071 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
5072 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
5073 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5074 if (arg_constr.datalen > 0)
5075 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5077 arg_constr.data = NULL;
5078 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5079 for (size_t l = 0; l < arg_constr.datalen; l++) {
5080 long arr_conv_63 = arg_vals[l];
5081 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5082 FREE((void*)arr_conv_63);
5083 arg_constr.data[l] = arr_conv_63_conv;
5085 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5088 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount) {
5089 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5091 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5092 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
5093 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
5094 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5096 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
5097 LDKCVec_NodeAnnouncementZ arg_constr;
5098 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5099 if (arg_constr.datalen > 0)
5100 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5102 arg_constr.data = NULL;
5103 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5104 for (size_t s = 0; s < arg_constr.datalen; s++) {
5105 long arr_conv_18 = arg_vals[s];
5106 LDKNodeAnnouncement arr_conv_18_conv;
5107 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5108 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5109 if (arr_conv_18_conv.inner != NULL)
5110 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
5111 arg_constr.data[s] = arr_conv_18_conv;
5113 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5116 void sync_routing_table_jcall(const void* this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init) {
5117 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5119 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5120 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
5121 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5122 LDKInit init_var = *init;
5123 if (init->inner != NULL)
5124 init_var = Init_clone(init);
5125 CHECK((((long)init_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5126 CHECK((((long)&init_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5127 long init_ref = (long)init_var.inner;
5128 if (init_var.is_owned) {
5131 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5133 return (*_env)->CallVoidMethod(_env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref);
5135 LDKCResult_NoneLightningErrorZ handle_reply_channel_range_jcall(const void* this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg) {
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 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
5140 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5141 LDKReplyChannelRange msg_var = msg;
5142 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5143 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5144 long msg_ref = (long)msg_var.inner;
5145 if (msg_var.is_owned) {
5148 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5150 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref);
5151 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5155 LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_jcall(const void* this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg) {
5156 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5158 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5159 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
5160 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5161 LDKReplyShortChannelIdsEnd msg_var = msg;
5162 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5163 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5164 long msg_ref = (long)msg_var.inner;
5165 if (msg_var.is_owned) {
5168 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5170 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref);
5171 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5175 LDKCResult_NoneLightningErrorZ handle_query_channel_range_jcall(const void* this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg) {
5176 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5178 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5179 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
5180 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5181 LDKQueryChannelRange msg_var = msg;
5182 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5183 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5184 long msg_ref = (long)msg_var.inner;
5185 if (msg_var.is_owned) {
5188 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5190 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref);
5191 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5195 LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_jcall(const void* this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg) {
5196 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5198 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5199 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
5200 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
5201 LDKQueryShortChannelIds msg_var = msg;
5202 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5203 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5204 long msg_ref = (long)msg_var.inner;
5205 if (msg_var.is_owned) {
5208 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5210 LDKCResult_NoneLightningErrorZ* ret = (LDKCResult_NoneLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref);
5211 LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)ret;
5215 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
5216 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5217 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5219 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5220 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5224 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
5225 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
5226 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5227 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
5228 return (void*) this_arg;
5230 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
5231 jclass c = (*env)->GetObjectClass(env, o);
5233 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
5234 atomic_init(&calls->refcnt, 1);
5235 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5236 calls->o = (*env)->NewWeakGlobalRef(env, o);
5237 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
5238 CHECK(calls->handle_node_announcement_meth != NULL);
5239 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
5240 CHECK(calls->handle_channel_announcement_meth != NULL);
5241 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
5242 CHECK(calls->handle_channel_update_meth != NULL);
5243 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
5244 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
5245 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
5246 CHECK(calls->get_next_channel_announcements_meth != NULL);
5247 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
5248 CHECK(calls->get_next_node_announcements_meth != NULL);
5249 calls->sync_routing_table_meth = (*env)->GetMethodID(env, c, "sync_routing_table", "([BJ)V");
5250 CHECK(calls->sync_routing_table_meth != NULL);
5251 calls->handle_reply_channel_range_meth = (*env)->GetMethodID(env, c, "handle_reply_channel_range", "([BJ)J");
5252 CHECK(calls->handle_reply_channel_range_meth != NULL);
5253 calls->handle_reply_short_channel_ids_end_meth = (*env)->GetMethodID(env, c, "handle_reply_short_channel_ids_end", "([BJ)J");
5254 CHECK(calls->handle_reply_short_channel_ids_end_meth != NULL);
5255 calls->handle_query_channel_range_meth = (*env)->GetMethodID(env, c, "handle_query_channel_range", "([BJ)J");
5256 CHECK(calls->handle_query_channel_range_meth != NULL);
5257 calls->handle_query_short_channel_ids_meth = (*env)->GetMethodID(env, c, "handle_query_short_channel_ids", "([BJ)J");
5258 CHECK(calls->handle_query_short_channel_ids_meth != NULL);
5260 LDKRoutingMessageHandler ret = {
5261 .this_arg = (void*) calls,
5262 .handle_node_announcement = handle_node_announcement_jcall,
5263 .handle_channel_announcement = handle_channel_announcement_jcall,
5264 .handle_channel_update = handle_channel_update_jcall,
5265 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
5266 .get_next_channel_announcements = get_next_channel_announcements_jcall,
5267 .get_next_node_announcements = get_next_node_announcements_jcall,
5268 .sync_routing_table = sync_routing_table_jcall,
5269 .handle_reply_channel_range = handle_reply_channel_range_jcall,
5270 .handle_reply_short_channel_ids_end = handle_reply_short_channel_ids_end_jcall,
5271 .handle_query_channel_range = handle_query_channel_range_jcall,
5272 .handle_query_short_channel_ids = handle_query_short_channel_ids_jcall,
5273 .free = LDKRoutingMessageHandler_JCalls_free,
5274 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
5276 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
5279 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
5280 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
5281 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o, MessageSendEventsProvider);
5282 return (long)res_ptr;
5284 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
5285 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
5289 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
5290 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5291 LDKNodeAnnouncement msg_conv;
5292 msg_conv.inner = (void*)(msg & (~1));
5293 msg_conv.is_owned = false;
5294 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5295 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
5296 return (long)ret_conv;
5299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
5300 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5301 LDKChannelAnnouncement msg_conv;
5302 msg_conv.inner = (void*)(msg & (~1));
5303 msg_conv.is_owned = false;
5304 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5305 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
5306 return (long)ret_conv;
5309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
5310 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5311 LDKChannelUpdate msg_conv;
5312 msg_conv.inner = (void*)(msg & (~1));
5313 msg_conv.is_owned = false;
5314 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
5315 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
5316 return (long)ret_conv;
5319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
5320 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5321 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
5322 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
5325 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jlong starting_point, jbyte batch_amount) {
5326 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5327 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
5328 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
5329 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
5330 for (size_t l = 0; l < ret_var.datalen; l++) {
5331 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5332 *arr_conv_63_ref = ret_var.data[l];
5333 ret_arr_ptr[l] = (long)arr_conv_63_ref;
5335 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
5340 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray starting_point, jbyte batch_amount) {
5341 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5342 LDKPublicKey starting_point_ref;
5343 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
5344 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
5345 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
5346 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
5347 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
5348 for (size_t s = 0; s < ret_var.datalen; s++) {
5349 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
5350 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5351 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5352 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
5353 if (arr_conv_18_var.is_owned) {
5354 arr_conv_18_ref |= 1;
5356 ret_arr_ptr[s] = arr_conv_18_ref;
5358 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
5363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong init) {
5364 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5365 LDKPublicKey their_node_id_ref;
5366 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
5367 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5369 init_conv.inner = (void*)(init & (~1));
5370 init_conv.is_owned = false;
5371 (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
5374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
5375 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5376 LDKPublicKey their_node_id_ref;
5377 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
5378 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5379 LDKReplyChannelRange msg_conv;
5380 msg_conv.inner = (void*)(msg & (~1));
5381 msg_conv.is_owned = (msg & 1) || (msg == 0);
5382 if (msg_conv.inner != NULL)
5383 msg_conv = ReplyChannelRange_clone(&msg_conv);
5384 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5385 *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5386 return (long)ret_conv;
5389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
5390 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5391 LDKPublicKey their_node_id_ref;
5392 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
5393 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5394 LDKReplyShortChannelIdsEnd msg_conv;
5395 msg_conv.inner = (void*)(msg & (~1));
5396 msg_conv.is_owned = (msg & 1) || (msg == 0);
5397 if (msg_conv.inner != NULL)
5398 msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
5399 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5400 *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5401 return (long)ret_conv;
5404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
5405 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5406 LDKPublicKey their_node_id_ref;
5407 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
5408 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5409 LDKQueryChannelRange msg_conv;
5410 msg_conv.inner = (void*)(msg & (~1));
5411 msg_conv.is_owned = (msg & 1) || (msg == 0);
5412 if (msg_conv.inner != NULL)
5413 msg_conv = QueryChannelRange_clone(&msg_conv);
5414 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5415 *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5416 return (long)ret_conv;
5419 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
5420 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
5421 LDKPublicKey their_node_id_ref;
5422 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
5423 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
5424 LDKQueryShortChannelIds msg_conv;
5425 msg_conv.inner = (void*)(msg & (~1));
5426 msg_conv.is_owned = (msg & 1) || (msg == 0);
5427 if (msg_conv.inner != NULL)
5428 msg_conv = QueryShortChannelIds_clone(&msg_conv);
5429 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
5430 *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
5431 return (long)ret_conv;
5434 typedef struct LDKSocketDescriptor_JCalls {
5435 atomic_size_t refcnt;
5438 jmethodID send_data_meth;
5439 jmethodID disconnect_socket_meth;
5441 jmethodID hash_meth;
5442 } LDKSocketDescriptor_JCalls;
5443 uintptr_t send_data_jcall(void* this_arg, struct LDKu8slice data, bool resume_read) {
5444 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5446 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5447 LDKu8slice data_var = data;
5448 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
5449 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
5450 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5452 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
5454 void disconnect_socket_jcall(void* this_arg) {
5455 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5457 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5458 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5460 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
5462 bool eq_jcall(const void* this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg) {
5463 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5465 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5466 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5467 *other_arg_clone = SocketDescriptor_clone(other_arg);
5468 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5470 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, (long)other_arg_clone);
5472 uint64_t hash_jcall(const void* this_arg) {
5473 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5475 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
5476 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
5478 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
5480 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
5481 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5482 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
5484 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
5485 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
5489 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
5490 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
5491 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
5492 return (void*) this_arg;
5494 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
5495 jclass c = (*env)->GetObjectClass(env, o);
5497 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
5498 atomic_init(&calls->refcnt, 1);
5499 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
5500 calls->o = (*env)->NewWeakGlobalRef(env, o);
5501 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
5502 CHECK(calls->send_data_meth != NULL);
5503 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
5504 CHECK(calls->disconnect_socket_meth != NULL);
5505 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
5506 CHECK(calls->eq_meth != NULL);
5507 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
5508 CHECK(calls->hash_meth != NULL);
5510 LDKSocketDescriptor ret = {
5511 .this_arg = (void*) calls,
5512 .send_data = send_data_jcall,
5513 .disconnect_socket = disconnect_socket_jcall,
5516 .clone = LDKSocketDescriptor_JCalls_clone,
5517 .free = LDKSocketDescriptor_JCalls_free,
5521 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
5522 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
5523 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
5524 return (long)res_ptr;
5526 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
5527 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
5531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
5532 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5533 LDKu8slice data_ref;
5534 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
5535 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
5536 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
5537 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
5541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
5542 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5543 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
5546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
5547 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
5548 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
5552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jbyteArray _res) {
5553 LDKTransaction _res_ref;
5554 _res_ref.datalen = (*_env)->GetArrayLength (_env, _res);
5555 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5556 (*_env)->GetByteArrayRegion(_env, _res, 0, _res_ref.datalen, _res_ref.data);
5557 _res_ref.data_is_owned = true;
5558 Transaction_free(_res_ref);
5561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5562 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5564 TxOut_free(_res_conv);
5567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxOut_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5568 LDKTxOut* orig_conv = (LDKTxOut*)orig;
5569 LDKTxOut* ret_ref = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
5570 *ret_ref = TxOut_clone(orig_conv);
5571 return (long)ret_ref;
5574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
5575 LDKCVec_SpendableOutputDescriptorZ _res_constr;
5576 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5577 if (_res_constr.datalen > 0)
5578 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5580 _res_constr.data = NULL;
5581 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
5582 for (size_t b = 0; b < _res_constr.datalen; b++) {
5583 long arr_conv_27 = _res_vals[b];
5584 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5585 FREE((void*)arr_conv_27);
5586 _res_constr.data[b] = arr_conv_27_conv;
5588 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
5589 CVec_SpendableOutputDescriptorZ_free(_res_constr);
5592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
5593 LDKCVec_MessageSendEventZ _res_constr;
5594 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5595 if (_res_constr.datalen > 0)
5596 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5598 _res_constr.data = NULL;
5599 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
5600 for (size_t s = 0; s < _res_constr.datalen; s++) {
5601 long arr_conv_18 = _res_vals[s];
5602 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5603 FREE((void*)arr_conv_18);
5604 _res_constr.data[s] = arr_conv_18_conv;
5606 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
5607 CVec_MessageSendEventZ_free(_res_constr);
5610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
5611 LDKCVec_EventZ _res_constr;
5612 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5613 if (_res_constr.datalen > 0)
5614 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5616 _res_constr.data = NULL;
5617 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
5618 for (size_t h = 0; h < _res_constr.datalen; h++) {
5619 long arr_conv_7 = _res_vals[h];
5620 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5621 FREE((void*)arr_conv_7);
5622 _res_constr.data[h] = arr_conv_7_conv;
5624 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
5625 CVec_EventZ_free(_res_constr);
5628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5629 LDKC2Tuple_usizeTransactionZ _res_conv = *(LDKC2Tuple_usizeTransactionZ*)_res;
5631 C2Tuple_usizeTransactionZ_free(_res_conv);
5634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5635 LDKTransaction b_ref;
5636 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5637 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5638 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5639 b_ref.data_is_owned = true;
5640 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5641 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5642 return (long)ret_ref;
5645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
5646 LDKCVec_C2Tuple_usizeTransactionZZ _res_constr;
5647 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5648 if (_res_constr.datalen > 0)
5649 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5651 _res_constr.data = NULL;
5652 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
5653 for (size_t y = 0; y < _res_constr.datalen; y++) {
5654 long arr_conv_24 = _res_vals[y];
5655 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5656 FREE((void*)arr_conv_24);
5657 _res_constr.data[y] = arr_conv_24_conv;
5659 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
5660 CVec_C2Tuple_usizeTransactionZZ_free(_res_constr);
5663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5664 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5665 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5666 return (long)ret_conv;
5669 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass e) {
5670 LDKChannelMonitorUpdateErr e_conv = LDKChannelMonitorUpdateErr_from_java(_env, e);
5671 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5672 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(e_conv);
5673 return (long)ret_conv;
5676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5677 LDKCResult_NoneChannelMonitorUpdateErrZ _res_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)_res;
5679 CResult_NoneChannelMonitorUpdateErrZ_free(_res_conv);
5682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
5683 LDKCVec_MonitorEventZ _res_constr;
5684 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5685 if (_res_constr.datalen > 0)
5686 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5688 _res_constr.data = NULL;
5689 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
5690 for (size_t o = 0; o < _res_constr.datalen; o++) {
5691 long arr_conv_14 = _res_vals[o];
5692 LDKMonitorEvent arr_conv_14_conv;
5693 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5694 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5695 _res_constr.data[o] = arr_conv_14_conv;
5697 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
5698 CVec_MonitorEventZ_free(_res_constr);
5701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
5702 LDKChannelMonitorUpdate o_conv;
5703 o_conv.inner = (void*)(o & (~1));
5704 o_conv.is_owned = (o & 1) || (o == 0);
5705 if (o_conv.inner != NULL)
5706 o_conv = ChannelMonitorUpdate_clone(&o_conv);
5707 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5708 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o_conv);
5709 return (long)ret_conv;
5712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
5713 LDKDecodeError e_conv;
5714 e_conv.inner = (void*)(e & (~1));
5715 e_conv.is_owned = (e & 1) || (e == 0);
5716 // Warning: we may need a move here but can't clone!
5717 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
5718 *ret_conv = CResult_ChannelMonitorUpdateDecodeErrorZ_err(e_conv);
5719 return (long)ret_conv;
5722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelMonitorUpdateDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5723 LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res_conv = *(LDKCResult_ChannelMonitorUpdateDecodeErrorZ*)_res;
5725 CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res_conv);
5728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5729 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5730 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5731 return (long)ret_conv;
5734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
5735 LDKMonitorUpdateError e_conv;
5736 e_conv.inner = (void*)(e & (~1));
5737 e_conv.is_owned = (e & 1) || (e == 0);
5738 // Warning: we may need a move here but can't clone!
5739 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5740 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv);
5741 return (long)ret_conv;
5744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5745 LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)_res;
5747 CResult_NoneMonitorUpdateErrorZ_free(_res_conv);
5750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5751 LDKC2Tuple_OutPointScriptZ _res_conv = *(LDKC2Tuple_OutPointScriptZ*)_res;
5753 C2Tuple_OutPointScriptZ_free(_res_conv);
5756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5758 a_conv.inner = (void*)(a & (~1));
5759 a_conv.is_owned = (a & 1) || (a == 0);
5760 if (a_conv.inner != NULL)
5761 a_conv = OutPoint_clone(&a_conv);
5763 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5764 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5765 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5766 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5767 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5768 return (long)ret_ref;
5771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jobjectArray _res) {
5772 LDKCVec_TransactionZ _res_constr;
5773 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5774 if (_res_constr.datalen > 0)
5775 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5777 _res_constr.data = NULL;
5778 for (size_t i = 0; i < _res_constr.datalen; i++) {
5779 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, _res, i);
5780 LDKTransaction arr_conv_8_ref;
5781 arr_conv_8_ref.datalen = (*_env)->GetArrayLength (_env, arr_conv_8);
5782 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5783 (*_env)->GetByteArrayRegion(_env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5784 arr_conv_8_ref.data_is_owned = true;
5785 _res_constr.data[i] = arr_conv_8_ref;
5787 CVec_TransactionZ_free(_res_constr);
5790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5791 LDKC2Tuple_u32TxOutZ _res_conv = *(LDKC2Tuple_u32TxOutZ*)_res;
5793 C2Tuple_u32TxOutZ_free(_res_conv);
5796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv * _env, jclass _b, jint a, jlong b) {
5797 LDKTxOut b_conv = *(LDKTxOut*)b;
5799 LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
5800 *ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
5801 return (long)ret_ref;
5804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1u32TxOutZZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
5805 LDKCVec_C2Tuple_u32TxOutZZ _res_constr;
5806 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5807 if (_res_constr.datalen > 0)
5808 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5810 _res_constr.data = NULL;
5811 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
5812 for (size_t a = 0; a < _res_constr.datalen; a++) {
5813 long arr_conv_26 = _res_vals[a];
5814 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
5815 FREE((void*)arr_conv_26);
5816 _res_constr.data[a] = arr_conv_26_conv;
5818 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
5819 CVec_C2Tuple_u32TxOutZZ_free(_res_constr);
5822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5823 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)_res;
5825 C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res_conv);
5828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5829 LDKThirtyTwoBytes a_ref;
5830 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5831 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5832 LDKCVec_C2Tuple_u32TxOutZZ b_constr;
5833 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5834 if (b_constr.datalen > 0)
5835 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKC2Tuple_u32TxOutZ), "LDKCVec_C2Tuple_u32TxOutZZ Elements");
5837 b_constr.data = NULL;
5838 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5839 for (size_t a = 0; a < b_constr.datalen; a++) {
5840 long arr_conv_26 = b_vals[a];
5841 LDKC2Tuple_u32TxOutZ arr_conv_26_conv = *(LDKC2Tuple_u32TxOutZ*)arr_conv_26;
5842 FREE((void*)arr_conv_26);
5843 b_constr.data[a] = arr_conv_26_conv;
5845 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5846 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
5847 *ret_ref = C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a_ref, b_constr);
5848 return (long)ret_ref;
5851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
5852 LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res_constr;
5853 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5854 if (_res_constr.datalen > 0)
5855 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ Elements");
5857 _res_constr.data = NULL;
5858 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
5859 for (size_t u = 0; u < _res_constr.datalen; u++) {
5860 long arr_conv_46 = _res_vals[u];
5861 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ arr_conv_46_conv = *(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ*)arr_conv_46;
5862 FREE((void*)arr_conv_46);
5863 _res_constr.data[u] = arr_conv_46_conv;
5865 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
5866 CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
5869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5870 LDKC2Tuple_BlockHashChannelMonitorZ _res_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)_res;
5872 C2Tuple_BlockHashChannelMonitorZ_free(_res_conv);
5875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
5876 LDKThirtyTwoBytes a_ref;
5877 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5878 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5879 LDKChannelMonitor b_conv;
5880 b_conv.inner = (void*)(b & (~1));
5881 b_conv.is_owned = (b & 1) || (b == 0);
5882 // Warning: we may need a move here but can't clone!
5883 LDKC2Tuple_BlockHashChannelMonitorZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelMonitorZ), "LDKC2Tuple_BlockHashChannelMonitorZ");
5884 *ret_ref = C2Tuple_BlockHashChannelMonitorZ_new(a_ref, b_conv);
5885 return (long)ret_ref;
5888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
5889 LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)o;
5891 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5892 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
5893 return (long)ret_conv;
5896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
5897 LDKDecodeError e_conv;
5898 e_conv.inner = (void*)(e & (~1));
5899 e_conv.is_owned = (e & 1) || (e == 0);
5900 // Warning: we may need a move here but can't clone!
5901 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
5902 *ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e_conv);
5903 return (long)ret_conv;
5906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5907 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)_res;
5909 CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
5912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong _res) {
5913 LDKC2Tuple_u64u64Z _res_conv = *(LDKC2Tuple_u64u64Z*)_res;
5915 C2Tuple_u64u64Z_free(_res_conv);
5918 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5919 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5920 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5921 return (long)ret_ref;
5924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
5925 LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)o;
5927 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5928 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
5929 return (long)ret_conv;
5932 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
5933 LDKDecodeError e_conv;
5934 e_conv.inner = (void*)(e & (~1));
5935 e_conv.is_owned = (e & 1) || (e == 0);
5936 // Warning: we may need a move here but can't clone!
5937 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
5938 *ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_err(e_conv);
5939 return (long)ret_conv;
5942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5943 LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res_conv = *(LDKCResult_SpendableOutputDescriptorDecodeErrorZ*)_res;
5945 CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res_conv);
5948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray _res) {
5949 LDKCVec_SignatureZ _res_constr;
5950 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
5951 if (_res_constr.datalen > 0)
5952 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5954 _res_constr.data = NULL;
5955 for (size_t i = 0; i < _res_constr.datalen; i++) {
5956 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, _res, i);
5957 LDKSignature arr_conv_8_ref;
5958 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5959 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5960 _res_constr.data[i] = arr_conv_8_ref;
5962 CVec_SignatureZ_free(_res_constr);
5965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
5966 LDKC2Tuple_SignatureCVec_SignatureZZ _res_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)_res;
5968 C2Tuple_SignatureCVec_SignatureZZ_free(_res_conv);
5971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5973 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5974 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5975 LDKCVec_SignatureZ b_constr;
5976 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5977 if (b_constr.datalen > 0)
5978 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5980 b_constr.data = NULL;
5981 for (size_t i = 0; i < b_constr.datalen; i++) {
5982 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5983 LDKSignature arr_conv_8_ref;
5984 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5985 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5986 b_constr.data[i] = arr_conv_8_ref;
5988 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5989 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5990 return (long)ret_ref;
5993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
5994 LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)o;
5996 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5997 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
5998 return (long)ret_conv;
6001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
6002 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
6003 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
6004 return (long)ret_conv;
6007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6008 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)_res;
6010 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(_res_conv);
6013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray o) {
6015 CHECK((*_env)->GetArrayLength (_env, o) == 64);
6016 (*_env)->GetByteArrayRegion (_env, o, 0, 64, o_ref.compact_form);
6017 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6018 *ret_conv = CResult_SignatureNoneZ_ok(o_ref);
6019 return (long)ret_conv;
6022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
6023 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
6024 *ret_conv = CResult_SignatureNoneZ_err();
6025 return (long)ret_conv;
6028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6029 LDKCResult_SignatureNoneZ _res_conv = *(LDKCResult_SignatureNoneZ*)_res;
6031 CResult_SignatureNoneZ_free(_res_conv);
6034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray o) {
6035 LDKCVec_SignatureZ o_constr;
6036 o_constr.datalen = (*_env)->GetArrayLength (_env, o);
6037 if (o_constr.datalen > 0)
6038 o_constr.data = MALLOC(o_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
6040 o_constr.data = NULL;
6041 for (size_t i = 0; i < o_constr.datalen; i++) {
6042 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, o, i);
6043 LDKSignature arr_conv_8_ref;
6044 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
6045 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
6046 o_constr.data[i] = arr_conv_8_ref;
6048 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6049 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(o_constr);
6050 return (long)ret_conv;
6053 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
6054 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6055 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
6056 return (long)ret_conv;
6059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6060 LDKCResult_CVec_SignatureZNoneZ _res_conv = *(LDKCResult_CVec_SignatureZNoneZ*)_res;
6062 CResult_CVec_SignatureZNoneZ_free(_res_conv);
6065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6066 LDKChannelKeys o_conv = *(LDKChannelKeys*)o;
6067 if (o_conv.free == LDKChannelKeys_JCalls_free) {
6068 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6069 LDKChannelKeys_JCalls_clone(o_conv.this_arg);
6071 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
6072 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_ok(o_conv);
6073 return (long)ret_conv;
6076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6077 LDKDecodeError e_conv;
6078 e_conv.inner = (void*)(e & (~1));
6079 e_conv.is_owned = (e & 1) || (e == 0);
6080 // Warning: we may need a move here but can't clone!
6081 LDKCResult_ChanKeySignerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChanKeySignerDecodeErrorZ), "LDKCResult_ChanKeySignerDecodeErrorZ");
6082 *ret_conv = CResult_ChanKeySignerDecodeErrorZ_err(e_conv);
6083 return (long)ret_conv;
6086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChanKeySignerDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6087 LDKCResult_ChanKeySignerDecodeErrorZ _res_conv = *(LDKCResult_ChanKeySignerDecodeErrorZ*)_res;
6089 CResult_ChanKeySignerDecodeErrorZ_free(_res_conv);
6092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6093 LDKInMemoryChannelKeys o_conv;
6094 o_conv.inner = (void*)(o & (~1));
6095 o_conv.is_owned = (o & 1) || (o == 0);
6096 if (o_conv.inner != NULL)
6097 o_conv = InMemoryChannelKeys_clone(&o_conv);
6098 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6099 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_ok(o_conv);
6100 return (long)ret_conv;
6103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6104 LDKDecodeError e_conv;
6105 e_conv.inner = (void*)(e & (~1));
6106 e_conv.is_owned = (e & 1) || (e == 0);
6107 // Warning: we may need a move here but can't clone!
6108 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
6109 *ret_conv = CResult_InMemoryChannelKeysDecodeErrorZ_err(e_conv);
6110 return (long)ret_conv;
6113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InMemoryChannelKeysDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6114 LDKCResult_InMemoryChannelKeysDecodeErrorZ _res_conv = *(LDKCResult_InMemoryChannelKeysDecodeErrorZ*)_res;
6116 CResult_InMemoryChannelKeysDecodeErrorZ_free(_res_conv);
6119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6120 LDKTxOut o_conv = *(LDKTxOut*)o;
6122 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6123 *ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
6124 return (long)ret_conv;
6127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass e) {
6128 LDKAccessError e_conv = LDKAccessError_from_java(_env, e);
6129 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
6130 *ret_conv = CResult_TxOutAccessErrorZ_err(e_conv);
6131 return (long)ret_conv;
6134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6135 LDKCResult_TxOutAccessErrorZ _res_conv = *(LDKCResult_TxOutAccessErrorZ*)_res;
6137 CResult_TxOutAccessErrorZ_free(_res_conv);
6140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
6141 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6142 *ret_conv = CResult_NoneAPIErrorZ_ok();
6143 return (long)ret_conv;
6146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6147 LDKAPIError e_conv = *(LDKAPIError*)e;
6149 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6150 *ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
6151 return (long)ret_conv;
6154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6155 LDKCResult_NoneAPIErrorZ _res_conv = *(LDKCResult_NoneAPIErrorZ*)_res;
6157 CResult_NoneAPIErrorZ_free(_res_conv);
6160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6161 LDKCVec_ChannelDetailsZ _res_constr;
6162 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6163 if (_res_constr.datalen > 0)
6164 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
6166 _res_constr.data = NULL;
6167 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6168 for (size_t q = 0; q < _res_constr.datalen; q++) {
6169 long arr_conv_16 = _res_vals[q];
6170 LDKChannelDetails arr_conv_16_conv;
6171 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6172 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6173 _res_constr.data[q] = arr_conv_16_conv;
6175 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6176 CVec_ChannelDetailsZ_free(_res_constr);
6179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
6180 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6181 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
6182 return (long)ret_conv;
6185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6186 LDKPaymentSendFailure e_conv;
6187 e_conv.inner = (void*)(e & (~1));
6188 e_conv.is_owned = (e & 1) || (e == 0);
6189 // Warning: we may need a move here but can't clone!
6190 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6191 *ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
6192 return (long)ret_conv;
6195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6196 LDKCResult_NonePaymentSendFailureZ _res_conv = *(LDKCResult_NonePaymentSendFailureZ*)_res;
6198 CResult_NonePaymentSendFailureZ_free(_res_conv);
6201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6202 LDKCVec_NetAddressZ _res_constr;
6203 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6204 if (_res_constr.datalen > 0)
6205 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6207 _res_constr.data = NULL;
6208 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6209 for (size_t m = 0; m < _res_constr.datalen; m++) {
6210 long arr_conv_12 = _res_vals[m];
6211 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6212 FREE((void*)arr_conv_12);
6213 _res_constr.data[m] = arr_conv_12_conv;
6215 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6216 CVec_NetAddressZ_free(_res_constr);
6219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6220 LDKCVec_ChannelMonitorZ _res_constr;
6221 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6222 if (_res_constr.datalen > 0)
6223 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
6225 _res_constr.data = NULL;
6226 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6227 for (size_t q = 0; q < _res_constr.datalen; q++) {
6228 long arr_conv_16 = _res_vals[q];
6229 LDKChannelMonitor arr_conv_16_conv;
6230 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6231 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6232 _res_constr.data[q] = arr_conv_16_conv;
6234 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6235 CVec_ChannelMonitorZ_free(_res_constr);
6238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6239 LDKC2Tuple_BlockHashChannelManagerZ _res_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)_res;
6241 C2Tuple_BlockHashChannelManagerZ_free(_res_conv);
6244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
6245 LDKThirtyTwoBytes a_ref;
6246 CHECK((*_env)->GetArrayLength (_env, a) == 32);
6247 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
6248 LDKChannelManager b_conv;
6249 b_conv.inner = (void*)(b & (~1));
6250 b_conv.is_owned = (b & 1) || (b == 0);
6251 // Warning: we may need a move here but can't clone!
6252 LDKC2Tuple_BlockHashChannelManagerZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_BlockHashChannelManagerZ), "LDKC2Tuple_BlockHashChannelManagerZ");
6253 *ret_ref = C2Tuple_BlockHashChannelManagerZ_new(a_ref, b_conv);
6254 return (long)ret_ref;
6257 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6258 LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)o;
6260 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6261 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
6262 return (long)ret_conv;
6265 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6266 LDKDecodeError e_conv;
6267 e_conv.inner = (void*)(e & (~1));
6268 e_conv.is_owned = (e & 1) || (e == 0);
6269 // Warning: we may need a move here but can't clone!
6270 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
6271 *ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e_conv);
6272 return (long)ret_conv;
6275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6276 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res_conv = *(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ*)_res;
6278 CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(_res_conv);
6281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv * _env, jclass _b, jlong o) {
6282 LDKNetAddress o_conv = *(LDKNetAddress*)o;
6284 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6285 *ret_conv = CResult_NetAddressu8Z_ok(o_conv);
6286 return (long)ret_conv;
6289 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1err(JNIEnv * _env, jclass _b, jbyte e) {
6290 LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
6291 *ret_conv = CResult_NetAddressu8Z_err(e);
6292 return (long)ret_conv;
6295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1free(JNIEnv * _env, jclass _b, jlong _res) {
6296 LDKCResult_NetAddressu8Z _res_conv = *(LDKCResult_NetAddressu8Z*)_res;
6298 CResult_NetAddressu8Z_free(_res_conv);
6301 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6302 LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)o;
6304 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6305 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
6306 return (long)ret_conv;
6309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6310 LDKDecodeError e_conv;
6311 e_conv.inner = (void*)(e & (~1));
6312 e_conv.is_owned = (e & 1) || (e == 0);
6313 // Warning: we may need a move here but can't clone!
6314 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
6315 *ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_err(e_conv);
6316 return (long)ret_conv;
6319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6320 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ _res_conv = *(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ*)_res;
6322 CResult_CResult_NetAddressu8ZDecodeErrorZ_free(_res_conv);
6325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6326 LDKCVec_u64Z _res_constr;
6327 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6328 if (_res_constr.datalen > 0)
6329 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
6331 _res_constr.data = NULL;
6332 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6333 for (size_t g = 0; g < _res_constr.datalen; g++) {
6334 long arr_conv_6 = _res_vals[g];
6335 _res_constr.data[g] = arr_conv_6;
6337 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6338 CVec_u64Z_free(_res_constr);
6341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6342 LDKCVec_UpdateAddHTLCZ _res_constr;
6343 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6344 if (_res_constr.datalen > 0)
6345 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
6347 _res_constr.data = NULL;
6348 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6349 for (size_t p = 0; p < _res_constr.datalen; p++) {
6350 long arr_conv_15 = _res_vals[p];
6351 LDKUpdateAddHTLC arr_conv_15_conv;
6352 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
6353 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
6354 _res_constr.data[p] = arr_conv_15_conv;
6356 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6357 CVec_UpdateAddHTLCZ_free(_res_constr);
6360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6361 LDKCVec_UpdateFulfillHTLCZ _res_constr;
6362 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6363 if (_res_constr.datalen > 0)
6364 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
6366 _res_constr.data = NULL;
6367 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6368 for (size_t t = 0; t < _res_constr.datalen; t++) {
6369 long arr_conv_19 = _res_vals[t];
6370 LDKUpdateFulfillHTLC arr_conv_19_conv;
6371 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
6372 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
6373 _res_constr.data[t] = arr_conv_19_conv;
6375 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6376 CVec_UpdateFulfillHTLCZ_free(_res_constr);
6379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6380 LDKCVec_UpdateFailHTLCZ _res_constr;
6381 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6382 if (_res_constr.datalen > 0)
6383 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
6385 _res_constr.data = NULL;
6386 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6387 for (size_t q = 0; q < _res_constr.datalen; q++) {
6388 long arr_conv_16 = _res_vals[q];
6389 LDKUpdateFailHTLC arr_conv_16_conv;
6390 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
6391 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
6392 _res_constr.data[q] = arr_conv_16_conv;
6394 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6395 CVec_UpdateFailHTLCZ_free(_res_constr);
6398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6399 LDKCVec_UpdateFailMalformedHTLCZ _res_constr;
6400 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6401 if (_res_constr.datalen > 0)
6402 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
6404 _res_constr.data = NULL;
6405 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6406 for (size_t z = 0; z < _res_constr.datalen; z++) {
6407 long arr_conv_25 = _res_vals[z];
6408 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
6409 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
6410 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
6411 _res_constr.data[z] = arr_conv_25_conv;
6413 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6414 CVec_UpdateFailMalformedHTLCZ_free(_res_constr);
6417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean o) {
6418 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6419 *ret_conv = CResult_boolLightningErrorZ_ok(o);
6420 return (long)ret_conv;
6423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6424 LDKLightningError e_conv;
6425 e_conv.inner = (void*)(e & (~1));
6426 e_conv.is_owned = (e & 1) || (e == 0);
6427 // Warning: we may need a move here but can't clone!
6428 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
6429 *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
6430 return (long)ret_conv;
6433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6434 LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)_res;
6436 CResult_boolLightningErrorZ_free(_res_conv);
6439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6440 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)_res;
6442 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res_conv);
6445 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
6446 LDKChannelAnnouncement a_conv;
6447 a_conv.inner = (void*)(a & (~1));
6448 a_conv.is_owned = (a & 1) || (a == 0);
6449 if (a_conv.inner != NULL)
6450 a_conv = ChannelAnnouncement_clone(&a_conv);
6451 LDKChannelUpdate b_conv;
6452 b_conv.inner = (void*)(b & (~1));
6453 b_conv.is_owned = (b & 1) || (b == 0);
6454 if (b_conv.inner != NULL)
6455 b_conv = ChannelUpdate_clone(&b_conv);
6456 LDKChannelUpdate c_conv;
6457 c_conv.inner = (void*)(c & (~1));
6458 c_conv.is_owned = (c & 1) || (c == 0);
6459 if (c_conv.inner != NULL)
6460 c_conv = ChannelUpdate_clone(&c_conv);
6461 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
6462 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
6463 return (long)ret_ref;
6466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6467 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res_constr;
6468 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6469 if (_res_constr.datalen > 0)
6470 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
6472 _res_constr.data = NULL;
6473 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6474 for (size_t l = 0; l < _res_constr.datalen; l++) {
6475 long arr_conv_63 = _res_vals[l];
6476 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
6477 FREE((void*)arr_conv_63);
6478 _res_constr.data[l] = arr_conv_63_conv;
6480 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6481 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res_constr);
6484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
6485 LDKCVec_NodeAnnouncementZ _res_constr;
6486 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6487 if (_res_constr.datalen > 0)
6488 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
6490 _res_constr.data = NULL;
6491 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
6492 for (size_t s = 0; s < _res_constr.datalen; s++) {
6493 long arr_conv_18 = _res_vals[s];
6494 LDKNodeAnnouncement arr_conv_18_conv;
6495 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
6496 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
6497 _res_constr.data[s] = arr_conv_18_conv;
6499 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
6500 CVec_NodeAnnouncementZ_free(_res_constr);
6503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv * _env, jclass _b) {
6504 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6505 *ret_conv = CResult_NoneLightningErrorZ_ok();
6506 return (long)ret_conv;
6509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6510 LDKLightningError e_conv;
6511 e_conv.inner = (void*)(e & (~1));
6512 e_conv.is_owned = (e & 1) || (e == 0);
6513 // Warning: we may need a move here but can't clone!
6514 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
6515 *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
6516 return (long)ret_conv;
6519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6520 LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)_res;
6522 CResult_NoneLightningErrorZ_free(_res_conv);
6525 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6526 LDKChannelReestablish o_conv;
6527 o_conv.inner = (void*)(o & (~1));
6528 o_conv.is_owned = (o & 1) || (o == 0);
6529 if (o_conv.inner != NULL)
6530 o_conv = ChannelReestablish_clone(&o_conv);
6531 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6532 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_ok(o_conv);
6533 return (long)ret_conv;
6536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6537 LDKDecodeError e_conv;
6538 e_conv.inner = (void*)(e & (~1));
6539 e_conv.is_owned = (e & 1) || (e == 0);
6540 // Warning: we may need a move here but can't clone!
6541 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
6542 *ret_conv = CResult_ChannelReestablishDecodeErrorZ_err(e_conv);
6543 return (long)ret_conv;
6546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelReestablishDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6547 LDKCResult_ChannelReestablishDecodeErrorZ _res_conv = *(LDKCResult_ChannelReestablishDecodeErrorZ*)_res;
6549 CResult_ChannelReestablishDecodeErrorZ_free(_res_conv);
6552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6554 o_conv.inner = (void*)(o & (~1));
6555 o_conv.is_owned = (o & 1) || (o == 0);
6556 if (o_conv.inner != NULL)
6557 o_conv = Init_clone(&o_conv);
6558 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6559 *ret_conv = CResult_InitDecodeErrorZ_ok(o_conv);
6560 return (long)ret_conv;
6563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6564 LDKDecodeError e_conv;
6565 e_conv.inner = (void*)(e & (~1));
6566 e_conv.is_owned = (e & 1) || (e == 0);
6567 // Warning: we may need a move here but can't clone!
6568 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
6569 *ret_conv = CResult_InitDecodeErrorZ_err(e_conv);
6570 return (long)ret_conv;
6573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6574 LDKCResult_InitDecodeErrorZ _res_conv = *(LDKCResult_InitDecodeErrorZ*)_res;
6576 CResult_InitDecodeErrorZ_free(_res_conv);
6579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6581 o_conv.inner = (void*)(o & (~1));
6582 o_conv.is_owned = (o & 1) || (o == 0);
6583 if (o_conv.inner != NULL)
6584 o_conv = Ping_clone(&o_conv);
6585 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6586 *ret_conv = CResult_PingDecodeErrorZ_ok(o_conv);
6587 return (long)ret_conv;
6590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6591 LDKDecodeError e_conv;
6592 e_conv.inner = (void*)(e & (~1));
6593 e_conv.is_owned = (e & 1) || (e == 0);
6594 // Warning: we may need a move here but can't clone!
6595 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
6596 *ret_conv = CResult_PingDecodeErrorZ_err(e_conv);
6597 return (long)ret_conv;
6600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PingDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6601 LDKCResult_PingDecodeErrorZ _res_conv = *(LDKCResult_PingDecodeErrorZ*)_res;
6603 CResult_PingDecodeErrorZ_free(_res_conv);
6606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6608 o_conv.inner = (void*)(o & (~1));
6609 o_conv.is_owned = (o & 1) || (o == 0);
6610 if (o_conv.inner != NULL)
6611 o_conv = Pong_clone(&o_conv);
6612 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6613 *ret_conv = CResult_PongDecodeErrorZ_ok(o_conv);
6614 return (long)ret_conv;
6617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6618 LDKDecodeError e_conv;
6619 e_conv.inner = (void*)(e & (~1));
6620 e_conv.is_owned = (e & 1) || (e == 0);
6621 // Warning: we may need a move here but can't clone!
6622 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
6623 *ret_conv = CResult_PongDecodeErrorZ_err(e_conv);
6624 return (long)ret_conv;
6627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PongDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6628 LDKCResult_PongDecodeErrorZ _res_conv = *(LDKCResult_PongDecodeErrorZ*)_res;
6630 CResult_PongDecodeErrorZ_free(_res_conv);
6633 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6634 LDKUnsignedChannelAnnouncement o_conv;
6635 o_conv.inner = (void*)(o & (~1));
6636 o_conv.is_owned = (o & 1) || (o == 0);
6637 if (o_conv.inner != NULL)
6638 o_conv = UnsignedChannelAnnouncement_clone(&o_conv);
6639 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6640 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o_conv);
6641 return (long)ret_conv;
6644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6645 LDKDecodeError e_conv;
6646 e_conv.inner = (void*)(e & (~1));
6647 e_conv.is_owned = (e & 1) || (e == 0);
6648 // Warning: we may need a move here but can't clone!
6649 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
6650 *ret_conv = CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e_conv);
6651 return (long)ret_conv;
6654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelAnnouncementDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6655 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ*)_res;
6657 CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res_conv);
6660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6661 LDKUnsignedChannelUpdate o_conv;
6662 o_conv.inner = (void*)(o & (~1));
6663 o_conv.is_owned = (o & 1) || (o == 0);
6664 if (o_conv.inner != NULL)
6665 o_conv = UnsignedChannelUpdate_clone(&o_conv);
6666 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6667 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o_conv);
6668 return (long)ret_conv;
6671 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6672 LDKDecodeError e_conv;
6673 e_conv.inner = (void*)(e & (~1));
6674 e_conv.is_owned = (e & 1) || (e == 0);
6675 // Warning: we may need a move here but can't clone!
6676 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
6677 *ret_conv = CResult_UnsignedChannelUpdateDecodeErrorZ_err(e_conv);
6678 return (long)ret_conv;
6681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedChannelUpdateDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6682 LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res_conv = *(LDKCResult_UnsignedChannelUpdateDecodeErrorZ*)_res;
6684 CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res_conv);
6687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6688 LDKErrorMessage o_conv;
6689 o_conv.inner = (void*)(o & (~1));
6690 o_conv.is_owned = (o & 1) || (o == 0);
6691 if (o_conv.inner != NULL)
6692 o_conv = ErrorMessage_clone(&o_conv);
6693 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6694 *ret_conv = CResult_ErrorMessageDecodeErrorZ_ok(o_conv);
6695 return (long)ret_conv;
6698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6699 LDKDecodeError e_conv;
6700 e_conv.inner = (void*)(e & (~1));
6701 e_conv.is_owned = (e & 1) || (e == 0);
6702 // Warning: we may need a move here but can't clone!
6703 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
6704 *ret_conv = CResult_ErrorMessageDecodeErrorZ_err(e_conv);
6705 return (long)ret_conv;
6708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ErrorMessageDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6709 LDKCResult_ErrorMessageDecodeErrorZ _res_conv = *(LDKCResult_ErrorMessageDecodeErrorZ*)_res;
6711 CResult_ErrorMessageDecodeErrorZ_free(_res_conv);
6714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6715 LDKUnsignedNodeAnnouncement o_conv;
6716 o_conv.inner = (void*)(o & (~1));
6717 o_conv.is_owned = (o & 1) || (o == 0);
6718 if (o_conv.inner != NULL)
6719 o_conv = UnsignedNodeAnnouncement_clone(&o_conv);
6720 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6721 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o_conv);
6722 return (long)ret_conv;
6725 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6726 LDKDecodeError e_conv;
6727 e_conv.inner = (void*)(e & (~1));
6728 e_conv.is_owned = (e & 1) || (e == 0);
6729 // Warning: we may need a move here but can't clone!
6730 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
6731 *ret_conv = CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e_conv);
6732 return (long)ret_conv;
6735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1UnsignedNodeAnnouncementDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6736 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res_conv = *(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ*)_res;
6738 CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res_conv);
6741 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6742 LDKQueryShortChannelIds o_conv;
6743 o_conv.inner = (void*)(o & (~1));
6744 o_conv.is_owned = (o & 1) || (o == 0);
6745 if (o_conv.inner != NULL)
6746 o_conv = QueryShortChannelIds_clone(&o_conv);
6747 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6748 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_ok(o_conv);
6749 return (long)ret_conv;
6752 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6753 LDKDecodeError e_conv;
6754 e_conv.inner = (void*)(e & (~1));
6755 e_conv.is_owned = (e & 1) || (e == 0);
6756 // Warning: we may need a move here but can't clone!
6757 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
6758 *ret_conv = CResult_QueryShortChannelIdsDecodeErrorZ_err(e_conv);
6759 return (long)ret_conv;
6762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryShortChannelIdsDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6763 LDKCResult_QueryShortChannelIdsDecodeErrorZ _res_conv = *(LDKCResult_QueryShortChannelIdsDecodeErrorZ*)_res;
6765 CResult_QueryShortChannelIdsDecodeErrorZ_free(_res_conv);
6768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6769 LDKReplyShortChannelIdsEnd o_conv;
6770 o_conv.inner = (void*)(o & (~1));
6771 o_conv.is_owned = (o & 1) || (o == 0);
6772 if (o_conv.inner != NULL)
6773 o_conv = ReplyShortChannelIdsEnd_clone(&o_conv);
6774 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6775 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o_conv);
6776 return (long)ret_conv;
6779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6780 LDKDecodeError e_conv;
6781 e_conv.inner = (void*)(e & (~1));
6782 e_conv.is_owned = (e & 1) || (e == 0);
6783 // Warning: we may need a move here but can't clone!
6784 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
6785 *ret_conv = CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e_conv);
6786 return (long)ret_conv;
6789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyShortChannelIdsEndDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6790 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res_conv = *(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ*)_res;
6792 CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res_conv);
6795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6796 LDKQueryChannelRange o_conv;
6797 o_conv.inner = (void*)(o & (~1));
6798 o_conv.is_owned = (o & 1) || (o == 0);
6799 if (o_conv.inner != NULL)
6800 o_conv = QueryChannelRange_clone(&o_conv);
6801 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6802 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_ok(o_conv);
6803 return (long)ret_conv;
6806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6807 LDKDecodeError e_conv;
6808 e_conv.inner = (void*)(e & (~1));
6809 e_conv.is_owned = (e & 1) || (e == 0);
6810 // Warning: we may need a move here but can't clone!
6811 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
6812 *ret_conv = CResult_QueryChannelRangeDecodeErrorZ_err(e_conv);
6813 return (long)ret_conv;
6816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1QueryChannelRangeDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6817 LDKCResult_QueryChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_QueryChannelRangeDecodeErrorZ*)_res;
6819 CResult_QueryChannelRangeDecodeErrorZ_free(_res_conv);
6822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6823 LDKReplyChannelRange o_conv;
6824 o_conv.inner = (void*)(o & (~1));
6825 o_conv.is_owned = (o & 1) || (o == 0);
6826 if (o_conv.inner != NULL)
6827 o_conv = ReplyChannelRange_clone(&o_conv);
6828 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6829 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_ok(o_conv);
6830 return (long)ret_conv;
6833 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6834 LDKDecodeError e_conv;
6835 e_conv.inner = (void*)(e & (~1));
6836 e_conv.is_owned = (e & 1) || (e == 0);
6837 // Warning: we may need a move here but can't clone!
6838 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
6839 *ret_conv = CResult_ReplyChannelRangeDecodeErrorZ_err(e_conv);
6840 return (long)ret_conv;
6843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ReplyChannelRangeDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6844 LDKCResult_ReplyChannelRangeDecodeErrorZ _res_conv = *(LDKCResult_ReplyChannelRangeDecodeErrorZ*)_res;
6846 CResult_ReplyChannelRangeDecodeErrorZ_free(_res_conv);
6849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
6850 LDKGossipTimestampFilter o_conv;
6851 o_conv.inner = (void*)(o & (~1));
6852 o_conv.is_owned = (o & 1) || (o == 0);
6853 if (o_conv.inner != NULL)
6854 o_conv = GossipTimestampFilter_clone(&o_conv);
6855 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6856 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_ok(o_conv);
6857 return (long)ret_conv;
6860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6861 LDKDecodeError e_conv;
6862 e_conv.inner = (void*)(e & (~1));
6863 e_conv.is_owned = (e & 1) || (e == 0);
6864 // Warning: we may need a move here but can't clone!
6865 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
6866 *ret_conv = CResult_GossipTimestampFilterDecodeErrorZ_err(e_conv);
6867 return (long)ret_conv;
6870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1GossipTimestampFilterDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6871 LDKCResult_GossipTimestampFilterDecodeErrorZ _res_conv = *(LDKCResult_GossipTimestampFilterDecodeErrorZ*)_res;
6873 CResult_GossipTimestampFilterDecodeErrorZ_free(_res_conv);
6876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray _res) {
6877 LDKCVec_PublicKeyZ _res_constr;
6878 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
6879 if (_res_constr.datalen > 0)
6880 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
6882 _res_constr.data = NULL;
6883 for (size_t i = 0; i < _res_constr.datalen; i++) {
6884 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, _res, i);
6885 LDKPublicKey arr_conv_8_ref;
6886 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
6887 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
6888 _res_constr.data[i] = arr_conv_8_ref;
6890 CVec_PublicKeyZ_free(_res_constr);
6893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray _res) {
6894 LDKCVec_u8Z _res_ref;
6895 _res_ref.datalen = (*_env)->GetArrayLength (_env, _res);
6896 _res_ref.data = MALLOC(_res_ref.datalen, "LDKCVec_u8Z Bytes");
6897 (*_env)->GetByteArrayRegion(_env, _res, 0, _res_ref.datalen, _res_ref.data);
6898 CVec_u8Z_free(_res_ref);
6901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray o) {
6903 o_ref.datalen = (*_env)->GetArrayLength (_env, o);
6904 o_ref.data = MALLOC(o_ref.datalen, "LDKCVec_u8Z Bytes");
6905 (*_env)->GetByteArrayRegion(_env, o, 0, o_ref.datalen, o_ref.data);
6906 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6907 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(o_ref);
6908 return (long)ret_conv;
6911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6912 LDKPeerHandleError e_conv;
6913 e_conv.inner = (void*)(e & (~1));
6914 e_conv.is_owned = (e & 1) || (e == 0);
6915 // Warning: we may need a move here but can't clone!
6916 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
6917 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(e_conv);
6918 return (long)ret_conv;
6921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6922 LDKCResult_CVec_u8ZPeerHandleErrorZ _res_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)_res;
6924 CResult_CVec_u8ZPeerHandleErrorZ_free(_res_conv);
6927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
6928 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6929 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
6930 return (long)ret_conv;
6933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6934 LDKPeerHandleError e_conv;
6935 e_conv.inner = (void*)(e & (~1));
6936 e_conv.is_owned = (e & 1) || (e == 0);
6937 // Warning: we may need a move here but can't clone!
6938 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
6939 *ret_conv = CResult_NonePeerHandleErrorZ_err(e_conv);
6940 return (long)ret_conv;
6943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6944 LDKCResult_NonePeerHandleErrorZ _res_conv = *(LDKCResult_NonePeerHandleErrorZ*)_res;
6946 CResult_NonePeerHandleErrorZ_free(_res_conv);
6949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean o) {
6950 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6951 *ret_conv = CResult_boolPeerHandleErrorZ_ok(o);
6952 return (long)ret_conv;
6955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
6956 LDKPeerHandleError e_conv;
6957 e_conv.inner = (void*)(e & (~1));
6958 e_conv.is_owned = (e & 1) || (e == 0);
6959 // Warning: we may need a move here but can't clone!
6960 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
6961 *ret_conv = CResult_boolPeerHandleErrorZ_err(e_conv);
6962 return (long)ret_conv;
6965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6966 LDKCResult_boolPeerHandleErrorZ _res_conv = *(LDKCResult_boolPeerHandleErrorZ*)_res;
6968 CResult_boolPeerHandleErrorZ_free(_res_conv);
6971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray o) {
6973 CHECK((*_env)->GetArrayLength (_env, o) == 32);
6974 (*_env)->GetByteArrayRegion (_env, o, 0, 32, o_ref.bytes);
6975 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6976 *ret_conv = CResult_SecretKeySecpErrorZ_ok(o_ref);
6977 return (long)ret_conv;
6980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass e) {
6981 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(_env, e);
6982 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
6983 *ret_conv = CResult_SecretKeySecpErrorZ_err(e_conv);
6984 return (long)ret_conv;
6987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
6988 LDKCResult_SecretKeySecpErrorZ _res_conv = *(LDKCResult_SecretKeySecpErrorZ*)_res;
6990 CResult_SecretKeySecpErrorZ_free(_res_conv);
6993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray o) {
6995 CHECK((*_env)->GetArrayLength (_env, o) == 33);
6996 (*_env)->GetByteArrayRegion (_env, o, 0, 33, o_ref.compressed_form);
6997 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
6998 *ret_conv = CResult_PublicKeySecpErrorZ_ok(o_ref);
6999 return (long)ret_conv;
7002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass e) {
7003 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(_env, e);
7004 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
7005 *ret_conv = CResult_PublicKeySecpErrorZ_err(e_conv);
7006 return (long)ret_conv;
7009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7010 LDKCResult_PublicKeySecpErrorZ _res_conv = *(LDKCResult_PublicKeySecpErrorZ*)_res;
7012 CResult_PublicKeySecpErrorZ_free(_res_conv);
7015 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7016 LDKTxCreationKeys o_conv;
7017 o_conv.inner = (void*)(o & (~1));
7018 o_conv.is_owned = (o & 1) || (o == 0);
7019 if (o_conv.inner != NULL)
7020 o_conv = TxCreationKeys_clone(&o_conv);
7021 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
7022 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(o_conv);
7023 return (long)ret_conv;
7026 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass e) {
7027 LDKSecp256k1Error e_conv = LDKSecp256k1Error_from_java(_env, e);
7028 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
7029 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(e_conv);
7030 return (long)ret_conv;
7033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7034 LDKCResult_TxCreationKeysSecpErrorZ _res_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)_res;
7036 CResult_TxCreationKeysSecpErrorZ_free(_res_conv);
7039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7040 LDKTrustedCommitmentTransaction o_conv;
7041 o_conv.inner = (void*)(o & (~1));
7042 o_conv.is_owned = (o & 1) || (o == 0);
7043 // Warning: we may need a move here but can't clone!
7044 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7045 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_ok(o_conv);
7046 return (long)ret_conv;
7049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1err(JNIEnv * _env, jclass _b) {
7050 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
7051 *ret_conv = CResult_TrustedCommitmentTransactionNoneZ_err();
7052 return (long)ret_conv;
7055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedCommitmentTransactionNoneZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7056 LDKCResult_TrustedCommitmentTransactionNoneZ _res_conv = *(LDKCResult_TrustedCommitmentTransactionNoneZ*)_res;
7058 CResult_TrustedCommitmentTransactionNoneZ_free(_res_conv);
7061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
7062 LDKCVec_RouteHopZ _res_constr;
7063 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
7064 if (_res_constr.datalen > 0)
7065 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7067 _res_constr.data = NULL;
7068 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
7069 for (size_t k = 0; k < _res_constr.datalen; k++) {
7070 long arr_conv_10 = _res_vals[k];
7071 LDKRouteHop arr_conv_10_conv;
7072 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7073 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7074 _res_constr.data[k] = arr_conv_10_conv;
7076 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
7077 CVec_RouteHopZ_free(_res_constr);
7080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray _res) {
7081 LDKCVec_CVec_RouteHopZZ _res_constr;
7082 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
7083 if (_res_constr.datalen > 0)
7084 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
7086 _res_constr.data = NULL;
7087 for (size_t m = 0; m < _res_constr.datalen; m++) {
7088 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, _res, m);
7089 LDKCVec_RouteHopZ arr_conv_12_constr;
7090 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
7091 if (arr_conv_12_constr.datalen > 0)
7092 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
7094 arr_conv_12_constr.data = NULL;
7095 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
7096 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
7097 long arr_conv_10 = arr_conv_12_vals[k];
7098 LDKRouteHop arr_conv_10_conv;
7099 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
7100 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
7101 arr_conv_12_constr.data[k] = arr_conv_10_conv;
7103 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
7104 _res_constr.data[m] = arr_conv_12_constr;
7106 CVec_CVec_RouteHopZZ_free(_res_constr);
7109 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7111 o_conv.inner = (void*)(o & (~1));
7112 o_conv.is_owned = (o & 1) || (o == 0);
7113 if (o_conv.inner != NULL)
7114 o_conv = Route_clone(&o_conv);
7115 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7116 *ret_conv = CResult_RouteDecodeErrorZ_ok(o_conv);
7117 return (long)ret_conv;
7120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
7121 LDKDecodeError e_conv;
7122 e_conv.inner = (void*)(e & (~1));
7123 e_conv.is_owned = (e & 1) || (e == 0);
7124 // Warning: we may need a move here but can't clone!
7125 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
7126 *ret_conv = CResult_RouteDecodeErrorZ_err(e_conv);
7127 return (long)ret_conv;
7130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7131 LDKCResult_RouteDecodeErrorZ _res_conv = *(LDKCResult_RouteDecodeErrorZ*)_res;
7133 CResult_RouteDecodeErrorZ_free(_res_conv);
7136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray _res) {
7137 LDKCVec_RouteHintZ _res_constr;
7138 _res_constr.datalen = (*_env)->GetArrayLength (_env, _res);
7139 if (_res_constr.datalen > 0)
7140 _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
7142 _res_constr.data = NULL;
7143 long* _res_vals = (*_env)->GetLongArrayElements (_env, _res, NULL);
7144 for (size_t l = 0; l < _res_constr.datalen; l++) {
7145 long arr_conv_11 = _res_vals[l];
7146 LDKRouteHint arr_conv_11_conv;
7147 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
7148 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
7149 _res_constr.data[l] = arr_conv_11_conv;
7151 (*_env)->ReleaseLongArrayElements (_env, _res, _res_vals, 0);
7152 CVec_RouteHintZ_free(_res_constr);
7155 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7157 o_conv.inner = (void*)(o & (~1));
7158 o_conv.is_owned = (o & 1) || (o == 0);
7159 if (o_conv.inner != NULL)
7160 o_conv = Route_clone(&o_conv);
7161 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7162 *ret_conv = CResult_RouteLightningErrorZ_ok(o_conv);
7163 return (long)ret_conv;
7166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
7167 LDKLightningError e_conv;
7168 e_conv.inner = (void*)(e & (~1));
7169 e_conv.is_owned = (e & 1) || (e == 0);
7170 // Warning: we may need a move here but can't clone!
7171 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
7172 *ret_conv = CResult_RouteLightningErrorZ_err(e_conv);
7173 return (long)ret_conv;
7176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7177 LDKCResult_RouteLightningErrorZ _res_conv = *(LDKCResult_RouteLightningErrorZ*)_res;
7179 CResult_RouteLightningErrorZ_free(_res_conv);
7182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7183 LDKRoutingFees o_conv;
7184 o_conv.inner = (void*)(o & (~1));
7185 o_conv.is_owned = (o & 1) || (o == 0);
7186 if (o_conv.inner != NULL)
7187 o_conv = RoutingFees_clone(&o_conv);
7188 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7189 *ret_conv = CResult_RoutingFeesDecodeErrorZ_ok(o_conv);
7190 return (long)ret_conv;
7193 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
7194 LDKDecodeError e_conv;
7195 e_conv.inner = (void*)(e & (~1));
7196 e_conv.is_owned = (e & 1) || (e == 0);
7197 // Warning: we may need a move here but can't clone!
7198 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
7199 *ret_conv = CResult_RoutingFeesDecodeErrorZ_err(e_conv);
7200 return (long)ret_conv;
7203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RoutingFeesDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7204 LDKCResult_RoutingFeesDecodeErrorZ _res_conv = *(LDKCResult_RoutingFeesDecodeErrorZ*)_res;
7206 CResult_RoutingFeesDecodeErrorZ_free(_res_conv);
7209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7210 LDKNodeAnnouncementInfo o_conv;
7211 o_conv.inner = (void*)(o & (~1));
7212 o_conv.is_owned = (o & 1) || (o == 0);
7213 // Warning: we may need a move here but can't clone!
7214 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7215 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o_conv);
7216 return (long)ret_conv;
7219 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
7220 LDKDecodeError e_conv;
7221 e_conv.inner = (void*)(e & (~1));
7222 e_conv.is_owned = (e & 1) || (e == 0);
7223 // Warning: we may need a move here but can't clone!
7224 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
7225 *ret_conv = CResult_NodeAnnouncementInfoDecodeErrorZ_err(e_conv);
7226 return (long)ret_conv;
7229 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeAnnouncementInfoDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7230 LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeAnnouncementInfoDecodeErrorZ*)_res;
7232 CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res_conv);
7235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7237 o_conv.inner = (void*)(o & (~1));
7238 o_conv.is_owned = (o & 1) || (o == 0);
7239 // Warning: we may need a move here but can't clone!
7240 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7241 *ret_conv = CResult_NodeInfoDecodeErrorZ_ok(o_conv);
7242 return (long)ret_conv;
7245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
7246 LDKDecodeError e_conv;
7247 e_conv.inner = (void*)(e & (~1));
7248 e_conv.is_owned = (e & 1) || (e == 0);
7249 // Warning: we may need a move here but can't clone!
7250 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
7251 *ret_conv = CResult_NodeInfoDecodeErrorZ_err(e_conv);
7252 return (long)ret_conv;
7255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeInfoDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7256 LDKCResult_NodeInfoDecodeErrorZ _res_conv = *(LDKCResult_NodeInfoDecodeErrorZ*)_res;
7258 CResult_NodeInfoDecodeErrorZ_free(_res_conv);
7261 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1ok(JNIEnv * _env, jclass _b, jlong o) {
7262 LDKNetworkGraph o_conv;
7263 o_conv.inner = (void*)(o & (~1));
7264 o_conv.is_owned = (o & 1) || (o == 0);
7265 // Warning: we may need a move here but can't clone!
7266 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7267 *ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
7268 return (long)ret_conv;
7271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1err(JNIEnv * _env, jclass _b, jlong e) {
7272 LDKDecodeError e_conv;
7273 e_conv.inner = (void*)(e & (~1));
7274 e_conv.is_owned = (e & 1) || (e == 0);
7275 // Warning: we may need a move here but can't clone!
7276 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
7277 *ret_conv = CResult_NetworkGraphDecodeErrorZ_err(e_conv);
7278 return (long)ret_conv;
7281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free(JNIEnv * _env, jclass _b, jlong _res) {
7282 LDKCResult_NetworkGraphDecodeErrorZ _res_conv = *(LDKCResult_NetworkGraphDecodeErrorZ*)_res;
7284 CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
7287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7288 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
7289 FREE((void*)this_ptr);
7290 Event_free(this_ptr_conv);
7293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7294 LDKEvent* orig_conv = (LDKEvent*)orig;
7295 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
7296 *ret_copy = Event_clone(orig_conv);
7297 long ret_ref = (long)ret_copy;
7301 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv * _env, jclass _b, jlong obj) {
7302 LDKEvent* obj_conv = (LDKEvent*)obj;
7303 LDKCVec_u8Z arg_var = Event_write(obj_conv);
7304 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7305 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7306 CVec_u8Z_free(arg_var);
7310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7311 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
7312 FREE((void*)this_ptr);
7313 MessageSendEvent_free(this_ptr_conv);
7316 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7317 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
7318 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
7319 *ret_copy = MessageSendEvent_clone(orig_conv);
7320 long ret_ref = (long)ret_copy;
7324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7325 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
7326 FREE((void*)this_ptr);
7327 MessageSendEventsProvider_free(this_ptr_conv);
7330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7331 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
7332 FREE((void*)this_ptr);
7333 EventsProvider_free(this_ptr_conv);
7336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7337 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
7338 FREE((void*)this_ptr);
7339 APIError_free(this_ptr_conv);
7342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7343 LDKAPIError* orig_conv = (LDKAPIError*)orig;
7344 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
7345 *ret_copy = APIError_clone(orig_conv);
7346 long ret_ref = (long)ret_copy;
7350 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7351 LDKLevel* orig_conv = (LDKLevel*)orig;
7352 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
7356 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
7357 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
7361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7362 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
7363 FREE((void*)this_ptr);
7364 Logger_free(this_ptr_conv);
7367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7368 LDKChannelHandshakeConfig this_ptr_conv;
7369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7371 ChannelHandshakeConfig_free(this_ptr_conv);
7374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7375 LDKChannelHandshakeConfig orig_conv;
7376 orig_conv.inner = (void*)(orig & (~1));
7377 orig_conv.is_owned = false;
7378 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
7379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7381 long ret_ref = (long)ret_var.inner;
7382 if (ret_var.is_owned) {
7388 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7389 LDKChannelHandshakeConfig this_ptr_conv;
7390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7391 this_ptr_conv.is_owned = false;
7392 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
7396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7397 LDKChannelHandshakeConfig this_ptr_conv;
7398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7399 this_ptr_conv.is_owned = false;
7400 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
7403 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7404 LDKChannelHandshakeConfig this_ptr_conv;
7405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7406 this_ptr_conv.is_owned = false;
7407 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
7411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7412 LDKChannelHandshakeConfig this_ptr_conv;
7413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7414 this_ptr_conv.is_owned = false;
7415 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
7418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7419 LDKChannelHandshakeConfig this_ptr_conv;
7420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7421 this_ptr_conv.is_owned = false;
7422 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
7426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7427 LDKChannelHandshakeConfig this_ptr_conv;
7428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7429 this_ptr_conv.is_owned = false;
7430 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
7433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv * _env, jclass _b, jint minimum_depth_arg, jshort our_to_self_delay_arg, jlong our_htlc_minimum_msat_arg) {
7434 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
7435 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7436 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7437 long ret_ref = (long)ret_var.inner;
7438 if (ret_var.is_owned) {
7444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
7445 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
7446 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7447 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7448 long ret_ref = (long)ret_var.inner;
7449 if (ret_var.is_owned) {
7455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7456 LDKChannelHandshakeLimits this_ptr_conv;
7457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7459 ChannelHandshakeLimits_free(this_ptr_conv);
7462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7463 LDKChannelHandshakeLimits orig_conv;
7464 orig_conv.inner = (void*)(orig & (~1));
7465 orig_conv.is_owned = false;
7466 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
7467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7469 long ret_ref = (long)ret_var.inner;
7470 if (ret_var.is_owned) {
7476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7477 LDKChannelHandshakeLimits this_ptr_conv;
7478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7479 this_ptr_conv.is_owned = false;
7480 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
7484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7485 LDKChannelHandshakeLimits this_ptr_conv;
7486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7487 this_ptr_conv.is_owned = false;
7488 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
7491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7492 LDKChannelHandshakeLimits this_ptr_conv;
7493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7494 this_ptr_conv.is_owned = false;
7495 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
7499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7500 LDKChannelHandshakeLimits this_ptr_conv;
7501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7502 this_ptr_conv.is_owned = false;
7503 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
7506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7507 LDKChannelHandshakeLimits this_ptr_conv;
7508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7509 this_ptr_conv.is_owned = false;
7510 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
7514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7515 LDKChannelHandshakeLimits this_ptr_conv;
7516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7517 this_ptr_conv.is_owned = false;
7518 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7522 LDKChannelHandshakeLimits this_ptr_conv;
7523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7524 this_ptr_conv.is_owned = false;
7525 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
7529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7530 LDKChannelHandshakeLimits this_ptr_conv;
7531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7532 this_ptr_conv.is_owned = false;
7533 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
7536 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7537 LDKChannelHandshakeLimits this_ptr_conv;
7538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7539 this_ptr_conv.is_owned = false;
7540 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
7544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7545 LDKChannelHandshakeLimits this_ptr_conv;
7546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7547 this_ptr_conv.is_owned = false;
7548 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
7551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7552 LDKChannelHandshakeLimits this_ptr_conv;
7553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7554 this_ptr_conv.is_owned = false;
7555 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
7559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7560 LDKChannelHandshakeLimits this_ptr_conv;
7561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7562 this_ptr_conv.is_owned = false;
7563 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
7566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7567 LDKChannelHandshakeLimits this_ptr_conv;
7568 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7569 this_ptr_conv.is_owned = false;
7570 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
7574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7575 LDKChannelHandshakeLimits this_ptr_conv;
7576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7577 this_ptr_conv.is_owned = false;
7578 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
7581 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7582 LDKChannelHandshakeLimits this_ptr_conv;
7583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7584 this_ptr_conv.is_owned = false;
7585 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
7589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7590 LDKChannelHandshakeLimits this_ptr_conv;
7591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7592 this_ptr_conv.is_owned = false;
7593 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
7596 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
7597 LDKChannelHandshakeLimits this_ptr_conv;
7598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7599 this_ptr_conv.is_owned = false;
7600 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
7604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7605 LDKChannelHandshakeLimits this_ptr_conv;
7606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7607 this_ptr_conv.is_owned = false;
7608 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
7611 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7612 LDKChannelHandshakeLimits this_ptr_conv;
7613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7614 this_ptr_conv.is_owned = false;
7615 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
7619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7620 LDKChannelHandshakeLimits this_ptr_conv;
7621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7622 this_ptr_conv.is_owned = false;
7623 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
7626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1new(JNIEnv * _env, jclass _b, jlong min_funding_satoshis_arg, jlong max_htlc_minimum_msat_arg, jlong min_max_htlc_value_in_flight_msat_arg, jlong max_channel_reserve_satoshis_arg, jshort min_max_accepted_htlcs_arg, jlong min_dust_limit_satoshis_arg, jlong max_dust_limit_satoshis_arg, jint max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, jshort their_to_self_delay_arg) {
7627 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);
7628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7630 long ret_ref = (long)ret_var.inner;
7631 if (ret_var.is_owned) {
7637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
7638 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
7639 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7640 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7641 long ret_ref = (long)ret_var.inner;
7642 if (ret_var.is_owned) {
7648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7649 LDKChannelConfig this_ptr_conv;
7650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7652 ChannelConfig_free(this_ptr_conv);
7655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7656 LDKChannelConfig orig_conv;
7657 orig_conv.inner = (void*)(orig & (~1));
7658 orig_conv.is_owned = false;
7659 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
7660 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7661 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7662 long ret_ref = (long)ret_var.inner;
7663 if (ret_var.is_owned) {
7669 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
7670 LDKChannelConfig this_ptr_conv;
7671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7672 this_ptr_conv.is_owned = false;
7673 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
7677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7678 LDKChannelConfig this_ptr_conv;
7679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7680 this_ptr_conv.is_owned = false;
7681 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
7684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
7685 LDKChannelConfig this_ptr_conv;
7686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7687 this_ptr_conv.is_owned = false;
7688 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
7692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7693 LDKChannelConfig this_ptr_conv;
7694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7695 this_ptr_conv.is_owned = false;
7696 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
7699 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7700 LDKChannelConfig this_ptr_conv;
7701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7702 this_ptr_conv.is_owned = false;
7703 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
7707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7708 LDKChannelConfig this_ptr_conv;
7709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7710 this_ptr_conv.is_owned = false;
7711 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
7714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1new(JNIEnv * _env, jclass _b, jint fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
7715 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
7716 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7717 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7718 long ret_ref = (long)ret_var.inner;
7719 if (ret_var.is_owned) {
7725 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
7726 LDKChannelConfig ret_var = ChannelConfig_default();
7727 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7728 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7729 long ret_ref = (long)ret_var.inner;
7730 if (ret_var.is_owned) {
7736 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
7737 LDKChannelConfig obj_conv;
7738 obj_conv.inner = (void*)(obj & (~1));
7739 obj_conv.is_owned = false;
7740 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
7741 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7742 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7743 CVec_u8Z_free(arg_var);
7747 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
7749 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
7750 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
7751 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
7752 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7753 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7754 long ret_ref = (long)ret_var.inner;
7755 if (ret_var.is_owned) {
7758 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
7762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7763 LDKUserConfig this_ptr_conv;
7764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7766 UserConfig_free(this_ptr_conv);
7769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7770 LDKUserConfig orig_conv;
7771 orig_conv.inner = (void*)(orig & (~1));
7772 orig_conv.is_owned = false;
7773 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
7774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7776 long ret_ref = (long)ret_var.inner;
7777 if (ret_var.is_owned) {
7783 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7784 LDKUserConfig this_ptr_conv;
7785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7786 this_ptr_conv.is_owned = false;
7787 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
7788 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7789 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7790 long ret_ref = (long)ret_var.inner;
7791 if (ret_var.is_owned) {
7797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7798 LDKUserConfig this_ptr_conv;
7799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7800 this_ptr_conv.is_owned = false;
7801 LDKChannelHandshakeConfig val_conv;
7802 val_conv.inner = (void*)(val & (~1));
7803 val_conv.is_owned = (val & 1) || (val == 0);
7804 if (val_conv.inner != NULL)
7805 val_conv = ChannelHandshakeConfig_clone(&val_conv);
7806 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
7809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
7810 LDKUserConfig this_ptr_conv;
7811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7812 this_ptr_conv.is_owned = false;
7813 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
7814 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7815 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7816 long ret_ref = (long)ret_var.inner;
7817 if (ret_var.is_owned) {
7823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7824 LDKUserConfig this_ptr_conv;
7825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7826 this_ptr_conv.is_owned = false;
7827 LDKChannelHandshakeLimits val_conv;
7828 val_conv.inner = (void*)(val & (~1));
7829 val_conv.is_owned = (val & 1) || (val == 0);
7830 if (val_conv.inner != NULL)
7831 val_conv = ChannelHandshakeLimits_clone(&val_conv);
7832 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
7835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
7836 LDKUserConfig this_ptr_conv;
7837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7838 this_ptr_conv.is_owned = false;
7839 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
7840 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7841 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7842 long ret_ref = (long)ret_var.inner;
7843 if (ret_var.is_owned) {
7849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7850 LDKUserConfig this_ptr_conv;
7851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7852 this_ptr_conv.is_owned = false;
7853 LDKChannelConfig val_conv;
7854 val_conv.inner = (void*)(val & (~1));
7855 val_conv.is_owned = (val & 1) || (val == 0);
7856 if (val_conv.inner != NULL)
7857 val_conv = ChannelConfig_clone(&val_conv);
7858 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
7861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv * _env, jclass _b, jlong own_channel_config_arg, jlong peer_channel_config_limits_arg, jlong channel_options_arg) {
7862 LDKChannelHandshakeConfig own_channel_config_arg_conv;
7863 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
7864 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
7865 if (own_channel_config_arg_conv.inner != NULL)
7866 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
7867 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
7868 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
7869 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
7870 if (peer_channel_config_limits_arg_conv.inner != NULL)
7871 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
7872 LDKChannelConfig channel_options_arg_conv;
7873 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
7874 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
7875 if (channel_options_arg_conv.inner != NULL)
7876 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
7877 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
7878 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7879 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7880 long ret_ref = (long)ret_var.inner;
7881 if (ret_var.is_owned) {
7887 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
7888 LDKUserConfig ret_var = UserConfig_default();
7889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7891 long ret_ref = (long)ret_var.inner;
7892 if (ret_var.is_owned) {
7898 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7899 LDKAccessError* orig_conv = (LDKAccessError*)orig;
7900 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
7904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7905 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
7906 FREE((void*)this_ptr);
7907 Access_free(this_ptr_conv);
7910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7911 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
7912 FREE((void*)this_ptr);
7913 Watch_free(this_ptr_conv);
7916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7917 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
7918 FREE((void*)this_ptr);
7919 Filter_free(this_ptr_conv);
7922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7923 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
7924 FREE((void*)this_ptr);
7925 BroadcasterInterface_free(this_ptr_conv);
7928 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7929 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
7930 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
7934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7935 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
7936 FREE((void*)this_ptr);
7937 FeeEstimator_free(this_ptr_conv);
7940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7941 LDKChainMonitor this_ptr_conv;
7942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7944 ChainMonitor_free(this_ptr_conv);
7947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7948 LDKChainMonitor this_arg_conv;
7949 this_arg_conv.inner = (void*)(this_arg & (~1));
7950 this_arg_conv.is_owned = false;
7951 unsigned char header_arr[80];
7952 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7953 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7954 unsigned char (*header_ref)[80] = &header_arr;
7955 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7956 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7957 if (txdata_constr.datalen > 0)
7958 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7960 txdata_constr.data = NULL;
7961 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7962 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7963 long arr_conv_24 = txdata_vals[y];
7964 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
7965 FREE((void*)arr_conv_24);
7966 txdata_constr.data[y] = arr_conv_24_conv;
7968 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7969 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
7973 LDKChainMonitor this_arg_conv;
7974 this_arg_conv.inner = (void*)(this_arg & (~1));
7975 this_arg_conv.is_owned = false;
7976 unsigned char header_arr[80];
7977 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7978 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7979 unsigned char (*header_ref)[80] = &header_arr;
7980 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
7983 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest, jlong persister) {
7984 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
7985 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
7986 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7987 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7988 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
7990 LDKLogger logger_conv = *(LDKLogger*)logger;
7991 if (logger_conv.free == LDKLogger_JCalls_free) {
7992 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7993 LDKLogger_JCalls_clone(logger_conv.this_arg);
7995 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
7996 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
7997 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7998 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
8000 LDKPersist persister_conv = *(LDKPersist*)persister;
8001 if (persister_conv.free == LDKPersist_JCalls_free) {
8002 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8003 LDKPersist_JCalls_clone(persister_conv.this_arg);
8005 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
8006 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8007 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8008 long ret_ref = (long)ret_var.inner;
8009 if (ret_var.is_owned) {
8015 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
8016 LDKChainMonitor this_arg_conv;
8017 this_arg_conv.inner = (void*)(this_arg & (~1));
8018 this_arg_conv.is_owned = false;
8019 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
8020 *ret = ChainMonitor_as_Watch(&this_arg_conv);
8024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
8025 LDKChainMonitor this_arg_conv;
8026 this_arg_conv.inner = (void*)(this_arg & (~1));
8027 this_arg_conv.is_owned = false;
8028 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
8029 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
8033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8034 LDKChannelMonitorUpdate this_ptr_conv;
8035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8036 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8037 ChannelMonitorUpdate_free(this_ptr_conv);
8040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8041 LDKChannelMonitorUpdate orig_conv;
8042 orig_conv.inner = (void*)(orig & (~1));
8043 orig_conv.is_owned = false;
8044 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_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 jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8055 LDKChannelMonitorUpdate this_ptr_conv;
8056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8057 this_ptr_conv.is_owned = false;
8058 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
8062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8063 LDKChannelMonitorUpdate this_ptr_conv;
8064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8065 this_ptr_conv.is_owned = false;
8066 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
8069 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
8070 LDKChannelMonitorUpdate obj_conv;
8071 obj_conv.inner = (void*)(obj & (~1));
8072 obj_conv.is_owned = false;
8073 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
8074 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8075 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8076 CVec_u8Z_free(arg_var);
8080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
8082 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
8083 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
8084 LDKCResult_ChannelMonitorUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ), "LDKCResult_ChannelMonitorUpdateDecodeErrorZ");
8085 *ret_conv = ChannelMonitorUpdate_read(ser_ref);
8086 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
8087 return (long)ret_conv;
8090 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8091 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
8092 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
8096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8097 LDKMonitorUpdateError this_ptr_conv;
8098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8100 MonitorUpdateError_free(this_ptr_conv);
8103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8104 LDKMonitorEvent this_ptr_conv;
8105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8107 MonitorEvent_free(this_ptr_conv);
8110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8111 LDKMonitorEvent orig_conv;
8112 orig_conv.inner = (void*)(orig & (~1));
8113 orig_conv.is_owned = false;
8114 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
8115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8117 long ret_ref = (long)ret_var.inner;
8118 if (ret_var.is_owned) {
8124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8125 LDKHTLCUpdate this_ptr_conv;
8126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8128 HTLCUpdate_free(this_ptr_conv);
8131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8132 LDKHTLCUpdate orig_conv;
8133 orig_conv.inner = (void*)(orig & (~1));
8134 orig_conv.is_owned = false;
8135 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
8136 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8137 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8138 long ret_ref = (long)ret_var.inner;
8139 if (ret_var.is_owned) {
8145 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
8146 LDKHTLCUpdate obj_conv;
8147 obj_conv.inner = (void*)(obj & (~1));
8148 obj_conv.is_owned = false;
8149 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
8150 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8151 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8152 CVec_u8Z_free(arg_var);
8156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
8158 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
8159 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
8160 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
8161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8163 long ret_ref = (long)ret_var.inner;
8164 if (ret_var.is_owned) {
8167 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
8171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8172 LDKChannelMonitor this_ptr_conv;
8173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8175 ChannelMonitor_free(this_ptr_conv);
8178 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv * _env, jclass _b, jlong obj) {
8179 LDKChannelMonitor obj_conv;
8180 obj_conv.inner = (void*)(obj & (~1));
8181 obj_conv.is_owned = false;
8182 LDKCVec_u8Z arg_var = ChannelMonitor_write(&obj_conv);
8183 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8184 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8185 CVec_u8Z_free(arg_var);
8189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong fee_estimator, jlong logger) {
8190 LDKChannelMonitor this_arg_conv;
8191 this_arg_conv.inner = (void*)(this_arg & (~1));
8192 this_arg_conv.is_owned = false;
8193 LDKChannelMonitorUpdate updates_conv;
8194 updates_conv.inner = (void*)(updates & (~1));
8195 updates_conv.is_owned = false;
8196 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
8197 LDKFeeEstimator* fee_estimator_conv = (LDKFeeEstimator*)fee_estimator;
8198 LDKLogger* logger_conv = (LDKLogger*)logger;
8199 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
8200 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv);
8201 return (long)ret_conv;
8204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
8205 LDKChannelMonitor this_arg_conv;
8206 this_arg_conv.inner = (void*)(this_arg & (~1));
8207 this_arg_conv.is_owned = false;
8208 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
8212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
8213 LDKChannelMonitor this_arg_conv;
8214 this_arg_conv.inner = (void*)(this_arg & (~1));
8215 this_arg_conv.is_owned = false;
8216 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
8217 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
8218 return (long)ret_ref;
8221 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
8222 LDKChannelMonitor this_arg_conv;
8223 this_arg_conv.inner = (void*)(this_arg & (~1));
8224 this_arg_conv.is_owned = false;
8225 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
8226 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
8227 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
8228 for (size_t o = 0; o < ret_var.datalen; o++) {
8229 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
8230 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8231 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8232 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
8233 if (arr_conv_14_var.is_owned) {
8234 arr_conv_14_ref |= 1;
8236 ret_arr_ptr[o] = arr_conv_14_ref;
8238 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
8243 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
8244 LDKChannelMonitor this_arg_conv;
8245 this_arg_conv.inner = (void*)(this_arg & (~1));
8246 this_arg_conv.is_owned = false;
8247 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
8248 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
8249 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
8250 for (size_t h = 0; h < ret_var.datalen; h++) {
8251 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
8252 *arr_conv_7_copy = ret_var.data[h];
8253 long arr_conv_7_ref = (long)arr_conv_7_copy;
8254 ret_arr_ptr[h] = arr_conv_7_ref;
8256 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
8261 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
8262 LDKChannelMonitor this_arg_conv;
8263 this_arg_conv.inner = (void*)(this_arg & (~1));
8264 this_arg_conv.is_owned = false;
8265 LDKLogger* logger_conv = (LDKLogger*)logger;
8266 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
8267 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
8268 for (size_t i = 0; i < ret_var.datalen; i++) {
8269 LDKTransaction arr_conv_8_var = ret_var.data[i];
8270 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, arr_conv_8_var.datalen);
8271 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
8272 Transaction_free(arr_conv_8_var);
8273 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
8279 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height, jlong broadcaster, jlong fee_estimator, jlong logger) {
8280 LDKChannelMonitor this_arg_conv;
8281 this_arg_conv.inner = (void*)(this_arg & (~1));
8282 this_arg_conv.is_owned = false;
8283 unsigned char header_arr[80];
8284 CHECK((*_env)->GetArrayLength (_env, header) == 80);
8285 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
8286 unsigned char (*header_ref)[80] = &header_arr;
8287 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
8288 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
8289 if (txdata_constr.datalen > 0)
8290 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
8292 txdata_constr.data = NULL;
8293 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
8294 for (size_t y = 0; y < txdata_constr.datalen; y++) {
8295 long arr_conv_24 = txdata_vals[y];
8296 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
8297 FREE((void*)arr_conv_24);
8298 txdata_constr.data[y] = arr_conv_24_conv;
8300 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
8301 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
8302 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8303 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8304 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8306 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8307 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8308 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8309 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8311 LDKLogger logger_conv = *(LDKLogger*)logger;
8312 if (logger_conv.free == LDKLogger_JCalls_free) {
8313 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8314 LDKLogger_JCalls_clone(logger_conv.this_arg);
8316 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);
8317 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
8318 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
8319 for (size_t u = 0; u < ret_var.datalen; u++) {
8320 LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* arr_conv_46_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ), "LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ");
8321 *arr_conv_46_ref = ret_var.data[u];
8322 ret_arr_ptr[u] = (long)arr_conv_46_ref;
8324 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
8329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint height, jlong broadcaster, jlong fee_estimator, jlong logger) {
8330 LDKChannelMonitor this_arg_conv;
8331 this_arg_conv.inner = (void*)(this_arg & (~1));
8332 this_arg_conv.is_owned = false;
8333 unsigned char header_arr[80];
8334 CHECK((*_env)->GetArrayLength (_env, header) == 80);
8335 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
8336 unsigned char (*header_ref)[80] = &header_arr;
8337 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
8338 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
8339 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8340 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
8342 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
8343 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
8344 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8345 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
8347 LDKLogger logger_conv = *(LDKLogger*)logger;
8348 if (logger_conv.free == LDKLogger_JCalls_free) {
8349 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
8350 LDKLogger_JCalls_clone(logger_conv.this_arg);
8352 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
8355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8356 LDKPersist this_ptr_conv = *(LDKPersist*)this_ptr;
8357 FREE((void*)this_ptr);
8358 Persist_free(this_ptr_conv);
8361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelMonitorZ_1read(JNIEnv * _env, jclass _b, jbyteArray ser, jlong arg) {
8363 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
8364 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
8365 LDKKeysInterface* arg_conv = (LDKKeysInterface*)arg;
8366 LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
8367 *ret_conv = C2Tuple_BlockHashChannelMonitorZ_read(ser_ref, arg_conv);
8368 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
8369 return (long)ret_conv;
8372 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8373 LDKOutPoint this_ptr_conv;
8374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8375 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8376 OutPoint_free(this_ptr_conv);
8379 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8380 LDKOutPoint orig_conv;
8381 orig_conv.inner = (void*)(orig & (~1));
8382 orig_conv.is_owned = false;
8383 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
8384 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8385 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8386 long ret_ref = (long)ret_var.inner;
8387 if (ret_var.is_owned) {
8393 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8394 LDKOutPoint this_ptr_conv;
8395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8396 this_ptr_conv.is_owned = false;
8397 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8398 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
8402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8403 LDKOutPoint this_ptr_conv;
8404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8405 this_ptr_conv.is_owned = false;
8406 LDKThirtyTwoBytes val_ref;
8407 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8408 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8409 OutPoint_set_txid(&this_ptr_conv, val_ref);
8412 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8413 LDKOutPoint this_ptr_conv;
8414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8415 this_ptr_conv.is_owned = false;
8416 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
8420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8421 LDKOutPoint this_ptr_conv;
8422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8423 this_ptr_conv.is_owned = false;
8424 OutPoint_set_index(&this_ptr_conv, val);
8427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
8428 LDKThirtyTwoBytes txid_arg_ref;
8429 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
8430 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
8431 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
8432 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8433 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8434 long ret_ref = (long)ret_var.inner;
8435 if (ret_var.is_owned) {
8441 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
8442 LDKOutPoint this_arg_conv;
8443 this_arg_conv.inner = (void*)(this_arg & (~1));
8444 this_arg_conv.is_owned = false;
8445 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
8446 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
8450 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
8451 LDKOutPoint obj_conv;
8452 obj_conv.inner = (void*)(obj & (~1));
8453 obj_conv.is_owned = false;
8454 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
8455 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8456 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8457 CVec_u8Z_free(arg_var);
8461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
8463 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
8464 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
8465 LDKOutPoint ret_var = OutPoint_read(ser_ref);
8466 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8467 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8468 long ret_ref = (long)ret_var.inner;
8469 if (ret_var.is_owned) {
8472 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
8476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8477 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
8478 FREE((void*)this_ptr);
8479 SpendableOutputDescriptor_free(this_ptr_conv);
8482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8483 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
8484 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
8485 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
8486 long ret_ref = (long)ret_copy;
8490 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1write(JNIEnv * _env, jclass _b, jlong obj) {
8491 LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
8492 LDKCVec_u8Z arg_var = SpendableOutputDescriptor_write(obj_conv);
8493 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8494 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8495 CVec_u8Z_free(arg_var);
8499 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
8501 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
8502 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
8503 LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
8504 *ret_conv = SpendableOutputDescriptor_read(ser_ref);
8505 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
8506 return (long)ret_conv;
8509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8510 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
8511 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8512 *ret = ChannelKeys_clone(orig_conv);
8516 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8517 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
8518 FREE((void*)this_ptr);
8519 ChannelKeys_free(this_ptr_conv);
8522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8523 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
8524 FREE((void*)this_ptr);
8525 KeysInterface_free(this_ptr_conv);
8528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8529 LDKInMemoryChannelKeys this_ptr_conv;
8530 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8531 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8532 InMemoryChannelKeys_free(this_ptr_conv);
8535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8536 LDKInMemoryChannelKeys orig_conv;
8537 orig_conv.inner = (void*)(orig & (~1));
8538 orig_conv.is_owned = false;
8539 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
8540 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8541 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8542 long ret_ref = (long)ret_var.inner;
8543 if (ret_var.is_owned) {
8549 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
8550 LDKInMemoryChannelKeys this_ptr_conv;
8551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8552 this_ptr_conv.is_owned = false;
8553 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8554 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
8558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8559 LDKInMemoryChannelKeys this_ptr_conv;
8560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8561 this_ptr_conv.is_owned = false;
8562 LDKSecretKey val_ref;
8563 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8564 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
8565 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
8568 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
8569 LDKInMemoryChannelKeys this_ptr_conv;
8570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8571 this_ptr_conv.is_owned = false;
8572 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8573 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
8577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8578 LDKInMemoryChannelKeys this_ptr_conv;
8579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8580 this_ptr_conv.is_owned = false;
8581 LDKSecretKey val_ref;
8582 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8583 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
8584 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
8587 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
8588 LDKInMemoryChannelKeys this_ptr_conv;
8589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8590 this_ptr_conv.is_owned = false;
8591 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8592 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
8596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8597 LDKInMemoryChannelKeys this_ptr_conv;
8598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8599 this_ptr_conv.is_owned = false;
8600 LDKSecretKey val_ref;
8601 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8602 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
8603 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
8606 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
8607 LDKInMemoryChannelKeys this_ptr_conv;
8608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8609 this_ptr_conv.is_owned = false;
8610 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8611 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
8615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8616 LDKInMemoryChannelKeys this_ptr_conv;
8617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8618 this_ptr_conv.is_owned = false;
8619 LDKSecretKey val_ref;
8620 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8621 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
8622 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
8625 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
8626 LDKInMemoryChannelKeys this_ptr_conv;
8627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8628 this_ptr_conv.is_owned = false;
8629 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8630 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
8634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8635 LDKInMemoryChannelKeys this_ptr_conv;
8636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8637 this_ptr_conv.is_owned = false;
8638 LDKSecretKey val_ref;
8639 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8640 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
8641 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
8644 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
8645 LDKInMemoryChannelKeys this_ptr_conv;
8646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8647 this_ptr_conv.is_owned = false;
8648 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8649 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
8653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8654 LDKInMemoryChannelKeys this_ptr_conv;
8655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8656 this_ptr_conv.is_owned = false;
8657 LDKThirtyTwoBytes val_ref;
8658 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8659 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8660 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
8663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_key, jbyteArray revocation_base_key, jbyteArray payment_key, jbyteArray delayed_payment_base_key, jbyteArray htlc_base_key, jbyteArray commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
8664 LDKSecretKey funding_key_ref;
8665 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
8666 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
8667 LDKSecretKey revocation_base_key_ref;
8668 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
8669 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
8670 LDKSecretKey payment_key_ref;
8671 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
8672 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
8673 LDKSecretKey delayed_payment_base_key_ref;
8674 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
8675 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
8676 LDKSecretKey htlc_base_key_ref;
8677 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
8678 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
8679 LDKThirtyTwoBytes commitment_seed_ref;
8680 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
8681 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
8682 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
8683 FREE((void*)key_derivation_params);
8684 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);
8685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8687 long ret_ref = (long)ret_var.inner;
8688 if (ret_var.is_owned) {
8694 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
8695 LDKInMemoryChannelKeys this_arg_conv;
8696 this_arg_conv.inner = (void*)(this_arg & (~1));
8697 this_arg_conv.is_owned = false;
8698 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
8699 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8700 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8701 long ret_ref = (long)ret_var.inner;
8702 if (ret_var.is_owned) {
8708 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
8709 LDKInMemoryChannelKeys this_arg_conv;
8710 this_arg_conv.inner = (void*)(this_arg & (~1));
8711 this_arg_conv.is_owned = false;
8712 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
8716 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
8717 LDKInMemoryChannelKeys this_arg_conv;
8718 this_arg_conv.inner = (void*)(this_arg & (~1));
8719 this_arg_conv.is_owned = false;
8720 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
8724 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1is_1outbound(JNIEnv * _env, jclass _b, jlong this_arg) {
8725 LDKInMemoryChannelKeys this_arg_conv;
8726 this_arg_conv.inner = (void*)(this_arg & (~1));
8727 this_arg_conv.is_owned = false;
8728 jboolean ret_val = InMemoryChannelKeys_is_outbound(&this_arg_conv);
8732 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1funding_1outpoint(JNIEnv * _env, jclass _b, jlong this_arg) {
8733 LDKInMemoryChannelKeys this_arg_conv;
8734 this_arg_conv.inner = (void*)(this_arg & (~1));
8735 this_arg_conv.is_owned = false;
8736 LDKOutPoint ret_var = InMemoryChannelKeys_funding_outpoint(&this_arg_conv);
8737 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8738 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8739 long ret_ref = (long)ret_var.inner;
8740 if (ret_var.is_owned) {
8746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1channel_1parameters(JNIEnv * _env, jclass _b, jlong this_arg) {
8747 LDKInMemoryChannelKeys this_arg_conv;
8748 this_arg_conv.inner = (void*)(this_arg & (~1));
8749 this_arg_conv.is_owned = false;
8750 LDKChannelTransactionParameters ret_var = InMemoryChannelKeys_get_channel_parameters(&this_arg_conv);
8751 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8752 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8753 long ret_ref = (long)ret_var.inner;
8754 if (ret_var.is_owned) {
8760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
8761 LDKInMemoryChannelKeys this_arg_conv;
8762 this_arg_conv.inner = (void*)(this_arg & (~1));
8763 this_arg_conv.is_owned = false;
8764 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
8765 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
8769 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
8770 LDKInMemoryChannelKeys obj_conv;
8771 obj_conv.inner = (void*)(obj & (~1));
8772 obj_conv.is_owned = false;
8773 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
8774 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8775 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8776 CVec_u8Z_free(arg_var);
8780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
8782 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
8783 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
8784 LDKCResult_InMemoryChannelKeysDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InMemoryChannelKeysDecodeErrorZ), "LDKCResult_InMemoryChannelKeysDecodeErrorZ");
8785 *ret_conv = InMemoryChannelKeys_read(ser_ref);
8786 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
8787 return (long)ret_conv;
8790 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8791 LDKKeysManager this_ptr_conv;
8792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8794 KeysManager_free(this_ptr_conv);
8797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1new(JNIEnv * _env, jclass _b, jbyteArray seed, jclass network, jlong starting_time_secs, jint starting_time_nanos) {
8798 unsigned char seed_arr[32];
8799 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
8800 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
8801 unsigned char (*seed_ref)[32] = &seed_arr;
8802 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
8803 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
8804 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8805 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8806 long ret_ref = (long)ret_var.inner;
8807 if (ret_var.is_owned) {
8813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1derive_1channel_1keys(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_value_satoshis, jlong params_1, jlong params_2) {
8814 LDKKeysManager this_arg_conv;
8815 this_arg_conv.inner = (void*)(this_arg & (~1));
8816 this_arg_conv.is_owned = false;
8817 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
8818 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8819 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8820 long ret_ref = (long)ret_var.inner;
8821 if (ret_var.is_owned) {
8827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
8828 LDKKeysManager this_arg_conv;
8829 this_arg_conv.inner = (void*)(this_arg & (~1));
8830 this_arg_conv.is_owned = false;
8831 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
8832 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
8836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8837 LDKChannelManager this_ptr_conv;
8838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8840 ChannelManager_free(this_ptr_conv);
8843 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8844 LDKChannelDetails this_ptr_conv;
8845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8847 ChannelDetails_free(this_ptr_conv);
8850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8851 LDKChannelDetails orig_conv;
8852 orig_conv.inner = (void*)(orig & (~1));
8853 orig_conv.is_owned = false;
8854 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
8855 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8856 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8857 long ret_ref = (long)ret_var.inner;
8858 if (ret_var.is_owned) {
8864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8865 LDKChannelDetails this_ptr_conv;
8866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8867 this_ptr_conv.is_owned = false;
8868 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8869 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
8873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8874 LDKChannelDetails this_ptr_conv;
8875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8876 this_ptr_conv.is_owned = false;
8877 LDKThirtyTwoBytes val_ref;
8878 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8879 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8880 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
8883 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8884 LDKChannelDetails this_ptr_conv;
8885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8886 this_ptr_conv.is_owned = false;
8887 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8888 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
8892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8893 LDKChannelDetails this_ptr_conv;
8894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8895 this_ptr_conv.is_owned = false;
8896 LDKPublicKey val_ref;
8897 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8898 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8899 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
8902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8903 LDKChannelDetails this_ptr_conv;
8904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8905 this_ptr_conv.is_owned = false;
8906 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
8907 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8908 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8909 long ret_ref = (long)ret_var.inner;
8910 if (ret_var.is_owned) {
8916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8917 LDKChannelDetails this_ptr_conv;
8918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8919 this_ptr_conv.is_owned = false;
8920 LDKInitFeatures val_conv;
8921 val_conv.inner = (void*)(val & (~1));
8922 val_conv.is_owned = (val & 1) || (val == 0);
8923 // Warning: we may need a move here but can't clone!
8924 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
8927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8928 LDKChannelDetails this_ptr_conv;
8929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8930 this_ptr_conv.is_owned = false;
8931 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
8935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8936 LDKChannelDetails this_ptr_conv;
8937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8938 this_ptr_conv.is_owned = false;
8939 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
8942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8943 LDKChannelDetails this_ptr_conv;
8944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8945 this_ptr_conv.is_owned = false;
8946 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
8950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8951 LDKChannelDetails this_ptr_conv;
8952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8953 this_ptr_conv.is_owned = false;
8954 ChannelDetails_set_user_id(&this_ptr_conv, val);
8957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8958 LDKChannelDetails this_ptr_conv;
8959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8960 this_ptr_conv.is_owned = false;
8961 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
8965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8966 LDKChannelDetails this_ptr_conv;
8967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8968 this_ptr_conv.is_owned = false;
8969 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
8972 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8973 LDKChannelDetails this_ptr_conv;
8974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8975 this_ptr_conv.is_owned = false;
8976 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
8980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8981 LDKChannelDetails this_ptr_conv;
8982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8983 this_ptr_conv.is_owned = false;
8984 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
8987 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
8988 LDKChannelDetails this_ptr_conv;
8989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8990 this_ptr_conv.is_owned = false;
8991 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
8995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
8996 LDKChannelDetails this_ptr_conv;
8997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8998 this_ptr_conv.is_owned = false;
8999 ChannelDetails_set_is_live(&this_ptr_conv, val);
9002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9003 LDKPaymentSendFailure this_ptr_conv;
9004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9006 PaymentSendFailure_free(this_ptr_conv);
9009 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv * _env, jclass _b, jclass network, jlong fee_est, jlong chain_monitor, jlong tx_broadcaster, jlong logger, jlong keys_manager, jlong config, jlong current_blockchain_height) {
9010 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
9011 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
9012 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
9013 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9014 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
9016 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
9017 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9018 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9019 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9021 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
9022 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9023 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9024 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9026 LDKLogger logger_conv = *(LDKLogger*)logger;
9027 if (logger_conv.free == LDKLogger_JCalls_free) {
9028 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9029 LDKLogger_JCalls_clone(logger_conv.this_arg);
9031 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
9032 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9033 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9034 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9036 LDKUserConfig config_conv;
9037 config_conv.inner = (void*)(config & (~1));
9038 config_conv.is_owned = (config & 1) || (config == 0);
9039 if (config_conv.inner != NULL)
9040 config_conv = UserConfig_clone(&config_conv);
9041 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);
9042 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9043 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9044 long ret_ref = (long)ret_var.inner;
9045 if (ret_var.is_owned) {
9051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_network_key, jlong channel_value_satoshis, jlong push_msat, jlong user_id, jlong override_config) {
9052 LDKChannelManager this_arg_conv;
9053 this_arg_conv.inner = (void*)(this_arg & (~1));
9054 this_arg_conv.is_owned = false;
9055 LDKPublicKey their_network_key_ref;
9056 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
9057 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
9058 LDKUserConfig override_config_conv;
9059 override_config_conv.inner = (void*)(override_config & (~1));
9060 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
9061 if (override_config_conv.inner != NULL)
9062 override_config_conv = UserConfig_clone(&override_config_conv);
9063 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9064 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
9065 return (long)ret_conv;
9068 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
9069 LDKChannelManager this_arg_conv;
9070 this_arg_conv.inner = (void*)(this_arg & (~1));
9071 this_arg_conv.is_owned = false;
9072 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
9073 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
9074 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
9075 for (size_t q = 0; q < ret_var.datalen; q++) {
9076 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9077 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9078 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9079 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9080 if (arr_conv_16_var.is_owned) {
9081 arr_conv_16_ref |= 1;
9083 ret_arr_ptr[q] = arr_conv_16_ref;
9085 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
9090 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
9091 LDKChannelManager this_arg_conv;
9092 this_arg_conv.inner = (void*)(this_arg & (~1));
9093 this_arg_conv.is_owned = false;
9094 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
9095 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
9096 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
9097 for (size_t q = 0; q < ret_var.datalen; q++) {
9098 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
9099 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9100 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9101 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
9102 if (arr_conv_16_var.is_owned) {
9103 arr_conv_16_ref |= 1;
9105 ret_arr_ptr[q] = arr_conv_16_ref;
9107 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
9112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
9113 LDKChannelManager this_arg_conv;
9114 this_arg_conv.inner = (void*)(this_arg & (~1));
9115 this_arg_conv.is_owned = false;
9116 unsigned char channel_id_arr[32];
9117 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
9118 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
9119 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9120 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
9121 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
9122 return (long)ret_conv;
9125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
9126 LDKChannelManager this_arg_conv;
9127 this_arg_conv.inner = (void*)(this_arg & (~1));
9128 this_arg_conv.is_owned = false;
9129 unsigned char channel_id_arr[32];
9130 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
9131 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
9132 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
9133 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
9136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
9137 LDKChannelManager this_arg_conv;
9138 this_arg_conv.inner = (void*)(this_arg & (~1));
9139 this_arg_conv.is_owned = false;
9140 ChannelManager_force_close_all_channels(&this_arg_conv);
9143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv * _env, jclass _b, jlong this_arg, jlong route, jbyteArray payment_hash, jbyteArray payment_secret) {
9144 LDKChannelManager this_arg_conv;
9145 this_arg_conv.inner = (void*)(this_arg & (~1));
9146 this_arg_conv.is_owned = false;
9147 LDKRoute route_conv;
9148 route_conv.inner = (void*)(route & (~1));
9149 route_conv.is_owned = false;
9150 LDKThirtyTwoBytes payment_hash_ref;
9151 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
9152 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
9153 LDKThirtyTwoBytes payment_secret_ref;
9154 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
9155 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
9156 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
9157 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
9158 return (long)ret_conv;
9161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1funding_1transaction_1generated(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray temporary_channel_id, jlong funding_txo) {
9162 LDKChannelManager this_arg_conv;
9163 this_arg_conv.inner = (void*)(this_arg & (~1));
9164 this_arg_conv.is_owned = false;
9165 unsigned char temporary_channel_id_arr[32];
9166 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
9167 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
9168 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
9169 LDKOutPoint funding_txo_conv;
9170 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9171 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
9172 if (funding_txo_conv.inner != NULL)
9173 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
9174 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
9177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray rgb, jbyteArray alias, jlongArray addresses) {
9178 LDKChannelManager this_arg_conv;
9179 this_arg_conv.inner = (void*)(this_arg & (~1));
9180 this_arg_conv.is_owned = false;
9181 LDKThreeBytes rgb_ref;
9182 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
9183 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
9184 LDKThirtyTwoBytes alias_ref;
9185 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
9186 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
9187 LDKCVec_NetAddressZ addresses_constr;
9188 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
9189 if (addresses_constr.datalen > 0)
9190 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9192 addresses_constr.data = NULL;
9193 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
9194 for (size_t m = 0; m < addresses_constr.datalen; m++) {
9195 long arr_conv_12 = addresses_vals[m];
9196 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9197 FREE((void*)arr_conv_12);
9198 addresses_constr.data[m] = arr_conv_12_conv;
9200 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
9201 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
9204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
9205 LDKChannelManager this_arg_conv;
9206 this_arg_conv.inner = (void*)(this_arg & (~1));
9207 this_arg_conv.is_owned = false;
9208 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
9211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
9212 LDKChannelManager this_arg_conv;
9213 this_arg_conv.inner = (void*)(this_arg & (~1));
9214 this_arg_conv.is_owned = false;
9215 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
9218 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_hash, jbyteArray payment_secret) {
9219 LDKChannelManager this_arg_conv;
9220 this_arg_conv.inner = (void*)(this_arg & (~1));
9221 this_arg_conv.is_owned = false;
9222 unsigned char payment_hash_arr[32];
9223 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
9224 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
9225 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
9226 LDKThirtyTwoBytes payment_secret_ref;
9227 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
9228 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
9229 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
9233 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_preimage, jbyteArray payment_secret, jlong expected_amount) {
9234 LDKChannelManager this_arg_conv;
9235 this_arg_conv.inner = (void*)(this_arg & (~1));
9236 this_arg_conv.is_owned = false;
9237 LDKThirtyTwoBytes payment_preimage_ref;
9238 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
9239 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
9240 LDKThirtyTwoBytes payment_secret_ref;
9241 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
9242 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
9243 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
9247 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
9248 LDKChannelManager this_arg_conv;
9249 this_arg_conv.inner = (void*)(this_arg & (~1));
9250 this_arg_conv.is_owned = false;
9251 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9252 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
9256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1channel_1monitor_1updated(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong highest_applied_update_id) {
9257 LDKChannelManager this_arg_conv;
9258 this_arg_conv.inner = (void*)(this_arg & (~1));
9259 this_arg_conv.is_owned = false;
9260 LDKOutPoint funding_txo_conv;
9261 funding_txo_conv.inner = (void*)(funding_txo & (~1));
9262 funding_txo_conv.is_owned = false;
9263 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
9266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
9267 LDKChannelManager this_arg_conv;
9268 this_arg_conv.inner = (void*)(this_arg & (~1));
9269 this_arg_conv.is_owned = false;
9270 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
9271 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
9275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
9276 LDKChannelManager this_arg_conv;
9277 this_arg_conv.inner = (void*)(this_arg & (~1));
9278 this_arg_conv.is_owned = false;
9279 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
9280 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
9284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
9285 LDKChannelManager this_arg_conv;
9286 this_arg_conv.inner = (void*)(this_arg & (~1));
9287 this_arg_conv.is_owned = false;
9288 unsigned char header_arr[80];
9289 CHECK((*_env)->GetArrayLength (_env, header) == 80);
9290 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
9291 unsigned char (*header_ref)[80] = &header_arr;
9292 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
9293 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
9294 if (txdata_constr.datalen > 0)
9295 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
9297 txdata_constr.data = NULL;
9298 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
9299 for (size_t y = 0; y < txdata_constr.datalen; y++) {
9300 long arr_conv_24 = txdata_vals[y];
9301 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
9302 FREE((void*)arr_conv_24);
9303 txdata_constr.data[y] = arr_conv_24_conv;
9305 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
9306 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
9309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
9310 LDKChannelManager this_arg_conv;
9311 this_arg_conv.inner = (void*)(this_arg & (~1));
9312 this_arg_conv.is_owned = false;
9313 unsigned char header_arr[80];
9314 CHECK((*_env)->GetArrayLength (_env, header) == 80);
9315 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
9316 unsigned char (*header_ref)[80] = &header_arr;
9317 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
9320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
9321 LDKChannelManager this_arg_conv;
9322 this_arg_conv.inner = (void*)(this_arg & (~1));
9323 this_arg_conv.is_owned = false;
9324 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
9325 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
9329 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv * _env, jclass _b, jlong obj) {
9330 LDKChannelManager obj_conv;
9331 obj_conv.inner = (void*)(obj & (~1));
9332 obj_conv.is_owned = false;
9333 LDKCVec_u8Z arg_var = ChannelManager_write(&obj_conv);
9334 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9335 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9336 CVec_u8Z_free(arg_var);
9340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9341 LDKChannelManagerReadArgs this_ptr_conv;
9342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9344 ChannelManagerReadArgs_free(this_ptr_conv);
9347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
9348 LDKChannelManagerReadArgs this_ptr_conv;
9349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9350 this_ptr_conv.is_owned = false;
9351 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
9355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9356 LDKChannelManagerReadArgs this_ptr_conv;
9357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9358 this_ptr_conv.is_owned = false;
9359 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
9360 if (val_conv.free == LDKKeysInterface_JCalls_free) {
9361 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9362 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
9364 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
9367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
9368 LDKChannelManagerReadArgs this_ptr_conv;
9369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9370 this_ptr_conv.is_owned = false;
9371 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
9375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9376 LDKChannelManagerReadArgs this_ptr_conv;
9377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9378 this_ptr_conv.is_owned = false;
9379 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
9380 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
9381 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9382 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
9384 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
9387 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
9388 LDKChannelManagerReadArgs this_ptr_conv;
9389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9390 this_ptr_conv.is_owned = false;
9391 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
9395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9396 LDKChannelManagerReadArgs this_ptr_conv;
9397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9398 this_ptr_conv.is_owned = false;
9399 LDKWatch val_conv = *(LDKWatch*)val;
9400 if (val_conv.free == LDKWatch_JCalls_free) {
9401 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9402 LDKWatch_JCalls_clone(val_conv.this_arg);
9404 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
9407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
9408 LDKChannelManagerReadArgs this_ptr_conv;
9409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9410 this_ptr_conv.is_owned = false;
9411 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
9415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9416 LDKChannelManagerReadArgs this_ptr_conv;
9417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9418 this_ptr_conv.is_owned = false;
9419 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
9420 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
9421 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9422 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
9424 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
9427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
9428 LDKChannelManagerReadArgs this_ptr_conv;
9429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9430 this_ptr_conv.is_owned = false;
9431 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
9435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9436 LDKChannelManagerReadArgs this_ptr_conv;
9437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9438 this_ptr_conv.is_owned = false;
9439 LDKLogger val_conv = *(LDKLogger*)val;
9440 if (val_conv.free == LDKLogger_JCalls_free) {
9441 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9442 LDKLogger_JCalls_clone(val_conv.this_arg);
9444 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
9447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
9448 LDKChannelManagerReadArgs this_ptr_conv;
9449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9450 this_ptr_conv.is_owned = false;
9451 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
9452 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9453 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9454 long ret_ref = (long)ret_var.inner;
9455 if (ret_var.is_owned) {
9461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9462 LDKChannelManagerReadArgs this_ptr_conv;
9463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9464 this_ptr_conv.is_owned = false;
9465 LDKUserConfig val_conv;
9466 val_conv.inner = (void*)(val & (~1));
9467 val_conv.is_owned = (val & 1) || (val == 0);
9468 if (val_conv.inner != NULL)
9469 val_conv = UserConfig_clone(&val_conv);
9470 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
9473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv * _env, jclass _b, jlong keys_manager, jlong fee_estimator, jlong chain_monitor, jlong tx_broadcaster, jlong logger, jlong default_config, jlongArray channel_monitors) {
9474 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
9475 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
9476 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9477 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
9479 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
9480 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
9481 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9482 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
9484 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
9485 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
9486 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9487 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
9489 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
9490 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
9491 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9492 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
9494 LDKLogger logger_conv = *(LDKLogger*)logger;
9495 if (logger_conv.free == LDKLogger_JCalls_free) {
9496 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
9497 LDKLogger_JCalls_clone(logger_conv.this_arg);
9499 LDKUserConfig default_config_conv;
9500 default_config_conv.inner = (void*)(default_config & (~1));
9501 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
9502 if (default_config_conv.inner != NULL)
9503 default_config_conv = UserConfig_clone(&default_config_conv);
9504 LDKCVec_ChannelMonitorZ channel_monitors_constr;
9505 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
9506 if (channel_monitors_constr.datalen > 0)
9507 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
9509 channel_monitors_constr.data = NULL;
9510 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
9511 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
9512 long arr_conv_16 = channel_monitors_vals[q];
9513 LDKChannelMonitor arr_conv_16_conv;
9514 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
9515 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
9516 channel_monitors_constr.data[q] = arr_conv_16_conv;
9518 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
9519 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);
9520 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9521 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9522 long ret_ref = (long)ret_var.inner;
9523 if (ret_var.is_owned) {
9529 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1BlockHashChannelManagerZ_1read(JNIEnv * _env, jclass _b, jbyteArray ser, jlong arg) {
9531 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9532 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9533 LDKChannelManagerReadArgs arg_conv;
9534 arg_conv.inner = (void*)(arg & (~1));
9535 arg_conv.is_owned = (arg & 1) || (arg == 0);
9536 // Warning: we may need a move here but can't clone!
9537 LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
9538 *ret_conv = C2Tuple_BlockHashChannelManagerZ_read(ser_ref, arg_conv);
9539 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9540 return (long)ret_conv;
9543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9544 LDKDecodeError this_ptr_conv;
9545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9547 DecodeError_free(this_ptr_conv);
9550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9551 LDKInit this_ptr_conv;
9552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9554 Init_free(this_ptr_conv);
9557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9559 orig_conv.inner = (void*)(orig & (~1));
9560 orig_conv.is_owned = false;
9561 LDKInit ret_var = Init_clone(&orig_conv);
9562 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9563 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9564 long ret_ref = (long)ret_var.inner;
9565 if (ret_var.is_owned) {
9571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9572 LDKErrorMessage this_ptr_conv;
9573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9575 ErrorMessage_free(this_ptr_conv);
9578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9579 LDKErrorMessage orig_conv;
9580 orig_conv.inner = (void*)(orig & (~1));
9581 orig_conv.is_owned = false;
9582 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
9583 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9584 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9585 long ret_ref = (long)ret_var.inner;
9586 if (ret_var.is_owned) {
9592 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9593 LDKErrorMessage this_ptr_conv;
9594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9595 this_ptr_conv.is_owned = false;
9596 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9597 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
9601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9602 LDKErrorMessage this_ptr_conv;
9603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9604 this_ptr_conv.is_owned = false;
9605 LDKThirtyTwoBytes val_ref;
9606 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9607 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9608 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
9611 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
9612 LDKErrorMessage this_ptr_conv;
9613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9614 this_ptr_conv.is_owned = false;
9615 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
9616 char* _buf = MALLOC(_str.len + 1, "str conv buf");
9617 memcpy(_buf, _str.chars, _str.len);
9619 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
9624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9625 LDKErrorMessage this_ptr_conv;
9626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9627 this_ptr_conv.is_owned = false;
9628 LDKCVec_u8Z val_ref;
9629 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
9630 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
9631 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
9632 ErrorMessage_set_data(&this_ptr_conv, val_ref);
9635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
9636 LDKThirtyTwoBytes channel_id_arg_ref;
9637 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9638 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9639 LDKCVec_u8Z data_arg_ref;
9640 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
9641 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
9642 (*_env)->GetByteArrayRegion(_env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
9643 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
9644 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9645 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9646 long ret_ref = (long)ret_var.inner;
9647 if (ret_var.is_owned) {
9653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9654 LDKPing this_ptr_conv;
9655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9656 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9657 Ping_free(this_ptr_conv);
9660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9662 orig_conv.inner = (void*)(orig & (~1));
9663 orig_conv.is_owned = false;
9664 LDKPing ret_var = Ping_clone(&orig_conv);
9665 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9666 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9667 long ret_ref = (long)ret_var.inner;
9668 if (ret_var.is_owned) {
9674 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
9675 LDKPing this_ptr_conv;
9676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9677 this_ptr_conv.is_owned = false;
9678 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
9682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9683 LDKPing this_ptr_conv;
9684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9685 this_ptr_conv.is_owned = false;
9686 Ping_set_ponglen(&this_ptr_conv, val);
9689 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
9690 LDKPing this_ptr_conv;
9691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9692 this_ptr_conv.is_owned = false;
9693 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
9697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9698 LDKPing this_ptr_conv;
9699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9700 this_ptr_conv.is_owned = false;
9701 Ping_set_byteslen(&this_ptr_conv, val);
9704 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
9705 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
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 void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9716 LDKPong this_ptr_conv;
9717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9719 Pong_free(this_ptr_conv);
9722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9724 orig_conv.inner = (void*)(orig & (~1));
9725 orig_conv.is_owned = false;
9726 LDKPong ret_var = Pong_clone(&orig_conv);
9727 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9728 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9729 long ret_ref = (long)ret_var.inner;
9730 if (ret_var.is_owned) {
9736 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
9737 LDKPong this_ptr_conv;
9738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9739 this_ptr_conv.is_owned = false;
9740 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
9744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9745 LDKPong this_ptr_conv;
9746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9747 this_ptr_conv.is_owned = false;
9748 Pong_set_byteslen(&this_ptr_conv, val);
9751 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
9752 LDKPong ret_var = Pong_new(byteslen_arg);
9753 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9754 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9755 long ret_ref = (long)ret_var.inner;
9756 if (ret_var.is_owned) {
9762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9763 LDKOpenChannel this_ptr_conv;
9764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9766 OpenChannel_free(this_ptr_conv);
9769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9770 LDKOpenChannel orig_conv;
9771 orig_conv.inner = (void*)(orig & (~1));
9772 orig_conv.is_owned = false;
9773 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
9774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9776 long ret_ref = (long)ret_var.inner;
9777 if (ret_var.is_owned) {
9783 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9784 LDKOpenChannel this_ptr_conv;
9785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9786 this_ptr_conv.is_owned = false;
9787 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9788 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
9792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9793 LDKOpenChannel this_ptr_conv;
9794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9795 this_ptr_conv.is_owned = false;
9796 LDKThirtyTwoBytes val_ref;
9797 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9798 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9799 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
9802 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9803 LDKOpenChannel this_ptr_conv;
9804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9805 this_ptr_conv.is_owned = false;
9806 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9807 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
9811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9812 LDKOpenChannel this_ptr_conv;
9813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9814 this_ptr_conv.is_owned = false;
9815 LDKThirtyTwoBytes val_ref;
9816 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9817 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9818 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
9821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
9822 LDKOpenChannel this_ptr_conv;
9823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9824 this_ptr_conv.is_owned = false;
9825 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
9829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9830 LDKOpenChannel this_ptr_conv;
9831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9832 this_ptr_conv.is_owned = false;
9833 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
9836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9837 LDKOpenChannel this_ptr_conv;
9838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9839 this_ptr_conv.is_owned = false;
9840 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
9844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9845 LDKOpenChannel this_ptr_conv;
9846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9847 this_ptr_conv.is_owned = false;
9848 OpenChannel_set_push_msat(&this_ptr_conv, val);
9851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
9852 LDKOpenChannel this_ptr_conv;
9853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9854 this_ptr_conv.is_owned = false;
9855 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
9859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9860 LDKOpenChannel this_ptr_conv;
9861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9862 this_ptr_conv.is_owned = false;
9863 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
9866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9867 LDKOpenChannel this_ptr_conv;
9868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9869 this_ptr_conv.is_owned = false;
9870 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
9874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9875 LDKOpenChannel this_ptr_conv;
9876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9877 this_ptr_conv.is_owned = false;
9878 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
9881 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
9882 LDKOpenChannel this_ptr_conv;
9883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9884 this_ptr_conv.is_owned = false;
9885 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
9889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9890 LDKOpenChannel this_ptr_conv;
9891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9892 this_ptr_conv.is_owned = false;
9893 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
9896 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9897 LDKOpenChannel this_ptr_conv;
9898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9899 this_ptr_conv.is_owned = false;
9900 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
9904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9905 LDKOpenChannel this_ptr_conv;
9906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9907 this_ptr_conv.is_owned = false;
9908 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
9911 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9912 LDKOpenChannel this_ptr_conv;
9913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9914 this_ptr_conv.is_owned = false;
9915 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
9919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9920 LDKOpenChannel this_ptr_conv;
9921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9922 this_ptr_conv.is_owned = false;
9923 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
9926 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
9927 LDKOpenChannel this_ptr_conv;
9928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9929 this_ptr_conv.is_owned = false;
9930 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
9934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9935 LDKOpenChannel this_ptr_conv;
9936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9937 this_ptr_conv.is_owned = false;
9938 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
9941 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
9942 LDKOpenChannel this_ptr_conv;
9943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9944 this_ptr_conv.is_owned = false;
9945 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
9949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9950 LDKOpenChannel this_ptr_conv;
9951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9952 this_ptr_conv.is_owned = false;
9953 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
9956 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
9957 LDKOpenChannel this_ptr_conv;
9958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9959 this_ptr_conv.is_owned = false;
9960 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9961 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
9965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9966 LDKOpenChannel this_ptr_conv;
9967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9968 this_ptr_conv.is_owned = false;
9969 LDKPublicKey val_ref;
9970 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9971 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9972 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
9975 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
9976 LDKOpenChannel this_ptr_conv;
9977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9978 this_ptr_conv.is_owned = false;
9979 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9980 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
9984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9985 LDKOpenChannel this_ptr_conv;
9986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9987 this_ptr_conv.is_owned = false;
9988 LDKPublicKey val_ref;
9989 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9990 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9991 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
9994 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9995 LDKOpenChannel this_ptr_conv;
9996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9997 this_ptr_conv.is_owned = false;
9998 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9999 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
10003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10004 LDKOpenChannel this_ptr_conv;
10005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10006 this_ptr_conv.is_owned = false;
10007 LDKPublicKey val_ref;
10008 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10009 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10010 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
10013 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10014 LDKOpenChannel this_ptr_conv;
10015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10016 this_ptr_conv.is_owned = false;
10017 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10018 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10023 LDKOpenChannel this_ptr_conv;
10024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10025 this_ptr_conv.is_owned = false;
10026 LDKPublicKey val_ref;
10027 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10028 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10029 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10032 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10033 LDKOpenChannel this_ptr_conv;
10034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10035 this_ptr_conv.is_owned = false;
10036 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10037 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10042 LDKOpenChannel this_ptr_conv;
10043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10044 this_ptr_conv.is_owned = false;
10045 LDKPublicKey val_ref;
10046 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10047 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10048 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10051 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10052 LDKOpenChannel this_ptr_conv;
10053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10054 this_ptr_conv.is_owned = false;
10055 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10056 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10061 LDKOpenChannel this_ptr_conv;
10062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10063 this_ptr_conv.is_owned = false;
10064 LDKPublicKey val_ref;
10065 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10066 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10067 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10070 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10071 LDKOpenChannel this_ptr_conv;
10072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10073 this_ptr_conv.is_owned = false;
10074 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
10078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10079 LDKOpenChannel this_ptr_conv;
10080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10081 this_ptr_conv.is_owned = false;
10082 OpenChannel_set_channel_flags(&this_ptr_conv, val);
10085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10086 LDKAcceptChannel this_ptr_conv;
10087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10089 AcceptChannel_free(this_ptr_conv);
10092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10093 LDKAcceptChannel orig_conv;
10094 orig_conv.inner = (void*)(orig & (~1));
10095 orig_conv.is_owned = false;
10096 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
10097 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10098 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10099 long ret_ref = (long)ret_var.inner;
10100 if (ret_var.is_owned) {
10106 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10107 LDKAcceptChannel this_ptr_conv;
10108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10109 this_ptr_conv.is_owned = false;
10110 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10111 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
10115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10116 LDKAcceptChannel this_ptr_conv;
10117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10118 this_ptr_conv.is_owned = false;
10119 LDKThirtyTwoBytes val_ref;
10120 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10121 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10122 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
10125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
10126 LDKAcceptChannel this_ptr_conv;
10127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10128 this_ptr_conv.is_owned = false;
10129 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
10133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10134 LDKAcceptChannel this_ptr_conv;
10135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10136 this_ptr_conv.is_owned = false;
10137 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
10140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10141 LDKAcceptChannel this_ptr_conv;
10142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10143 this_ptr_conv.is_owned = false;
10144 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
10148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10149 LDKAcceptChannel this_ptr_conv;
10150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10151 this_ptr_conv.is_owned = false;
10152 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
10155 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
10156 LDKAcceptChannel this_ptr_conv;
10157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10158 this_ptr_conv.is_owned = false;
10159 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
10163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10164 LDKAcceptChannel this_ptr_conv;
10165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10166 this_ptr_conv.is_owned = false;
10167 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
10170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10171 LDKAcceptChannel this_ptr_conv;
10172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10173 this_ptr_conv.is_owned = false;
10174 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
10178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10179 LDKAcceptChannel this_ptr_conv;
10180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10181 this_ptr_conv.is_owned = false;
10182 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
10185 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
10186 LDKAcceptChannel this_ptr_conv;
10187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10188 this_ptr_conv.is_owned = false;
10189 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
10193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10194 LDKAcceptChannel this_ptr_conv;
10195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10196 this_ptr_conv.is_owned = false;
10197 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
10200 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
10201 LDKAcceptChannel this_ptr_conv;
10202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10203 this_ptr_conv.is_owned = false;
10204 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
10208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10209 LDKAcceptChannel this_ptr_conv;
10210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10211 this_ptr_conv.is_owned = false;
10212 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
10215 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
10216 LDKAcceptChannel this_ptr_conv;
10217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10218 this_ptr_conv.is_owned = false;
10219 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
10223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10224 LDKAcceptChannel this_ptr_conv;
10225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10226 this_ptr_conv.is_owned = false;
10227 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
10230 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10231 LDKAcceptChannel this_ptr_conv;
10232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10233 this_ptr_conv.is_owned = false;
10234 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10235 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
10239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10240 LDKAcceptChannel this_ptr_conv;
10241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10242 this_ptr_conv.is_owned = false;
10243 LDKPublicKey val_ref;
10244 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10245 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10246 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
10249 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10250 LDKAcceptChannel this_ptr_conv;
10251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10252 this_ptr_conv.is_owned = false;
10253 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10254 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10259 LDKAcceptChannel this_ptr_conv;
10260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10261 this_ptr_conv.is_owned = false;
10262 LDKPublicKey val_ref;
10263 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10264 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10265 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
10268 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10269 LDKAcceptChannel this_ptr_conv;
10270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10271 this_ptr_conv.is_owned = false;
10272 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10273 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
10277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10278 LDKAcceptChannel this_ptr_conv;
10279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10280 this_ptr_conv.is_owned = false;
10281 LDKPublicKey val_ref;
10282 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10283 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10284 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
10287 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10288 LDKAcceptChannel this_ptr_conv;
10289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10290 this_ptr_conv.is_owned = false;
10291 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10292 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10297 LDKAcceptChannel this_ptr_conv;
10298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10299 this_ptr_conv.is_owned = false;
10300 LDKPublicKey val_ref;
10301 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10302 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10303 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10306 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10307 LDKAcceptChannel this_ptr_conv;
10308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10309 this_ptr_conv.is_owned = false;
10310 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10311 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10316 LDKAcceptChannel this_ptr_conv;
10317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10318 this_ptr_conv.is_owned = false;
10319 LDKPublicKey val_ref;
10320 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10321 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10322 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
10325 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10326 LDKAcceptChannel this_ptr_conv;
10327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10328 this_ptr_conv.is_owned = false;
10329 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10330 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
10334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10335 LDKAcceptChannel this_ptr_conv;
10336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10337 this_ptr_conv.is_owned = false;
10338 LDKPublicKey val_ref;
10339 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10340 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10341 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
10344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10345 LDKFundingCreated this_ptr_conv;
10346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10348 FundingCreated_free(this_ptr_conv);
10351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10352 LDKFundingCreated orig_conv;
10353 orig_conv.inner = (void*)(orig & (~1));
10354 orig_conv.is_owned = false;
10355 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
10356 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10357 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10358 long ret_ref = (long)ret_var.inner;
10359 if (ret_var.is_owned) {
10365 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10366 LDKFundingCreated this_ptr_conv;
10367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10368 this_ptr_conv.is_owned = false;
10369 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10370 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
10374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10375 LDKFundingCreated this_ptr_conv;
10376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10377 this_ptr_conv.is_owned = false;
10378 LDKThirtyTwoBytes val_ref;
10379 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10380 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10381 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
10384 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
10385 LDKFundingCreated this_ptr_conv;
10386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10387 this_ptr_conv.is_owned = false;
10388 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10389 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
10393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10394 LDKFundingCreated this_ptr_conv;
10395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10396 this_ptr_conv.is_owned = false;
10397 LDKThirtyTwoBytes val_ref;
10398 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10399 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10400 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
10403 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
10404 LDKFundingCreated this_ptr_conv;
10405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10406 this_ptr_conv.is_owned = false;
10407 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
10411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10412 LDKFundingCreated this_ptr_conv;
10413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10414 this_ptr_conv.is_owned = false;
10415 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
10418 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10419 LDKFundingCreated this_ptr_conv;
10420 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10421 this_ptr_conv.is_owned = false;
10422 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10423 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
10427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10428 LDKFundingCreated this_ptr_conv;
10429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10430 this_ptr_conv.is_owned = false;
10431 LDKSignature val_ref;
10432 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10433 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10434 FundingCreated_set_signature(&this_ptr_conv, val_ref);
10437 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jbyteArray temporary_channel_id_arg, jbyteArray funding_txid_arg, jshort funding_output_index_arg, jbyteArray signature_arg) {
10438 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
10439 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
10440 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
10441 LDKThirtyTwoBytes funding_txid_arg_ref;
10442 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
10443 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
10444 LDKSignature signature_arg_ref;
10445 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10446 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10447 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
10448 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10449 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10450 long ret_ref = (long)ret_var.inner;
10451 if (ret_var.is_owned) {
10457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10458 LDKFundingSigned this_ptr_conv;
10459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10461 FundingSigned_free(this_ptr_conv);
10464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10465 LDKFundingSigned orig_conv;
10466 orig_conv.inner = (void*)(orig & (~1));
10467 orig_conv.is_owned = false;
10468 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
10469 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10470 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10471 long ret_ref = (long)ret_var.inner;
10472 if (ret_var.is_owned) {
10478 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10479 LDKFundingSigned this_ptr_conv;
10480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10481 this_ptr_conv.is_owned = false;
10482 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10483 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
10487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10488 LDKFundingSigned this_ptr_conv;
10489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10490 this_ptr_conv.is_owned = false;
10491 LDKThirtyTwoBytes val_ref;
10492 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10493 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10494 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
10497 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10498 LDKFundingSigned this_ptr_conv;
10499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10500 this_ptr_conv.is_owned = false;
10501 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10502 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
10506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10507 LDKFundingSigned this_ptr_conv;
10508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10509 this_ptr_conv.is_owned = false;
10510 LDKSignature val_ref;
10511 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10512 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10513 FundingSigned_set_signature(&this_ptr_conv, val_ref);
10516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
10517 LDKThirtyTwoBytes channel_id_arg_ref;
10518 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
10519 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10520 LDKSignature signature_arg_ref;
10521 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10522 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10523 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
10524 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10525 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10526 long ret_ref = (long)ret_var.inner;
10527 if (ret_var.is_owned) {
10533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10534 LDKFundingLocked this_ptr_conv;
10535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10536 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10537 FundingLocked_free(this_ptr_conv);
10540 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10541 LDKFundingLocked orig_conv;
10542 orig_conv.inner = (void*)(orig & (~1));
10543 orig_conv.is_owned = false;
10544 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
10545 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10546 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10547 long ret_ref = (long)ret_var.inner;
10548 if (ret_var.is_owned) {
10554 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10555 LDKFundingLocked this_ptr_conv;
10556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10557 this_ptr_conv.is_owned = false;
10558 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10559 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
10563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10564 LDKFundingLocked this_ptr_conv;
10565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10566 this_ptr_conv.is_owned = false;
10567 LDKThirtyTwoBytes val_ref;
10568 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10569 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10570 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
10573 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10574 LDKFundingLocked this_ptr_conv;
10575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10576 this_ptr_conv.is_owned = false;
10577 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10578 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
10582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10583 LDKFundingLocked this_ptr_conv;
10584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10585 this_ptr_conv.is_owned = false;
10586 LDKPublicKey val_ref;
10587 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10588 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10589 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
10592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
10593 LDKThirtyTwoBytes channel_id_arg_ref;
10594 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
10595 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10596 LDKPublicKey next_per_commitment_point_arg_ref;
10597 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
10598 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
10599 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
10600 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10601 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10602 long ret_ref = (long)ret_var.inner;
10603 if (ret_var.is_owned) {
10609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10610 LDKShutdown this_ptr_conv;
10611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10612 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10613 Shutdown_free(this_ptr_conv);
10616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10617 LDKShutdown orig_conv;
10618 orig_conv.inner = (void*)(orig & (~1));
10619 orig_conv.is_owned = false;
10620 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
10621 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10622 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10623 long ret_ref = (long)ret_var.inner;
10624 if (ret_var.is_owned) {
10630 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10631 LDKShutdown this_ptr_conv;
10632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10633 this_ptr_conv.is_owned = false;
10634 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10635 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
10639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10640 LDKShutdown this_ptr_conv;
10641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10642 this_ptr_conv.is_owned = false;
10643 LDKThirtyTwoBytes val_ref;
10644 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10645 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10646 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
10649 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10650 LDKShutdown this_ptr_conv;
10651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10652 this_ptr_conv.is_owned = false;
10653 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
10654 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10655 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10660 LDKShutdown this_ptr_conv;
10661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10662 this_ptr_conv.is_owned = false;
10663 LDKCVec_u8Z val_ref;
10664 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10665 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
10666 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
10667 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
10670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
10671 LDKThirtyTwoBytes channel_id_arg_ref;
10672 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
10673 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10674 LDKCVec_u8Z scriptpubkey_arg_ref;
10675 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
10676 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
10677 (*_env)->GetByteArrayRegion(_env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
10678 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
10679 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10680 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10681 long ret_ref = (long)ret_var.inner;
10682 if (ret_var.is_owned) {
10688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10689 LDKClosingSigned this_ptr_conv;
10690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10692 ClosingSigned_free(this_ptr_conv);
10695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10696 LDKClosingSigned orig_conv;
10697 orig_conv.inner = (void*)(orig & (~1));
10698 orig_conv.is_owned = false;
10699 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
10700 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10701 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10702 long ret_ref = (long)ret_var.inner;
10703 if (ret_var.is_owned) {
10709 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10710 LDKClosingSigned this_ptr_conv;
10711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10712 this_ptr_conv.is_owned = false;
10713 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10714 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
10718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10719 LDKClosingSigned this_ptr_conv;
10720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10721 this_ptr_conv.is_owned = false;
10722 LDKThirtyTwoBytes val_ref;
10723 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10724 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10725 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
10728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
10729 LDKClosingSigned this_ptr_conv;
10730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10731 this_ptr_conv.is_owned = false;
10732 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
10736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10737 LDKClosingSigned this_ptr_conv;
10738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10739 this_ptr_conv.is_owned = false;
10740 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
10743 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10744 LDKClosingSigned this_ptr_conv;
10745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10746 this_ptr_conv.is_owned = false;
10747 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10748 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
10752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10753 LDKClosingSigned this_ptr_conv;
10754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10755 this_ptr_conv.is_owned = false;
10756 LDKSignature val_ref;
10757 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10758 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10759 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
10762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong fee_satoshis_arg, jbyteArray signature_arg) {
10763 LDKThirtyTwoBytes channel_id_arg_ref;
10764 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
10765 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10766 LDKSignature signature_arg_ref;
10767 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10768 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10769 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
10770 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10771 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10772 long ret_ref = (long)ret_var.inner;
10773 if (ret_var.is_owned) {
10779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10780 LDKUpdateAddHTLC this_ptr_conv;
10781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10783 UpdateAddHTLC_free(this_ptr_conv);
10786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10787 LDKUpdateAddHTLC orig_conv;
10788 orig_conv.inner = (void*)(orig & (~1));
10789 orig_conv.is_owned = false;
10790 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
10791 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10792 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10793 long ret_ref = (long)ret_var.inner;
10794 if (ret_var.is_owned) {
10800 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10801 LDKUpdateAddHTLC this_ptr_conv;
10802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10803 this_ptr_conv.is_owned = false;
10804 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10805 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
10809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10810 LDKUpdateAddHTLC this_ptr_conv;
10811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10812 this_ptr_conv.is_owned = false;
10813 LDKThirtyTwoBytes val_ref;
10814 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10815 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10816 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
10819 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10820 LDKUpdateAddHTLC this_ptr_conv;
10821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10822 this_ptr_conv.is_owned = false;
10823 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
10827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10828 LDKUpdateAddHTLC this_ptr_conv;
10829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10830 this_ptr_conv.is_owned = false;
10831 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
10834 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10835 LDKUpdateAddHTLC this_ptr_conv;
10836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10837 this_ptr_conv.is_owned = false;
10838 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
10842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10843 LDKUpdateAddHTLC this_ptr_conv;
10844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10845 this_ptr_conv.is_owned = false;
10846 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
10849 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10850 LDKUpdateAddHTLC this_ptr_conv;
10851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10852 this_ptr_conv.is_owned = false;
10853 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10854 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
10858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10859 LDKUpdateAddHTLC this_ptr_conv;
10860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10861 this_ptr_conv.is_owned = false;
10862 LDKThirtyTwoBytes val_ref;
10863 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10864 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10865 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
10868 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
10869 LDKUpdateAddHTLC this_ptr_conv;
10870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10871 this_ptr_conv.is_owned = false;
10872 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
10876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10877 LDKUpdateAddHTLC this_ptr_conv;
10878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10879 this_ptr_conv.is_owned = false;
10880 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
10883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10884 LDKUpdateFulfillHTLC this_ptr_conv;
10885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10887 UpdateFulfillHTLC_free(this_ptr_conv);
10890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10891 LDKUpdateFulfillHTLC orig_conv;
10892 orig_conv.inner = (void*)(orig & (~1));
10893 orig_conv.is_owned = false;
10894 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
10895 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10896 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10897 long ret_ref = (long)ret_var.inner;
10898 if (ret_var.is_owned) {
10904 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10905 LDKUpdateFulfillHTLC this_ptr_conv;
10906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10907 this_ptr_conv.is_owned = false;
10908 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10909 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
10913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10914 LDKUpdateFulfillHTLC this_ptr_conv;
10915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10916 this_ptr_conv.is_owned = false;
10917 LDKThirtyTwoBytes val_ref;
10918 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10919 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10920 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
10923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10924 LDKUpdateFulfillHTLC this_ptr_conv;
10925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10926 this_ptr_conv.is_owned = false;
10927 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
10931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10932 LDKUpdateFulfillHTLC this_ptr_conv;
10933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10934 this_ptr_conv.is_owned = false;
10935 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
10938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
10939 LDKUpdateFulfillHTLC this_ptr_conv;
10940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10941 this_ptr_conv.is_owned = false;
10942 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10943 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
10947 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10948 LDKUpdateFulfillHTLC this_ptr_conv;
10949 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10950 this_ptr_conv.is_owned = false;
10951 LDKThirtyTwoBytes val_ref;
10952 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10953 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10954 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
10957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong htlc_id_arg, jbyteArray payment_preimage_arg) {
10958 LDKThirtyTwoBytes channel_id_arg_ref;
10959 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
10960 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
10961 LDKThirtyTwoBytes payment_preimage_arg_ref;
10962 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
10963 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
10964 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
10965 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10966 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10967 long ret_ref = (long)ret_var.inner;
10968 if (ret_var.is_owned) {
10974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10975 LDKUpdateFailHTLC this_ptr_conv;
10976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10978 UpdateFailHTLC_free(this_ptr_conv);
10981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10982 LDKUpdateFailHTLC orig_conv;
10983 orig_conv.inner = (void*)(orig & (~1));
10984 orig_conv.is_owned = false;
10985 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
10986 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10987 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10988 long ret_ref = (long)ret_var.inner;
10989 if (ret_var.is_owned) {
10995 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10996 LDKUpdateFailHTLC this_ptr_conv;
10997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10998 this_ptr_conv.is_owned = false;
10999 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11000 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
11004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11005 LDKUpdateFailHTLC this_ptr_conv;
11006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11007 this_ptr_conv.is_owned = false;
11008 LDKThirtyTwoBytes val_ref;
11009 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11010 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11011 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
11014 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11015 LDKUpdateFailHTLC this_ptr_conv;
11016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11017 this_ptr_conv.is_owned = false;
11018 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
11022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11023 LDKUpdateFailHTLC this_ptr_conv;
11024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11025 this_ptr_conv.is_owned = false;
11026 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
11029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11030 LDKUpdateFailMalformedHTLC this_ptr_conv;
11031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11033 UpdateFailMalformedHTLC_free(this_ptr_conv);
11036 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11037 LDKUpdateFailMalformedHTLC orig_conv;
11038 orig_conv.inner = (void*)(orig & (~1));
11039 orig_conv.is_owned = false;
11040 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
11041 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11042 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11043 long ret_ref = (long)ret_var.inner;
11044 if (ret_var.is_owned) {
11050 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11051 LDKUpdateFailMalformedHTLC this_ptr_conv;
11052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11053 this_ptr_conv.is_owned = false;
11054 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11055 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
11059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11060 LDKUpdateFailMalformedHTLC this_ptr_conv;
11061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11062 this_ptr_conv.is_owned = false;
11063 LDKThirtyTwoBytes val_ref;
11064 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11065 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11066 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
11069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11070 LDKUpdateFailMalformedHTLC this_ptr_conv;
11071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11072 this_ptr_conv.is_owned = false;
11073 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
11077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11078 LDKUpdateFailMalformedHTLC this_ptr_conv;
11079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11080 this_ptr_conv.is_owned = false;
11081 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
11084 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
11085 LDKUpdateFailMalformedHTLC this_ptr_conv;
11086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11087 this_ptr_conv.is_owned = false;
11088 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
11092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11093 LDKUpdateFailMalformedHTLC this_ptr_conv;
11094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11095 this_ptr_conv.is_owned = false;
11096 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
11099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11100 LDKCommitmentSigned this_ptr_conv;
11101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11103 CommitmentSigned_free(this_ptr_conv);
11106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11107 LDKCommitmentSigned orig_conv;
11108 orig_conv.inner = (void*)(orig & (~1));
11109 orig_conv.is_owned = false;
11110 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
11111 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11112 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11113 long ret_ref = (long)ret_var.inner;
11114 if (ret_var.is_owned) {
11120 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11121 LDKCommitmentSigned this_ptr_conv;
11122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11123 this_ptr_conv.is_owned = false;
11124 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11125 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
11129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11130 LDKCommitmentSigned this_ptr_conv;
11131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11132 this_ptr_conv.is_owned = false;
11133 LDKThirtyTwoBytes val_ref;
11134 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11135 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11136 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
11139 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
11140 LDKCommitmentSigned this_ptr_conv;
11141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11142 this_ptr_conv.is_owned = false;
11143 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11144 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
11148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11149 LDKCommitmentSigned this_ptr_conv;
11150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11151 this_ptr_conv.is_owned = false;
11152 LDKSignature val_ref;
11153 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11154 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11155 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
11158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
11159 LDKCommitmentSigned this_ptr_conv;
11160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11161 this_ptr_conv.is_owned = false;
11162 LDKCVec_SignatureZ val_constr;
11163 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11164 if (val_constr.datalen > 0)
11165 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11167 val_constr.data = NULL;
11168 for (size_t i = 0; i < val_constr.datalen; i++) {
11169 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
11170 LDKSignature arr_conv_8_ref;
11171 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
11172 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11173 val_constr.data[i] = arr_conv_8_ref;
11175 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
11178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg, jobjectArray htlc_signatures_arg) {
11179 LDKThirtyTwoBytes channel_id_arg_ref;
11180 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
11181 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11182 LDKSignature signature_arg_ref;
11183 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
11184 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11185 LDKCVec_SignatureZ htlc_signatures_arg_constr;
11186 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
11187 if (htlc_signatures_arg_constr.datalen > 0)
11188 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
11190 htlc_signatures_arg_constr.data = NULL;
11191 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
11192 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
11193 LDKSignature arr_conv_8_ref;
11194 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
11195 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
11196 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
11198 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
11199 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11200 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11201 long ret_ref = (long)ret_var.inner;
11202 if (ret_var.is_owned) {
11208 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11209 LDKRevokeAndACK this_ptr_conv;
11210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11212 RevokeAndACK_free(this_ptr_conv);
11215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11216 LDKRevokeAndACK orig_conv;
11217 orig_conv.inner = (void*)(orig & (~1));
11218 orig_conv.is_owned = false;
11219 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
11220 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11221 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11222 long ret_ref = (long)ret_var.inner;
11223 if (ret_var.is_owned) {
11229 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11230 LDKRevokeAndACK this_ptr_conv;
11231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11232 this_ptr_conv.is_owned = false;
11233 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11234 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
11238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11239 LDKRevokeAndACK this_ptr_conv;
11240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11241 this_ptr_conv.is_owned = false;
11242 LDKThirtyTwoBytes val_ref;
11243 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11244 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11245 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
11248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
11249 LDKRevokeAndACK this_ptr_conv;
11250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11251 this_ptr_conv.is_owned = false;
11252 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11253 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
11257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11258 LDKRevokeAndACK this_ptr_conv;
11259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11260 this_ptr_conv.is_owned = false;
11261 LDKThirtyTwoBytes val_ref;
11262 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11263 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11264 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
11267 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11268 LDKRevokeAndACK this_ptr_conv;
11269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11270 this_ptr_conv.is_owned = false;
11271 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11272 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
11276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11277 LDKRevokeAndACK this_ptr_conv;
11278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11279 this_ptr_conv.is_owned = false;
11280 LDKPublicKey val_ref;
11281 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11282 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11283 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
11286 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray per_commitment_secret_arg, jbyteArray next_per_commitment_point_arg) {
11287 LDKThirtyTwoBytes channel_id_arg_ref;
11288 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
11289 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11290 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
11291 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
11292 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
11293 LDKPublicKey next_per_commitment_point_arg_ref;
11294 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
11295 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
11296 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
11297 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11298 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11299 long ret_ref = (long)ret_var.inner;
11300 if (ret_var.is_owned) {
11306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11307 LDKUpdateFee this_ptr_conv;
11308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11310 UpdateFee_free(this_ptr_conv);
11313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11314 LDKUpdateFee orig_conv;
11315 orig_conv.inner = (void*)(orig & (~1));
11316 orig_conv.is_owned = false;
11317 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
11318 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11319 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11320 long ret_ref = (long)ret_var.inner;
11321 if (ret_var.is_owned) {
11327 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11328 LDKUpdateFee this_ptr_conv;
11329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11330 this_ptr_conv.is_owned = false;
11331 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11332 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
11336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11337 LDKUpdateFee this_ptr_conv;
11338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11339 this_ptr_conv.is_owned = false;
11340 LDKThirtyTwoBytes val_ref;
11341 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11342 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11343 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
11346 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
11347 LDKUpdateFee this_ptr_conv;
11348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11349 this_ptr_conv.is_owned = false;
11350 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
11354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11355 LDKUpdateFee this_ptr_conv;
11356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11357 this_ptr_conv.is_owned = false;
11358 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
11361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
11362 LDKThirtyTwoBytes channel_id_arg_ref;
11363 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
11364 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11365 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
11366 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11367 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11368 long ret_ref = (long)ret_var.inner;
11369 if (ret_var.is_owned) {
11375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11376 LDKDataLossProtect this_ptr_conv;
11377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11379 DataLossProtect_free(this_ptr_conv);
11382 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11383 LDKDataLossProtect orig_conv;
11384 orig_conv.inner = (void*)(orig & (~1));
11385 orig_conv.is_owned = false;
11386 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
11387 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11388 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11389 long ret_ref = (long)ret_var.inner;
11390 if (ret_var.is_owned) {
11396 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
11397 LDKDataLossProtect this_ptr_conv;
11398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11399 this_ptr_conv.is_owned = false;
11400 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11401 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
11405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11406 LDKDataLossProtect this_ptr_conv;
11407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11408 this_ptr_conv.is_owned = false;
11409 LDKThirtyTwoBytes val_ref;
11410 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11411 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11412 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
11415 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11416 LDKDataLossProtect this_ptr_conv;
11417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11418 this_ptr_conv.is_owned = false;
11419 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11420 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
11424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11425 LDKDataLossProtect this_ptr_conv;
11426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11427 this_ptr_conv.is_owned = false;
11428 LDKPublicKey val_ref;
11429 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11430 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11431 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
11434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jbyteArray your_last_per_commitment_secret_arg, jbyteArray my_current_per_commitment_point_arg) {
11435 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
11436 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
11437 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
11438 LDKPublicKey my_current_per_commitment_point_arg_ref;
11439 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
11440 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
11441 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
11442 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11443 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11444 long ret_ref = (long)ret_var.inner;
11445 if (ret_var.is_owned) {
11451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11452 LDKChannelReestablish this_ptr_conv;
11453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11455 ChannelReestablish_free(this_ptr_conv);
11458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11459 LDKChannelReestablish orig_conv;
11460 orig_conv.inner = (void*)(orig & (~1));
11461 orig_conv.is_owned = false;
11462 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
11463 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11464 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11465 long ret_ref = (long)ret_var.inner;
11466 if (ret_var.is_owned) {
11472 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11473 LDKChannelReestablish this_ptr_conv;
11474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11475 this_ptr_conv.is_owned = false;
11476 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11477 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
11481 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11482 LDKChannelReestablish this_ptr_conv;
11483 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11484 this_ptr_conv.is_owned = false;
11485 LDKThirtyTwoBytes val_ref;
11486 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11487 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11488 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
11491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
11492 LDKChannelReestablish this_ptr_conv;
11493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11494 this_ptr_conv.is_owned = false;
11495 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
11499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11500 LDKChannelReestablish this_ptr_conv;
11501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11502 this_ptr_conv.is_owned = false;
11503 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
11506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
11507 LDKChannelReestablish this_ptr_conv;
11508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11509 this_ptr_conv.is_owned = false;
11510 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
11514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11515 LDKChannelReestablish this_ptr_conv;
11516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11517 this_ptr_conv.is_owned = false;
11518 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
11521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11522 LDKAnnouncementSignatures this_ptr_conv;
11523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11525 AnnouncementSignatures_free(this_ptr_conv);
11528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11529 LDKAnnouncementSignatures orig_conv;
11530 orig_conv.inner = (void*)(orig & (~1));
11531 orig_conv.is_owned = false;
11532 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
11533 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11534 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11535 long ret_ref = (long)ret_var.inner;
11536 if (ret_var.is_owned) {
11542 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11543 LDKAnnouncementSignatures this_ptr_conv;
11544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11545 this_ptr_conv.is_owned = false;
11546 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11547 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
11551 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11552 LDKAnnouncementSignatures this_ptr_conv;
11553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11554 this_ptr_conv.is_owned = false;
11555 LDKThirtyTwoBytes val_ref;
11556 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11557 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11558 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
11561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11562 LDKAnnouncementSignatures this_ptr_conv;
11563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11564 this_ptr_conv.is_owned = false;
11565 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
11569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11570 LDKAnnouncementSignatures this_ptr_conv;
11571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11572 this_ptr_conv.is_owned = false;
11573 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
11576 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
11577 LDKAnnouncementSignatures this_ptr_conv;
11578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11579 this_ptr_conv.is_owned = false;
11580 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11581 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
11585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11586 LDKAnnouncementSignatures this_ptr_conv;
11587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11588 this_ptr_conv.is_owned = false;
11589 LDKSignature val_ref;
11590 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11591 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11592 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
11595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
11596 LDKAnnouncementSignatures this_ptr_conv;
11597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11598 this_ptr_conv.is_owned = false;
11599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
11604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11605 LDKAnnouncementSignatures this_ptr_conv;
11606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11607 this_ptr_conv.is_owned = false;
11608 LDKSignature val_ref;
11609 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11610 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11611 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
11614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong short_channel_id_arg, jbyteArray node_signature_arg, jbyteArray bitcoin_signature_arg) {
11615 LDKThirtyTwoBytes channel_id_arg_ref;
11616 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
11617 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
11618 LDKSignature node_signature_arg_ref;
11619 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
11620 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
11621 LDKSignature bitcoin_signature_arg_ref;
11622 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
11623 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
11624 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
11625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11627 long ret_ref = (long)ret_var.inner;
11628 if (ret_var.is_owned) {
11634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11635 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
11636 FREE((void*)this_ptr);
11637 NetAddress_free(this_ptr_conv);
11640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11641 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
11642 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
11643 *ret_copy = NetAddress_clone(orig_conv);
11644 long ret_ref = (long)ret_copy;
11648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetAddress_1write(JNIEnv * _env, jclass _b, jlong obj) {
11649 LDKNetAddress* obj_conv = (LDKNetAddress*)obj;
11650 LDKCVec_u8Z arg_var = NetAddress_write(obj_conv);
11651 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11652 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11653 CVec_u8Z_free(arg_var);
11657 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Result_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11658 LDKu8slice ser_ref;
11659 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11660 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11661 LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
11662 *ret_conv = Result_read(ser_ref);
11663 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11664 return (long)ret_conv;
11667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11668 LDKUnsignedNodeAnnouncement this_ptr_conv;
11669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11670 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11671 UnsignedNodeAnnouncement_free(this_ptr_conv);
11674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11675 LDKUnsignedNodeAnnouncement orig_conv;
11676 orig_conv.inner = (void*)(orig & (~1));
11677 orig_conv.is_owned = false;
11678 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
11679 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11680 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11681 long ret_ref = (long)ret_var.inner;
11682 if (ret_var.is_owned) {
11688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11689 LDKUnsignedNodeAnnouncement this_ptr_conv;
11690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11691 this_ptr_conv.is_owned = false;
11692 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
11693 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11694 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11695 long ret_ref = (long)ret_var.inner;
11696 if (ret_var.is_owned) {
11702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11703 LDKUnsignedNodeAnnouncement this_ptr_conv;
11704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11705 this_ptr_conv.is_owned = false;
11706 LDKNodeFeatures val_conv;
11707 val_conv.inner = (void*)(val & (~1));
11708 val_conv.is_owned = (val & 1) || (val == 0);
11709 // Warning: we may need a move here but can't clone!
11710 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
11713 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
11714 LDKUnsignedNodeAnnouncement this_ptr_conv;
11715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11716 this_ptr_conv.is_owned = false;
11717 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
11721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11722 LDKUnsignedNodeAnnouncement this_ptr_conv;
11723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11724 this_ptr_conv.is_owned = false;
11725 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
11728 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11729 LDKUnsignedNodeAnnouncement this_ptr_conv;
11730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11731 this_ptr_conv.is_owned = false;
11732 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11733 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
11737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11738 LDKUnsignedNodeAnnouncement this_ptr_conv;
11739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11740 this_ptr_conv.is_owned = false;
11741 LDKPublicKey val_ref;
11742 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11743 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11744 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
11747 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
11748 LDKUnsignedNodeAnnouncement this_ptr_conv;
11749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11750 this_ptr_conv.is_owned = false;
11751 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
11752 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
11756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11757 LDKUnsignedNodeAnnouncement this_ptr_conv;
11758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11759 this_ptr_conv.is_owned = false;
11760 LDKThreeBytes val_ref;
11761 CHECK((*_env)->GetArrayLength (_env, val) == 3);
11762 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
11763 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
11766 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
11767 LDKUnsignedNodeAnnouncement this_ptr_conv;
11768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11769 this_ptr_conv.is_owned = false;
11770 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11771 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
11775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11776 LDKUnsignedNodeAnnouncement this_ptr_conv;
11777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11778 this_ptr_conv.is_owned = false;
11779 LDKThirtyTwoBytes val_ref;
11780 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11781 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11782 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
11785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11786 LDKUnsignedNodeAnnouncement this_ptr_conv;
11787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11788 this_ptr_conv.is_owned = false;
11789 LDKCVec_NetAddressZ val_constr;
11790 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11791 if (val_constr.datalen > 0)
11792 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
11794 val_constr.data = NULL;
11795 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11796 for (size_t m = 0; m < val_constr.datalen; m++) {
11797 long arr_conv_12 = val_vals[m];
11798 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
11799 FREE((void*)arr_conv_12);
11800 val_constr.data[m] = arr_conv_12_conv;
11802 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11803 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
11806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11807 LDKNodeAnnouncement this_ptr_conv;
11808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11809 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11810 NodeAnnouncement_free(this_ptr_conv);
11813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11814 LDKNodeAnnouncement orig_conv;
11815 orig_conv.inner = (void*)(orig & (~1));
11816 orig_conv.is_owned = false;
11817 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
11818 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11819 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11820 long ret_ref = (long)ret_var.inner;
11821 if (ret_var.is_owned) {
11827 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
11828 LDKNodeAnnouncement this_ptr_conv;
11829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11830 this_ptr_conv.is_owned = false;
11831 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11832 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
11836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11837 LDKNodeAnnouncement this_ptr_conv;
11838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11839 this_ptr_conv.is_owned = false;
11840 LDKSignature val_ref;
11841 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11842 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11843 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
11846 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
11847 LDKNodeAnnouncement this_ptr_conv;
11848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11849 this_ptr_conv.is_owned = false;
11850 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
11851 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11852 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11853 long ret_ref = (long)ret_var.inner;
11854 if (ret_var.is_owned) {
11860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11861 LDKNodeAnnouncement this_ptr_conv;
11862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11863 this_ptr_conv.is_owned = false;
11864 LDKUnsignedNodeAnnouncement val_conv;
11865 val_conv.inner = (void*)(val & (~1));
11866 val_conv.is_owned = (val & 1) || (val == 0);
11867 if (val_conv.inner != NULL)
11868 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
11869 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
11872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
11873 LDKSignature signature_arg_ref;
11874 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
11875 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
11876 LDKUnsignedNodeAnnouncement contents_arg_conv;
11877 contents_arg_conv.inner = (void*)(contents_arg & (~1));
11878 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
11879 if (contents_arg_conv.inner != NULL)
11880 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
11881 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
11882 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11883 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11884 long ret_ref = (long)ret_var.inner;
11885 if (ret_var.is_owned) {
11891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11892 LDKUnsignedChannelAnnouncement this_ptr_conv;
11893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11895 UnsignedChannelAnnouncement_free(this_ptr_conv);
11898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11899 LDKUnsignedChannelAnnouncement orig_conv;
11900 orig_conv.inner = (void*)(orig & (~1));
11901 orig_conv.is_owned = false;
11902 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
11903 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11904 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11905 long ret_ref = (long)ret_var.inner;
11906 if (ret_var.is_owned) {
11912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11913 LDKUnsignedChannelAnnouncement this_ptr_conv;
11914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11915 this_ptr_conv.is_owned = false;
11916 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
11917 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11918 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11919 long ret_ref = (long)ret_var.inner;
11920 if (ret_var.is_owned) {
11926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11927 LDKUnsignedChannelAnnouncement this_ptr_conv;
11928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11929 this_ptr_conv.is_owned = false;
11930 LDKChannelFeatures val_conv;
11931 val_conv.inner = (void*)(val & (~1));
11932 val_conv.is_owned = (val & 1) || (val == 0);
11933 // Warning: we may need a move here but can't clone!
11934 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
11937 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11938 LDKUnsignedChannelAnnouncement this_ptr_conv;
11939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11940 this_ptr_conv.is_owned = false;
11941 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11942 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
11946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11947 LDKUnsignedChannelAnnouncement this_ptr_conv;
11948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11949 this_ptr_conv.is_owned = false;
11950 LDKThirtyTwoBytes val_ref;
11951 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11952 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11953 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
11956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11957 LDKUnsignedChannelAnnouncement this_ptr_conv;
11958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11959 this_ptr_conv.is_owned = false;
11960 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
11964 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11965 LDKUnsignedChannelAnnouncement this_ptr_conv;
11966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11967 this_ptr_conv.is_owned = false;
11968 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
11971 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
11972 LDKUnsignedChannelAnnouncement this_ptr_conv;
11973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11974 this_ptr_conv.is_owned = false;
11975 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11976 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
11980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11981 LDKUnsignedChannelAnnouncement this_ptr_conv;
11982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11983 this_ptr_conv.is_owned = false;
11984 LDKPublicKey val_ref;
11985 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11986 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11987 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
11990 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
11991 LDKUnsignedChannelAnnouncement this_ptr_conv;
11992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11993 this_ptr_conv.is_owned = false;
11994 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11995 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
11999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12000 LDKUnsignedChannelAnnouncement this_ptr_conv;
12001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12002 this_ptr_conv.is_owned = false;
12003 LDKPublicKey val_ref;
12004 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12005 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12006 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
12009 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
12010 LDKUnsignedChannelAnnouncement this_ptr_conv;
12011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12012 this_ptr_conv.is_owned = false;
12013 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12014 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
12018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12019 LDKUnsignedChannelAnnouncement this_ptr_conv;
12020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12021 this_ptr_conv.is_owned = false;
12022 LDKPublicKey val_ref;
12023 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12024 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12025 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
12028 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
12029 LDKUnsignedChannelAnnouncement this_ptr_conv;
12030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12031 this_ptr_conv.is_owned = false;
12032 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12033 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
12037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12038 LDKUnsignedChannelAnnouncement this_ptr_conv;
12039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12040 this_ptr_conv.is_owned = false;
12041 LDKPublicKey val_ref;
12042 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12043 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12044 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
12047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12048 LDKChannelAnnouncement this_ptr_conv;
12049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12051 ChannelAnnouncement_free(this_ptr_conv);
12054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12055 LDKChannelAnnouncement orig_conv;
12056 orig_conv.inner = (void*)(orig & (~1));
12057 orig_conv.is_owned = false;
12058 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
12059 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12060 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12061 long ret_ref = (long)ret_var.inner;
12062 if (ret_var.is_owned) {
12068 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
12069 LDKChannelAnnouncement this_ptr_conv;
12070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12071 this_ptr_conv.is_owned = false;
12072 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12073 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
12077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12078 LDKChannelAnnouncement this_ptr_conv;
12079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12080 this_ptr_conv.is_owned = false;
12081 LDKSignature val_ref;
12082 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12083 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12084 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
12087 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
12088 LDKChannelAnnouncement this_ptr_conv;
12089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12090 this_ptr_conv.is_owned = false;
12091 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12092 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
12096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12097 LDKChannelAnnouncement this_ptr_conv;
12098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12099 this_ptr_conv.is_owned = false;
12100 LDKSignature val_ref;
12101 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12102 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12103 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
12106 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
12107 LDKChannelAnnouncement this_ptr_conv;
12108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12109 this_ptr_conv.is_owned = false;
12110 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12111 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
12115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12116 LDKChannelAnnouncement this_ptr_conv;
12117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12118 this_ptr_conv.is_owned = false;
12119 LDKSignature val_ref;
12120 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12121 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12122 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
12125 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
12126 LDKChannelAnnouncement this_ptr_conv;
12127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12128 this_ptr_conv.is_owned = false;
12129 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12130 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
12134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12135 LDKChannelAnnouncement this_ptr_conv;
12136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12137 this_ptr_conv.is_owned = false;
12138 LDKSignature val_ref;
12139 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12140 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12141 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
12144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
12145 LDKChannelAnnouncement this_ptr_conv;
12146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12147 this_ptr_conv.is_owned = false;
12148 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
12149 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12150 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12151 long ret_ref = (long)ret_var.inner;
12152 if (ret_var.is_owned) {
12158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12159 LDKChannelAnnouncement this_ptr_conv;
12160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12161 this_ptr_conv.is_owned = false;
12162 LDKUnsignedChannelAnnouncement val_conv;
12163 val_conv.inner = (void*)(val & (~1));
12164 val_conv.is_owned = (val & 1) || (val == 0);
12165 if (val_conv.inner != NULL)
12166 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
12167 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
12170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray node_signature_1_arg, jbyteArray node_signature_2_arg, jbyteArray bitcoin_signature_1_arg, jbyteArray bitcoin_signature_2_arg, jlong contents_arg) {
12171 LDKSignature node_signature_1_arg_ref;
12172 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
12173 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
12174 LDKSignature node_signature_2_arg_ref;
12175 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
12176 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
12177 LDKSignature bitcoin_signature_1_arg_ref;
12178 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
12179 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
12180 LDKSignature bitcoin_signature_2_arg_ref;
12181 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
12182 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
12183 LDKUnsignedChannelAnnouncement contents_arg_conv;
12184 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12185 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12186 if (contents_arg_conv.inner != NULL)
12187 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
12188 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);
12189 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12190 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12191 long ret_ref = (long)ret_var.inner;
12192 if (ret_var.is_owned) {
12198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12199 LDKUnsignedChannelUpdate this_ptr_conv;
12200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12202 UnsignedChannelUpdate_free(this_ptr_conv);
12205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12206 LDKUnsignedChannelUpdate orig_conv;
12207 orig_conv.inner = (void*)(orig & (~1));
12208 orig_conv.is_owned = false;
12209 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
12210 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12211 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12212 long ret_ref = (long)ret_var.inner;
12213 if (ret_var.is_owned) {
12219 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12220 LDKUnsignedChannelUpdate this_ptr_conv;
12221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12222 this_ptr_conv.is_owned = false;
12223 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12224 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
12228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12229 LDKUnsignedChannelUpdate this_ptr_conv;
12230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12231 this_ptr_conv.is_owned = false;
12232 LDKThirtyTwoBytes val_ref;
12233 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12234 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12235 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
12238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12239 LDKUnsignedChannelUpdate this_ptr_conv;
12240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12241 this_ptr_conv.is_owned = false;
12242 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
12246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12247 LDKUnsignedChannelUpdate this_ptr_conv;
12248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12249 this_ptr_conv.is_owned = false;
12250 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
12253 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
12254 LDKUnsignedChannelUpdate this_ptr_conv;
12255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12256 this_ptr_conv.is_owned = false;
12257 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
12261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12262 LDKUnsignedChannelUpdate this_ptr_conv;
12263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12264 this_ptr_conv.is_owned = false;
12265 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
12268 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
12269 LDKUnsignedChannelUpdate this_ptr_conv;
12270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12271 this_ptr_conv.is_owned = false;
12272 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
12276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
12277 LDKUnsignedChannelUpdate this_ptr_conv;
12278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12279 this_ptr_conv.is_owned = false;
12280 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
12283 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12284 LDKUnsignedChannelUpdate this_ptr_conv;
12285 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12286 this_ptr_conv.is_owned = false;
12287 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
12291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12292 LDKUnsignedChannelUpdate this_ptr_conv;
12293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12294 this_ptr_conv.is_owned = false;
12295 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
12298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12299 LDKUnsignedChannelUpdate this_ptr_conv;
12300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12301 this_ptr_conv.is_owned = false;
12302 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
12306 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12307 LDKUnsignedChannelUpdate this_ptr_conv;
12308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12309 this_ptr_conv.is_owned = false;
12310 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
12313 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12314 LDKUnsignedChannelUpdate this_ptr_conv;
12315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12316 this_ptr_conv.is_owned = false;
12317 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
12321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12322 LDKUnsignedChannelUpdate this_ptr_conv;
12323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12324 this_ptr_conv.is_owned = false;
12325 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
12328 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
12329 LDKUnsignedChannelUpdate this_ptr_conv;
12330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12331 this_ptr_conv.is_owned = false;
12332 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
12336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12337 LDKUnsignedChannelUpdate this_ptr_conv;
12338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12339 this_ptr_conv.is_owned = false;
12340 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
12343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12344 LDKChannelUpdate this_ptr_conv;
12345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12347 ChannelUpdate_free(this_ptr_conv);
12350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12351 LDKChannelUpdate orig_conv;
12352 orig_conv.inner = (void*)(orig & (~1));
12353 orig_conv.is_owned = false;
12354 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
12355 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12356 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12357 long ret_ref = (long)ret_var.inner;
12358 if (ret_var.is_owned) {
12364 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
12365 LDKChannelUpdate this_ptr_conv;
12366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12367 this_ptr_conv.is_owned = false;
12368 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
12369 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
12373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12374 LDKChannelUpdate this_ptr_conv;
12375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12376 this_ptr_conv.is_owned = false;
12377 LDKSignature val_ref;
12378 CHECK((*_env)->GetArrayLength (_env, val) == 64);
12379 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
12380 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
12383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
12384 LDKChannelUpdate this_ptr_conv;
12385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12386 this_ptr_conv.is_owned = false;
12387 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
12388 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12389 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12390 long ret_ref = (long)ret_var.inner;
12391 if (ret_var.is_owned) {
12397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12398 LDKChannelUpdate this_ptr_conv;
12399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12400 this_ptr_conv.is_owned = false;
12401 LDKUnsignedChannelUpdate val_conv;
12402 val_conv.inner = (void*)(val & (~1));
12403 val_conv.is_owned = (val & 1) || (val == 0);
12404 if (val_conv.inner != NULL)
12405 val_conv = UnsignedChannelUpdate_clone(&val_conv);
12406 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
12409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
12410 LDKSignature signature_arg_ref;
12411 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
12412 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
12413 LDKUnsignedChannelUpdate contents_arg_conv;
12414 contents_arg_conv.inner = (void*)(contents_arg & (~1));
12415 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
12416 if (contents_arg_conv.inner != NULL)
12417 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
12418 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
12419 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12420 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12421 long ret_ref = (long)ret_var.inner;
12422 if (ret_var.is_owned) {
12428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12429 LDKQueryChannelRange this_ptr_conv;
12430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12432 QueryChannelRange_free(this_ptr_conv);
12435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12436 LDKQueryChannelRange orig_conv;
12437 orig_conv.inner = (void*)(orig & (~1));
12438 orig_conv.is_owned = false;
12439 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
12440 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12441 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12442 long ret_ref = (long)ret_var.inner;
12443 if (ret_var.is_owned) {
12449 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12450 LDKQueryChannelRange this_ptr_conv;
12451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12452 this_ptr_conv.is_owned = false;
12453 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12454 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
12458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12459 LDKQueryChannelRange this_ptr_conv;
12460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12461 this_ptr_conv.is_owned = false;
12462 LDKThirtyTwoBytes val_ref;
12463 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12464 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12465 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12468 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
12469 LDKQueryChannelRange this_ptr_conv;
12470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12471 this_ptr_conv.is_owned = false;
12472 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
12476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12477 LDKQueryChannelRange this_ptr_conv;
12478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12479 this_ptr_conv.is_owned = false;
12480 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
12483 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
12484 LDKQueryChannelRange this_ptr_conv;
12485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12486 this_ptr_conv.is_owned = false;
12487 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
12491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12492 LDKQueryChannelRange this_ptr_conv;
12493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12494 this_ptr_conv.is_owned = false;
12495 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg) {
12499 LDKThirtyTwoBytes chain_hash_arg_ref;
12500 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
12501 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12502 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
12503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12505 long ret_ref = (long)ret_var.inner;
12506 if (ret_var.is_owned) {
12512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12513 LDKReplyChannelRange this_ptr_conv;
12514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12516 ReplyChannelRange_free(this_ptr_conv);
12519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12520 LDKReplyChannelRange orig_conv;
12521 orig_conv.inner = (void*)(orig & (~1));
12522 orig_conv.is_owned = false;
12523 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
12524 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12525 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12526 long ret_ref = (long)ret_var.inner;
12527 if (ret_var.is_owned) {
12533 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12534 LDKReplyChannelRange this_ptr_conv;
12535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12536 this_ptr_conv.is_owned = false;
12537 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12538 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
12542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12543 LDKReplyChannelRange this_ptr_conv;
12544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12545 this_ptr_conv.is_owned = false;
12546 LDKThirtyTwoBytes val_ref;
12547 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12548 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12549 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
12552 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
12553 LDKReplyChannelRange this_ptr_conv;
12554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12555 this_ptr_conv.is_owned = false;
12556 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
12560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12561 LDKReplyChannelRange this_ptr_conv;
12562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12563 this_ptr_conv.is_owned = false;
12564 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
12567 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
12568 LDKReplyChannelRange this_ptr_conv;
12569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12570 this_ptr_conv.is_owned = false;
12571 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
12575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12576 LDKReplyChannelRange this_ptr_conv;
12577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12578 this_ptr_conv.is_owned = false;
12579 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
12582 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
12583 LDKReplyChannelRange this_ptr_conv;
12584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12585 this_ptr_conv.is_owned = false;
12586 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
12590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12591 LDKReplyChannelRange this_ptr_conv;
12592 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12593 this_ptr_conv.is_owned = false;
12594 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
12597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12598 LDKReplyChannelRange this_ptr_conv;
12599 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12600 this_ptr_conv.is_owned = false;
12601 LDKCVec_u64Z val_constr;
12602 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12603 if (val_constr.datalen > 0)
12604 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
12606 val_constr.data = NULL;
12607 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12608 for (size_t g = 0; g < val_constr.datalen; g++) {
12609 long arr_conv_6 = val_vals[g];
12610 val_constr.data[g] = arr_conv_6;
12612 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12613 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
12616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_blocknum_arg, jint number_of_blocks_arg, jboolean full_information_arg, jlongArray short_channel_ids_arg) {
12617 LDKThirtyTwoBytes chain_hash_arg_ref;
12618 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
12619 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12620 LDKCVec_u64Z short_channel_ids_arg_constr;
12621 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
12622 if (short_channel_ids_arg_constr.datalen > 0)
12623 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
12625 short_channel_ids_arg_constr.data = NULL;
12626 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
12627 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12628 long arr_conv_6 = short_channel_ids_arg_vals[g];
12629 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12631 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12632 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
12633 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12634 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12635 long ret_ref = (long)ret_var.inner;
12636 if (ret_var.is_owned) {
12642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12643 LDKQueryShortChannelIds this_ptr_conv;
12644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12646 QueryShortChannelIds_free(this_ptr_conv);
12649 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12650 LDKQueryShortChannelIds orig_conv;
12651 orig_conv.inner = (void*)(orig & (~1));
12652 orig_conv.is_owned = false;
12653 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
12654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12656 long ret_ref = (long)ret_var.inner;
12657 if (ret_var.is_owned) {
12663 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12664 LDKQueryShortChannelIds this_ptr_conv;
12665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12666 this_ptr_conv.is_owned = false;
12667 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12668 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
12672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12673 LDKQueryShortChannelIds this_ptr_conv;
12674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12675 this_ptr_conv.is_owned = false;
12676 LDKThirtyTwoBytes val_ref;
12677 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12678 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12679 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
12682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12683 LDKQueryShortChannelIds this_ptr_conv;
12684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12685 this_ptr_conv.is_owned = false;
12686 LDKCVec_u64Z val_constr;
12687 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12688 if (val_constr.datalen > 0)
12689 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
12691 val_constr.data = NULL;
12692 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12693 for (size_t g = 0; g < val_constr.datalen; g++) {
12694 long arr_conv_6 = val_vals[g];
12695 val_constr.data[g] = arr_conv_6;
12697 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12698 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
12701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
12702 LDKThirtyTwoBytes chain_hash_arg_ref;
12703 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
12704 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12705 LDKCVec_u64Z short_channel_ids_arg_constr;
12706 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
12707 if (short_channel_ids_arg_constr.datalen > 0)
12708 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
12710 short_channel_ids_arg_constr.data = NULL;
12711 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
12712 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
12713 long arr_conv_6 = short_channel_ids_arg_vals[g];
12714 short_channel_ids_arg_constr.data[g] = arr_conv_6;
12716 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
12717 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
12718 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12719 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12720 long ret_ref = (long)ret_var.inner;
12721 if (ret_var.is_owned) {
12727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12728 LDKReplyShortChannelIdsEnd this_ptr_conv;
12729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12731 ReplyShortChannelIdsEnd_free(this_ptr_conv);
12734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12735 LDKReplyShortChannelIdsEnd orig_conv;
12736 orig_conv.inner = (void*)(orig & (~1));
12737 orig_conv.is_owned = false;
12738 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
12739 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12740 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12741 long ret_ref = (long)ret_var.inner;
12742 if (ret_var.is_owned) {
12748 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12749 LDKReplyShortChannelIdsEnd this_ptr_conv;
12750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12751 this_ptr_conv.is_owned = false;
12752 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12753 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
12757 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12758 LDKReplyShortChannelIdsEnd this_ptr_conv;
12759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12760 this_ptr_conv.is_owned = false;
12761 LDKThirtyTwoBytes val_ref;
12762 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12763 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12764 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
12767 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
12768 LDKReplyShortChannelIdsEnd this_ptr_conv;
12769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12770 this_ptr_conv.is_owned = false;
12771 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
12775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12776 LDKReplyShortChannelIdsEnd this_ptr_conv;
12777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12778 this_ptr_conv.is_owned = false;
12779 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
12782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
12783 LDKThirtyTwoBytes chain_hash_arg_ref;
12784 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
12785 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12786 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
12787 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12788 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12789 long ret_ref = (long)ret_var.inner;
12790 if (ret_var.is_owned) {
12796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12797 LDKGossipTimestampFilter this_ptr_conv;
12798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12800 GossipTimestampFilter_free(this_ptr_conv);
12803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12804 LDKGossipTimestampFilter orig_conv;
12805 orig_conv.inner = (void*)(orig & (~1));
12806 orig_conv.is_owned = false;
12807 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
12808 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12809 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12810 long ret_ref = (long)ret_var.inner;
12811 if (ret_var.is_owned) {
12817 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12818 LDKGossipTimestampFilter this_ptr_conv;
12819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12820 this_ptr_conv.is_owned = false;
12821 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12822 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
12826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12827 LDKGossipTimestampFilter this_ptr_conv;
12828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12829 this_ptr_conv.is_owned = false;
12830 LDKThirtyTwoBytes val_ref;
12831 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12832 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12833 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
12836 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
12837 LDKGossipTimestampFilter this_ptr_conv;
12838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12839 this_ptr_conv.is_owned = false;
12840 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
12844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12845 LDKGossipTimestampFilter this_ptr_conv;
12846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12847 this_ptr_conv.is_owned = false;
12848 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
12851 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
12852 LDKGossipTimestampFilter this_ptr_conv;
12853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12854 this_ptr_conv.is_owned = false;
12855 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
12859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12860 LDKGossipTimestampFilter this_ptr_conv;
12861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12862 this_ptr_conv.is_owned = false;
12863 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
12866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jint first_timestamp_arg, jint timestamp_range_arg) {
12867 LDKThirtyTwoBytes chain_hash_arg_ref;
12868 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
12869 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
12870 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
12871 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12872 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12873 long ret_ref = (long)ret_var.inner;
12874 if (ret_var.is_owned) {
12880 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12881 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
12882 FREE((void*)this_ptr);
12883 ErrorAction_free(this_ptr_conv);
12886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12887 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
12888 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12889 *ret_copy = ErrorAction_clone(orig_conv);
12890 long ret_ref = (long)ret_copy;
12894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12895 LDKLightningError this_ptr_conv;
12896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12898 LightningError_free(this_ptr_conv);
12901 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
12902 LDKLightningError this_ptr_conv;
12903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12904 this_ptr_conv.is_owned = false;
12905 LDKStr _str = LightningError_get_err(&this_ptr_conv);
12906 char* _buf = MALLOC(_str.len + 1, "str conv buf");
12907 memcpy(_buf, _str.chars, _str.len);
12908 _buf[_str.len] = 0;
12909 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
12914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12915 LDKLightningError this_ptr_conv;
12916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12917 this_ptr_conv.is_owned = false;
12918 LDKCVec_u8Z val_ref;
12919 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
12920 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
12921 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
12922 LightningError_set_err(&this_ptr_conv, val_ref);
12925 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
12926 LDKLightningError this_ptr_conv;
12927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12928 this_ptr_conv.is_owned = false;
12929 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
12930 *ret_copy = LightningError_get_action(&this_ptr_conv);
12931 long ret_ref = (long)ret_copy;
12935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12936 LDKLightningError this_ptr_conv;
12937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12938 this_ptr_conv.is_owned = false;
12939 LDKErrorAction val_conv = *(LDKErrorAction*)val;
12941 LightningError_set_action(&this_ptr_conv, val_conv);
12944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
12945 LDKCVec_u8Z err_arg_ref;
12946 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
12947 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
12948 (*_env)->GetByteArrayRegion(_env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
12949 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
12950 FREE((void*)action_arg);
12951 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
12952 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12953 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12954 long ret_ref = (long)ret_var.inner;
12955 if (ret_var.is_owned) {
12961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12962 LDKCommitmentUpdate this_ptr_conv;
12963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12965 CommitmentUpdate_free(this_ptr_conv);
12968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12969 LDKCommitmentUpdate orig_conv;
12970 orig_conv.inner = (void*)(orig & (~1));
12971 orig_conv.is_owned = false;
12972 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
12973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12975 long ret_ref = (long)ret_var.inner;
12976 if (ret_var.is_owned) {
12982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12983 LDKCommitmentUpdate this_ptr_conv;
12984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12985 this_ptr_conv.is_owned = false;
12986 LDKCVec_UpdateAddHTLCZ val_constr;
12987 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12988 if (val_constr.datalen > 0)
12989 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
12991 val_constr.data = NULL;
12992 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12993 for (size_t p = 0; p < val_constr.datalen; p++) {
12994 long arr_conv_15 = val_vals[p];
12995 LDKUpdateAddHTLC arr_conv_15_conv;
12996 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
12997 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
12998 val_constr.data[p] = arr_conv_15_conv;
13000 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13001 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
13004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13005 LDKCommitmentUpdate this_ptr_conv;
13006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13007 this_ptr_conv.is_owned = false;
13008 LDKCVec_UpdateFulfillHTLCZ val_constr;
13009 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13010 if (val_constr.datalen > 0)
13011 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13013 val_constr.data = NULL;
13014 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13015 for (size_t t = 0; t < val_constr.datalen; t++) {
13016 long arr_conv_19 = val_vals[t];
13017 LDKUpdateFulfillHTLC arr_conv_19_conv;
13018 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13019 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13020 val_constr.data[t] = arr_conv_19_conv;
13022 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13023 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
13026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13027 LDKCommitmentUpdate this_ptr_conv;
13028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13029 this_ptr_conv.is_owned = false;
13030 LDKCVec_UpdateFailHTLCZ val_constr;
13031 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13032 if (val_constr.datalen > 0)
13033 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13035 val_constr.data = NULL;
13036 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13037 for (size_t q = 0; q < val_constr.datalen; q++) {
13038 long arr_conv_16 = val_vals[q];
13039 LDKUpdateFailHTLC arr_conv_16_conv;
13040 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13041 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13042 val_constr.data[q] = arr_conv_16_conv;
13044 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13045 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
13048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13049 LDKCommitmentUpdate this_ptr_conv;
13050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13051 this_ptr_conv.is_owned = false;
13052 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
13053 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13054 if (val_constr.datalen > 0)
13055 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13057 val_constr.data = NULL;
13058 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13059 for (size_t z = 0; z < val_constr.datalen; z++) {
13060 long arr_conv_25 = val_vals[z];
13061 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13062 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13063 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13064 val_constr.data[z] = arr_conv_25_conv;
13066 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13067 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
13070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
13071 LDKCommitmentUpdate this_ptr_conv;
13072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13073 this_ptr_conv.is_owned = false;
13074 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
13075 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13076 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13077 long ret_ref = (long)ret_var.inner;
13078 if (ret_var.is_owned) {
13084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13085 LDKCommitmentUpdate this_ptr_conv;
13086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13087 this_ptr_conv.is_owned = false;
13088 LDKUpdateFee val_conv;
13089 val_conv.inner = (void*)(val & (~1));
13090 val_conv.is_owned = (val & 1) || (val == 0);
13091 if (val_conv.inner != NULL)
13092 val_conv = UpdateFee_clone(&val_conv);
13093 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
13096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
13097 LDKCommitmentUpdate this_ptr_conv;
13098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13099 this_ptr_conv.is_owned = false;
13100 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
13101 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13102 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13103 long ret_ref = (long)ret_var.inner;
13104 if (ret_var.is_owned) {
13110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13111 LDKCommitmentUpdate this_ptr_conv;
13112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13113 this_ptr_conv.is_owned = false;
13114 LDKCommitmentSigned val_conv;
13115 val_conv.inner = (void*)(val & (~1));
13116 val_conv.is_owned = (val & 1) || (val == 0);
13117 if (val_conv.inner != NULL)
13118 val_conv = CommitmentSigned_clone(&val_conv);
13119 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
13122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv * _env, jclass _b, jlongArray update_add_htlcs_arg, jlongArray update_fulfill_htlcs_arg, jlongArray update_fail_htlcs_arg, jlongArray update_fail_malformed_htlcs_arg, jlong update_fee_arg, jlong commitment_signed_arg) {
13123 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
13124 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
13125 if (update_add_htlcs_arg_constr.datalen > 0)
13126 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
13128 update_add_htlcs_arg_constr.data = NULL;
13129 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
13130 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
13131 long arr_conv_15 = update_add_htlcs_arg_vals[p];
13132 LDKUpdateAddHTLC arr_conv_15_conv;
13133 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
13134 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
13135 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
13137 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
13138 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
13139 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
13140 if (update_fulfill_htlcs_arg_constr.datalen > 0)
13141 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
13143 update_fulfill_htlcs_arg_constr.data = NULL;
13144 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
13145 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
13146 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
13147 LDKUpdateFulfillHTLC arr_conv_19_conv;
13148 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
13149 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
13150 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
13152 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
13153 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
13154 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
13155 if (update_fail_htlcs_arg_constr.datalen > 0)
13156 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
13158 update_fail_htlcs_arg_constr.data = NULL;
13159 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
13160 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
13161 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
13162 LDKUpdateFailHTLC arr_conv_16_conv;
13163 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13164 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13165 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
13167 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
13168 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
13169 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
13170 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
13171 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
13173 update_fail_malformed_htlcs_arg_constr.data = NULL;
13174 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
13175 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
13176 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
13177 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
13178 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
13179 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
13180 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
13182 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
13183 LDKUpdateFee update_fee_arg_conv;
13184 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
13185 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
13186 if (update_fee_arg_conv.inner != NULL)
13187 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
13188 LDKCommitmentSigned commitment_signed_arg_conv;
13189 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
13190 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
13191 if (commitment_signed_arg_conv.inner != NULL)
13192 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
13193 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);
13194 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13195 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13196 long ret_ref = (long)ret_var.inner;
13197 if (ret_var.is_owned) {
13203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13204 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
13205 FREE((void*)this_ptr);
13206 HTLCFailChannelUpdate_free(this_ptr_conv);
13209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13210 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
13211 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
13212 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
13213 long ret_ref = (long)ret_copy;
13217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13218 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
13219 FREE((void*)this_ptr);
13220 ChannelMessageHandler_free(this_ptr_conv);
13223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13224 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
13225 FREE((void*)this_ptr);
13226 RoutingMessageHandler_free(this_ptr_conv);
13229 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
13230 LDKAcceptChannel obj_conv;
13231 obj_conv.inner = (void*)(obj & (~1));
13232 obj_conv.is_owned = false;
13233 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
13234 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13235 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13236 CVec_u8Z_free(arg_var);
13240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13241 LDKu8slice ser_ref;
13242 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13243 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13244 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
13245 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13246 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13247 long ret_ref = (long)ret_var.inner;
13248 if (ret_var.is_owned) {
13251 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13255 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
13256 LDKAnnouncementSignatures obj_conv;
13257 obj_conv.inner = (void*)(obj & (~1));
13258 obj_conv.is_owned = false;
13259 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
13260 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13261 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13262 CVec_u8Z_free(arg_var);
13266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13267 LDKu8slice ser_ref;
13268 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13269 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13270 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
13271 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13272 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13273 long ret_ref = (long)ret_var.inner;
13274 if (ret_var.is_owned) {
13277 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13281 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
13282 LDKChannelReestablish obj_conv;
13283 obj_conv.inner = (void*)(obj & (~1));
13284 obj_conv.is_owned = false;
13285 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
13286 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13287 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13288 CVec_u8Z_free(arg_var);
13292 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13293 LDKu8slice ser_ref;
13294 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13295 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13296 LDKCResult_ChannelReestablishDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelReestablishDecodeErrorZ), "LDKCResult_ChannelReestablishDecodeErrorZ");
13297 *ret_conv = ChannelReestablish_read(ser_ref);
13298 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13299 return (long)ret_conv;
13302 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
13303 LDKClosingSigned obj_conv;
13304 obj_conv.inner = (void*)(obj & (~1));
13305 obj_conv.is_owned = false;
13306 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
13307 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13308 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13309 CVec_u8Z_free(arg_var);
13313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13314 LDKu8slice ser_ref;
13315 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13316 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13317 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
13318 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13319 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13320 long ret_ref = (long)ret_var.inner;
13321 if (ret_var.is_owned) {
13324 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13328 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
13329 LDKCommitmentSigned obj_conv;
13330 obj_conv.inner = (void*)(obj & (~1));
13331 obj_conv.is_owned = false;
13332 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
13333 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13334 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13335 CVec_u8Z_free(arg_var);
13339 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13340 LDKu8slice ser_ref;
13341 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13342 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13343 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
13344 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13345 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13346 long ret_ref = (long)ret_var.inner;
13347 if (ret_var.is_owned) {
13350 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13354 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
13355 LDKFundingCreated obj_conv;
13356 obj_conv.inner = (void*)(obj & (~1));
13357 obj_conv.is_owned = false;
13358 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
13359 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13360 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13361 CVec_u8Z_free(arg_var);
13365 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13366 LDKu8slice ser_ref;
13367 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13368 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13369 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
13370 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13371 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13372 long ret_ref = (long)ret_var.inner;
13373 if (ret_var.is_owned) {
13376 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13380 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
13381 LDKFundingSigned obj_conv;
13382 obj_conv.inner = (void*)(obj & (~1));
13383 obj_conv.is_owned = false;
13384 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
13385 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13386 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13387 CVec_u8Z_free(arg_var);
13391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13392 LDKu8slice ser_ref;
13393 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13394 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13395 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
13396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13398 long ret_ref = (long)ret_var.inner;
13399 if (ret_var.is_owned) {
13402 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13406 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
13407 LDKFundingLocked obj_conv;
13408 obj_conv.inner = (void*)(obj & (~1));
13409 obj_conv.is_owned = false;
13410 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
13411 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13412 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13413 CVec_u8Z_free(arg_var);
13417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13418 LDKu8slice ser_ref;
13419 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13420 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13421 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
13422 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13423 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13424 long ret_ref = (long)ret_var.inner;
13425 if (ret_var.is_owned) {
13428 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13432 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
13434 obj_conv.inner = (void*)(obj & (~1));
13435 obj_conv.is_owned = false;
13436 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
13437 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13438 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13439 CVec_u8Z_free(arg_var);
13443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13444 LDKu8slice ser_ref;
13445 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13446 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13447 LDKCResult_InitDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitDecodeErrorZ), "LDKCResult_InitDecodeErrorZ");
13448 *ret_conv = Init_read(ser_ref);
13449 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13450 return (long)ret_conv;
13453 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
13454 LDKOpenChannel obj_conv;
13455 obj_conv.inner = (void*)(obj & (~1));
13456 obj_conv.is_owned = false;
13457 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
13458 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13459 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13460 CVec_u8Z_free(arg_var);
13464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13465 LDKu8slice ser_ref;
13466 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13467 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13468 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
13469 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13470 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13471 long ret_ref = (long)ret_var.inner;
13472 if (ret_var.is_owned) {
13475 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13479 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
13480 LDKRevokeAndACK obj_conv;
13481 obj_conv.inner = (void*)(obj & (~1));
13482 obj_conv.is_owned = false;
13483 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
13484 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13485 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13486 CVec_u8Z_free(arg_var);
13490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13491 LDKu8slice ser_ref;
13492 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13493 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13494 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
13495 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13496 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13497 long ret_ref = (long)ret_var.inner;
13498 if (ret_var.is_owned) {
13501 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13505 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
13506 LDKShutdown obj_conv;
13507 obj_conv.inner = (void*)(obj & (~1));
13508 obj_conv.is_owned = false;
13509 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
13510 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13511 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13512 CVec_u8Z_free(arg_var);
13516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13517 LDKu8slice ser_ref;
13518 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13519 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13520 LDKShutdown ret_var = Shutdown_read(ser_ref);
13521 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13522 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13523 long ret_ref = (long)ret_var.inner;
13524 if (ret_var.is_owned) {
13527 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13531 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
13532 LDKUpdateFailHTLC obj_conv;
13533 obj_conv.inner = (void*)(obj & (~1));
13534 obj_conv.is_owned = false;
13535 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
13536 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13537 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13538 CVec_u8Z_free(arg_var);
13542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13543 LDKu8slice ser_ref;
13544 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13545 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13546 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
13547 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13548 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13549 long ret_ref = (long)ret_var.inner;
13550 if (ret_var.is_owned) {
13553 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13557 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
13558 LDKUpdateFailMalformedHTLC obj_conv;
13559 obj_conv.inner = (void*)(obj & (~1));
13560 obj_conv.is_owned = false;
13561 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
13562 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13563 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13564 CVec_u8Z_free(arg_var);
13568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13569 LDKu8slice ser_ref;
13570 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13571 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13572 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
13573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13575 long ret_ref = (long)ret_var.inner;
13576 if (ret_var.is_owned) {
13579 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13583 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
13584 LDKUpdateFee obj_conv;
13585 obj_conv.inner = (void*)(obj & (~1));
13586 obj_conv.is_owned = false;
13587 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
13588 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13589 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13590 CVec_u8Z_free(arg_var);
13594 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13595 LDKu8slice ser_ref;
13596 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13597 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13598 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
13599 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13600 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13601 long ret_ref = (long)ret_var.inner;
13602 if (ret_var.is_owned) {
13605 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13609 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
13610 LDKUpdateFulfillHTLC obj_conv;
13611 obj_conv.inner = (void*)(obj & (~1));
13612 obj_conv.is_owned = false;
13613 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
13614 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13615 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13616 CVec_u8Z_free(arg_var);
13620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13621 LDKu8slice ser_ref;
13622 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13623 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13624 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
13625 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13626 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13627 long ret_ref = (long)ret_var.inner;
13628 if (ret_var.is_owned) {
13631 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13635 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
13636 LDKUpdateAddHTLC obj_conv;
13637 obj_conv.inner = (void*)(obj & (~1));
13638 obj_conv.is_owned = false;
13639 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
13640 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13641 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13642 CVec_u8Z_free(arg_var);
13646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13647 LDKu8slice ser_ref;
13648 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13649 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13650 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
13651 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13652 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13653 long ret_ref = (long)ret_var.inner;
13654 if (ret_var.is_owned) {
13657 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13661 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
13663 obj_conv.inner = (void*)(obj & (~1));
13664 obj_conv.is_owned = false;
13665 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
13666 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13667 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13668 CVec_u8Z_free(arg_var);
13672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13673 LDKu8slice ser_ref;
13674 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13675 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13676 LDKCResult_PingDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PingDecodeErrorZ), "LDKCResult_PingDecodeErrorZ");
13677 *ret_conv = Ping_read(ser_ref);
13678 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13679 return (long)ret_conv;
13682 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
13684 obj_conv.inner = (void*)(obj & (~1));
13685 obj_conv.is_owned = false;
13686 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
13687 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13688 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13689 CVec_u8Z_free(arg_var);
13693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13694 LDKu8slice ser_ref;
13695 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13696 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13697 LDKCResult_PongDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PongDecodeErrorZ), "LDKCResult_PongDecodeErrorZ");
13698 *ret_conv = Pong_read(ser_ref);
13699 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13700 return (long)ret_conv;
13703 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
13704 LDKUnsignedChannelAnnouncement obj_conv;
13705 obj_conv.inner = (void*)(obj & (~1));
13706 obj_conv.is_owned = false;
13707 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
13708 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13709 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13710 CVec_u8Z_free(arg_var);
13714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13715 LDKu8slice ser_ref;
13716 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13717 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13718 LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ), "LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ");
13719 *ret_conv = UnsignedChannelAnnouncement_read(ser_ref);
13720 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13721 return (long)ret_conv;
13724 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
13725 LDKChannelAnnouncement obj_conv;
13726 obj_conv.inner = (void*)(obj & (~1));
13727 obj_conv.is_owned = false;
13728 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
13729 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13730 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13731 CVec_u8Z_free(arg_var);
13735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13736 LDKu8slice ser_ref;
13737 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13738 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13739 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
13740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13742 long ret_ref = (long)ret_var.inner;
13743 if (ret_var.is_owned) {
13746 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13750 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
13751 LDKUnsignedChannelUpdate obj_conv;
13752 obj_conv.inner = (void*)(obj & (~1));
13753 obj_conv.is_owned = false;
13754 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
13755 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13756 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13757 CVec_u8Z_free(arg_var);
13761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13762 LDKu8slice ser_ref;
13763 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13764 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13765 LDKCResult_UnsignedChannelUpdateDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ), "LDKCResult_UnsignedChannelUpdateDecodeErrorZ");
13766 *ret_conv = UnsignedChannelUpdate_read(ser_ref);
13767 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13768 return (long)ret_conv;
13771 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
13772 LDKChannelUpdate obj_conv;
13773 obj_conv.inner = (void*)(obj & (~1));
13774 obj_conv.is_owned = false;
13775 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
13776 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13777 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13778 CVec_u8Z_free(arg_var);
13782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13783 LDKu8slice ser_ref;
13784 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13785 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13786 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
13787 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13788 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13789 long ret_ref = (long)ret_var.inner;
13790 if (ret_var.is_owned) {
13793 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13797 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
13798 LDKErrorMessage obj_conv;
13799 obj_conv.inner = (void*)(obj & (~1));
13800 obj_conv.is_owned = false;
13801 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
13802 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13803 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13804 CVec_u8Z_free(arg_var);
13808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13809 LDKu8slice ser_ref;
13810 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13811 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13812 LDKCResult_ErrorMessageDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ErrorMessageDecodeErrorZ), "LDKCResult_ErrorMessageDecodeErrorZ");
13813 *ret_conv = ErrorMessage_read(ser_ref);
13814 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13815 return (long)ret_conv;
13818 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
13819 LDKUnsignedNodeAnnouncement obj_conv;
13820 obj_conv.inner = (void*)(obj & (~1));
13821 obj_conv.is_owned = false;
13822 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
13823 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13824 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13825 CVec_u8Z_free(arg_var);
13829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13830 LDKu8slice ser_ref;
13831 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13832 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13833 LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ), "LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ");
13834 *ret_conv = UnsignedNodeAnnouncement_read(ser_ref);
13835 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13836 return (long)ret_conv;
13839 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
13840 LDKNodeAnnouncement obj_conv;
13841 obj_conv.inner = (void*)(obj & (~1));
13842 obj_conv.is_owned = false;
13843 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
13844 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13845 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13846 CVec_u8Z_free(arg_var);
13850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13851 LDKu8slice ser_ref;
13852 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13853 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13854 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
13855 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13856 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13857 long ret_ref = (long)ret_var.inner;
13858 if (ret_var.is_owned) {
13861 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13865 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13866 LDKu8slice ser_ref;
13867 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13868 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13869 LDKCResult_QueryShortChannelIdsDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ), "LDKCResult_QueryShortChannelIdsDecodeErrorZ");
13870 *ret_conv = QueryShortChannelIds_read(ser_ref);
13871 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13872 return (long)ret_conv;
13875 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
13876 LDKQueryShortChannelIds obj_conv;
13877 obj_conv.inner = (void*)(obj & (~1));
13878 obj_conv.is_owned = false;
13879 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
13880 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13881 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13882 CVec_u8Z_free(arg_var);
13886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13887 LDKu8slice ser_ref;
13888 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13889 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13890 LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
13891 *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
13892 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13893 return (long)ret_conv;
13896 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
13897 LDKReplyShortChannelIdsEnd obj_conv;
13898 obj_conv.inner = (void*)(obj & (~1));
13899 obj_conv.is_owned = false;
13900 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
13901 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13902 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13903 CVec_u8Z_free(arg_var);
13907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13908 LDKu8slice ser_ref;
13909 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13910 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13911 LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
13912 *ret_conv = QueryChannelRange_read(ser_ref);
13913 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13914 return (long)ret_conv;
13917 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
13918 LDKQueryChannelRange obj_conv;
13919 obj_conv.inner = (void*)(obj & (~1));
13920 obj_conv.is_owned = false;
13921 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
13922 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13923 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13924 CVec_u8Z_free(arg_var);
13928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13929 LDKu8slice ser_ref;
13930 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13931 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13932 LDKCResult_ReplyChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ), "LDKCResult_ReplyChannelRangeDecodeErrorZ");
13933 *ret_conv = ReplyChannelRange_read(ser_ref);
13934 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13935 return (long)ret_conv;
13938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
13939 LDKReplyChannelRange obj_conv;
13940 obj_conv.inner = (void*)(obj & (~1));
13941 obj_conv.is_owned = false;
13942 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
13943 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13944 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13945 CVec_u8Z_free(arg_var);
13949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13950 LDKu8slice ser_ref;
13951 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13952 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13953 LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
13954 *ret_conv = GossipTimestampFilter_read(ser_ref);
13955 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13956 return (long)ret_conv;
13959 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
13960 LDKGossipTimestampFilter obj_conv;
13961 obj_conv.inner = (void*)(obj & (~1));
13962 obj_conv.is_owned = false;
13963 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
13964 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13965 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13966 CVec_u8Z_free(arg_var);
13970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13971 LDKMessageHandler this_ptr_conv;
13972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13974 MessageHandler_free(this_ptr_conv);
13977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
13978 LDKMessageHandler this_ptr_conv;
13979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13980 this_ptr_conv.is_owned = false;
13981 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
13985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13986 LDKMessageHandler this_ptr_conv;
13987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13988 this_ptr_conv.is_owned = false;
13989 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
13990 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
13991 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13992 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
13994 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
13997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
13998 LDKMessageHandler this_ptr_conv;
13999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14000 this_ptr_conv.is_owned = false;
14001 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
14005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14006 LDKMessageHandler this_ptr_conv;
14007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14008 this_ptr_conv.is_owned = false;
14009 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
14010 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
14011 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14012 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
14014 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
14017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
14018 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
14019 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
14020 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14021 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
14023 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
14024 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
14025 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14026 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
14028 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
14029 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14030 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14031 long ret_ref = (long)ret_var.inner;
14032 if (ret_var.is_owned) {
14038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14039 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
14040 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
14041 *ret = SocketDescriptor_clone(orig_conv);
14045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14046 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
14047 FREE((void*)this_ptr);
14048 SocketDescriptor_free(this_ptr_conv);
14051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14052 LDKPeerHandleError this_ptr_conv;
14053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14055 PeerHandleError_free(this_ptr_conv);
14058 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
14059 LDKPeerHandleError this_ptr_conv;
14060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14061 this_ptr_conv.is_owned = false;
14062 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
14066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
14067 LDKPeerHandleError this_ptr_conv;
14068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14069 this_ptr_conv.is_owned = false;
14070 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
14073 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
14074 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
14075 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14076 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14077 long ret_ref = (long)ret_var.inner;
14078 if (ret_var.is_owned) {
14084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14085 LDKPeerManager this_ptr_conv;
14086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14088 PeerManager_free(this_ptr_conv);
14091 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jbyteArray our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
14092 LDKMessageHandler message_handler_conv;
14093 message_handler_conv.inner = (void*)(message_handler & (~1));
14094 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
14095 // Warning: we may need a move here but can't clone!
14096 LDKSecretKey our_node_secret_ref;
14097 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
14098 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
14099 unsigned char ephemeral_random_data_arr[32];
14100 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
14101 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
14102 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
14103 LDKLogger logger_conv = *(LDKLogger*)logger;
14104 if (logger_conv.free == LDKLogger_JCalls_free) {
14105 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14106 LDKLogger_JCalls_clone(logger_conv.this_arg);
14108 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
14109 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14110 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14111 long ret_ref = (long)ret_var.inner;
14112 if (ret_var.is_owned) {
14118 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
14119 LDKPeerManager this_arg_conv;
14120 this_arg_conv.inner = (void*)(this_arg & (~1));
14121 this_arg_conv.is_owned = false;
14122 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
14123 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
14124 for (size_t i = 0; i < ret_var.datalen; i++) {
14125 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
14126 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
14127 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
14129 FREE(ret_var.data);
14133 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong descriptor) {
14134 LDKPeerManager this_arg_conv;
14135 this_arg_conv.inner = (void*)(this_arg & (~1));
14136 this_arg_conv.is_owned = false;
14137 LDKPublicKey their_node_id_ref;
14138 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
14139 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
14140 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
14141 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14142 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14143 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14145 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
14146 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
14147 return (long)ret_conv;
14150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
14151 LDKPeerManager this_arg_conv;
14152 this_arg_conv.inner = (void*)(this_arg & (~1));
14153 this_arg_conv.is_owned = false;
14154 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
14155 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
14156 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
14157 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
14159 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14160 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
14161 return (long)ret_conv;
14164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
14165 LDKPeerManager this_arg_conv;
14166 this_arg_conv.inner = (void*)(this_arg & (~1));
14167 this_arg_conv.is_owned = false;
14168 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14169 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
14170 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
14171 return (long)ret_conv;
14174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
14175 LDKPeerManager this_arg_conv;
14176 this_arg_conv.inner = (void*)(this_arg & (~1));
14177 this_arg_conv.is_owned = false;
14178 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
14179 LDKu8slice data_ref;
14180 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
14181 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
14182 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
14183 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
14184 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
14185 return (long)ret_conv;
14188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
14189 LDKPeerManager this_arg_conv;
14190 this_arg_conv.inner = (void*)(this_arg & (~1));
14191 this_arg_conv.is_owned = false;
14192 PeerManager_process_events(&this_arg_conv);
14195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
14196 LDKPeerManager this_arg_conv;
14197 this_arg_conv.inner = (void*)(this_arg & (~1));
14198 this_arg_conv.is_owned = false;
14199 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
14200 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
14203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
14204 LDKPeerManager this_arg_conv;
14205 this_arg_conv.inner = (void*)(this_arg & (~1));
14206 this_arg_conv.is_owned = false;
14207 PeerManager_timer_tick_occured(&this_arg_conv);
14210 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
14211 unsigned char commitment_seed_arr[32];
14212 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
14213 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
14214 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
14215 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
14216 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
14220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
14221 LDKPublicKey per_commitment_point_ref;
14222 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
14223 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14224 unsigned char base_secret_arr[32];
14225 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
14226 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
14227 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
14228 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14229 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
14230 return (long)ret_conv;
14233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
14234 LDKPublicKey per_commitment_point_ref;
14235 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
14236 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14237 LDKPublicKey base_point_ref;
14238 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
14239 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
14240 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14241 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
14242 return (long)ret_conv;
14245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1revocation_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_secret, jbyteArray countersignatory_revocation_base_secret) {
14246 unsigned char per_commitment_secret_arr[32];
14247 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
14248 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
14249 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
14250 unsigned char countersignatory_revocation_base_secret_arr[32];
14251 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
14252 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
14253 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
14254 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
14255 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
14256 return (long)ret_conv;
14259 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1revocation_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray countersignatory_revocation_base_point) {
14260 LDKPublicKey per_commitment_point_ref;
14261 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
14262 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14263 LDKPublicKey countersignatory_revocation_base_point_ref;
14264 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
14265 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
14266 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
14267 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
14268 return (long)ret_conv;
14271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14272 LDKTxCreationKeys this_ptr_conv;
14273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14275 TxCreationKeys_free(this_ptr_conv);
14278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14279 LDKTxCreationKeys orig_conv;
14280 orig_conv.inner = (void*)(orig & (~1));
14281 orig_conv.is_owned = false;
14282 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
14283 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14284 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14285 long ret_ref = (long)ret_var.inner;
14286 if (ret_var.is_owned) {
14292 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
14293 LDKTxCreationKeys this_ptr_conv;
14294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14295 this_ptr_conv.is_owned = false;
14296 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14297 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
14301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14302 LDKTxCreationKeys this_ptr_conv;
14303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14304 this_ptr_conv.is_owned = false;
14305 LDKPublicKey val_ref;
14306 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14307 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14308 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
14311 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
14312 LDKTxCreationKeys this_ptr_conv;
14313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14314 this_ptr_conv.is_owned = false;
14315 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14316 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
14320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14321 LDKTxCreationKeys this_ptr_conv;
14322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14323 this_ptr_conv.is_owned = false;
14324 LDKPublicKey val_ref;
14325 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14326 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14327 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
14330 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
14331 LDKTxCreationKeys this_ptr_conv;
14332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14333 this_ptr_conv.is_owned = false;
14334 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14335 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
14339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14340 LDKTxCreationKeys this_ptr_conv;
14341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14342 this_ptr_conv.is_owned = false;
14343 LDKPublicKey val_ref;
14344 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14345 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14346 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
14349 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
14350 LDKTxCreationKeys this_ptr_conv;
14351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14352 this_ptr_conv.is_owned = false;
14353 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14354 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
14358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14359 LDKTxCreationKeys this_ptr_conv;
14360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14361 this_ptr_conv.is_owned = false;
14362 LDKPublicKey val_ref;
14363 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14364 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14365 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
14368 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
14369 LDKTxCreationKeys this_ptr_conv;
14370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14371 this_ptr_conv.is_owned = false;
14372 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14373 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
14377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14378 LDKTxCreationKeys this_ptr_conv;
14379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14380 this_ptr_conv.is_owned = false;
14381 LDKPublicKey val_ref;
14382 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14383 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14384 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
14387 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point_arg, jbyteArray revocation_key_arg, jbyteArray broadcaster_htlc_key_arg, jbyteArray countersignatory_htlc_key_arg, jbyteArray broadcaster_delayed_payment_key_arg) {
14388 LDKPublicKey per_commitment_point_arg_ref;
14389 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
14390 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
14391 LDKPublicKey revocation_key_arg_ref;
14392 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
14393 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
14394 LDKPublicKey broadcaster_htlc_key_arg_ref;
14395 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
14396 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
14397 LDKPublicKey countersignatory_htlc_key_arg_ref;
14398 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
14399 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
14400 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
14401 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
14402 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
14403 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);
14404 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14405 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14406 long ret_ref = (long)ret_var.inner;
14407 if (ret_var.is_owned) {
14413 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
14414 LDKTxCreationKeys obj_conv;
14415 obj_conv.inner = (void*)(obj & (~1));
14416 obj_conv.is_owned = false;
14417 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
14418 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14419 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14420 CVec_u8Z_free(arg_var);
14424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14425 LDKu8slice ser_ref;
14426 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14427 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14428 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
14429 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14430 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14431 long ret_ref = (long)ret_var.inner;
14432 if (ret_var.is_owned) {
14435 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14440 LDKChannelPublicKeys this_ptr_conv;
14441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14443 ChannelPublicKeys_free(this_ptr_conv);
14446 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14447 LDKChannelPublicKeys orig_conv;
14448 orig_conv.inner = (void*)(orig & (~1));
14449 orig_conv.is_owned = false;
14450 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
14451 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14452 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14453 long ret_ref = (long)ret_var.inner;
14454 if (ret_var.is_owned) {
14460 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
14461 LDKChannelPublicKeys this_ptr_conv;
14462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14463 this_ptr_conv.is_owned = false;
14464 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14465 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
14469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14470 LDKChannelPublicKeys this_ptr_conv;
14471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14472 this_ptr_conv.is_owned = false;
14473 LDKPublicKey val_ref;
14474 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14475 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14476 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
14479 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
14480 LDKChannelPublicKeys this_ptr_conv;
14481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14482 this_ptr_conv.is_owned = false;
14483 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14484 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
14488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14489 LDKChannelPublicKeys this_ptr_conv;
14490 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14491 this_ptr_conv.is_owned = false;
14492 LDKPublicKey val_ref;
14493 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14494 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14495 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
14498 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
14499 LDKChannelPublicKeys this_ptr_conv;
14500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14501 this_ptr_conv.is_owned = false;
14502 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14503 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
14507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14508 LDKChannelPublicKeys this_ptr_conv;
14509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14510 this_ptr_conv.is_owned = false;
14511 LDKPublicKey val_ref;
14512 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14513 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14514 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
14517 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
14518 LDKChannelPublicKeys this_ptr_conv;
14519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14520 this_ptr_conv.is_owned = false;
14521 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14522 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
14526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14527 LDKChannelPublicKeys this_ptr_conv;
14528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14529 this_ptr_conv.is_owned = false;
14530 LDKPublicKey val_ref;
14531 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14532 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14533 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
14536 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
14537 LDKChannelPublicKeys this_ptr_conv;
14538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14539 this_ptr_conv.is_owned = false;
14540 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14541 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
14545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14546 LDKChannelPublicKeys this_ptr_conv;
14547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14548 this_ptr_conv.is_owned = false;
14549 LDKPublicKey val_ref;
14550 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14551 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14552 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
14555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv * _env, jclass _b, jbyteArray funding_pubkey_arg, jbyteArray revocation_basepoint_arg, jbyteArray payment_point_arg, jbyteArray delayed_payment_basepoint_arg, jbyteArray htlc_basepoint_arg) {
14556 LDKPublicKey funding_pubkey_arg_ref;
14557 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
14558 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
14559 LDKPublicKey revocation_basepoint_arg_ref;
14560 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
14561 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
14562 LDKPublicKey payment_point_arg_ref;
14563 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
14564 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
14565 LDKPublicKey delayed_payment_basepoint_arg_ref;
14566 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
14567 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
14568 LDKPublicKey htlc_basepoint_arg_ref;
14569 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
14570 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
14571 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);
14572 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14573 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14574 long ret_ref = (long)ret_var.inner;
14575 if (ret_var.is_owned) {
14581 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
14582 LDKChannelPublicKeys obj_conv;
14583 obj_conv.inner = (void*)(obj & (~1));
14584 obj_conv.is_owned = false;
14585 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
14586 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14587 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14588 CVec_u8Z_free(arg_var);
14592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14593 LDKu8slice ser_ref;
14594 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14595 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14596 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
14597 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14598 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14599 long ret_ref = (long)ret_var.inner;
14600 if (ret_var.is_owned) {
14603 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14607 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray broadcaster_delayed_payment_base, jbyteArray broadcaster_htlc_base, jbyteArray countersignatory_revocation_base, jbyteArray countersignatory_htlc_base) {
14608 LDKPublicKey per_commitment_point_ref;
14609 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
14610 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14611 LDKPublicKey broadcaster_delayed_payment_base_ref;
14612 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
14613 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
14614 LDKPublicKey broadcaster_htlc_base_ref;
14615 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
14616 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
14617 LDKPublicKey countersignatory_revocation_base_ref;
14618 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
14619 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
14620 LDKPublicKey countersignatory_htlc_base_ref;
14621 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
14622 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
14623 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14624 *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);
14625 return (long)ret_conv;
14628 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1from_1channel_1static_1keys(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jlong broadcaster_keys, jlong countersignatory_keys) {
14629 LDKPublicKey per_commitment_point_ref;
14630 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
14631 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
14632 LDKChannelPublicKeys broadcaster_keys_conv;
14633 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
14634 broadcaster_keys_conv.is_owned = false;
14635 LDKChannelPublicKeys countersignatory_keys_conv;
14636 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
14637 countersignatory_keys_conv.is_owned = false;
14638 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
14639 *ret_conv = TxCreationKeys_from_channel_static_keys(per_commitment_point_ref, &broadcaster_keys_conv, &countersignatory_keys_conv);
14640 return (long)ret_conv;
14643 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) {
14644 LDKPublicKey revocation_key_ref;
14645 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
14646 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14647 LDKPublicKey broadcaster_delayed_payment_key_ref;
14648 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
14649 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14650 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
14651 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14652 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14653 CVec_u8Z_free(arg_var);
14657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14658 LDKHTLCOutputInCommitment this_ptr_conv;
14659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14661 HTLCOutputInCommitment_free(this_ptr_conv);
14664 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14665 LDKHTLCOutputInCommitment orig_conv;
14666 orig_conv.inner = (void*)(orig & (~1));
14667 orig_conv.is_owned = false;
14668 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
14669 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14670 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14671 long ret_ref = (long)ret_var.inner;
14672 if (ret_var.is_owned) {
14678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
14679 LDKHTLCOutputInCommitment this_ptr_conv;
14680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14681 this_ptr_conv.is_owned = false;
14682 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
14686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
14687 LDKHTLCOutputInCommitment this_ptr_conv;
14688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14689 this_ptr_conv.is_owned = false;
14690 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
14693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14694 LDKHTLCOutputInCommitment this_ptr_conv;
14695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14696 this_ptr_conv.is_owned = false;
14697 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
14701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14702 LDKHTLCOutputInCommitment this_ptr_conv;
14703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14704 this_ptr_conv.is_owned = false;
14705 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
14708 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
14709 LDKHTLCOutputInCommitment this_ptr_conv;
14710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14711 this_ptr_conv.is_owned = false;
14712 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
14716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14717 LDKHTLCOutputInCommitment this_ptr_conv;
14718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14719 this_ptr_conv.is_owned = false;
14720 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
14723 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
14724 LDKHTLCOutputInCommitment this_ptr_conv;
14725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14726 this_ptr_conv.is_owned = false;
14727 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14728 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
14732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14733 LDKHTLCOutputInCommitment this_ptr_conv;
14734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14735 this_ptr_conv.is_owned = false;
14736 LDKThirtyTwoBytes val_ref;
14737 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14738 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14739 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
14742 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
14743 LDKHTLCOutputInCommitment obj_conv;
14744 obj_conv.inner = (void*)(obj & (~1));
14745 obj_conv.is_owned = false;
14746 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
14747 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14748 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14749 CVec_u8Z_free(arg_var);
14753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14754 LDKu8slice ser_ref;
14755 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14756 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14757 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
14758 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14759 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14760 long ret_ref = (long)ret_var.inner;
14761 if (ret_var.is_owned) {
14764 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14768 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
14769 LDKHTLCOutputInCommitment htlc_conv;
14770 htlc_conv.inner = (void*)(htlc & (~1));
14771 htlc_conv.is_owned = false;
14772 LDKTxCreationKeys keys_conv;
14773 keys_conv.inner = (void*)(keys & (~1));
14774 keys_conv.is_owned = false;
14775 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
14776 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14777 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14778 CVec_u8Z_free(arg_var);
14782 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
14783 LDKPublicKey broadcaster_ref;
14784 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
14785 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
14786 LDKPublicKey countersignatory_ref;
14787 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
14788 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
14789 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
14790 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14791 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14792 CVec_u8Z_free(arg_var);
14796 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort contest_delay, jlong htlc, jbyteArray broadcaster_delayed_payment_key, jbyteArray revocation_key) {
14797 unsigned char prev_hash_arr[32];
14798 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
14799 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
14800 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
14801 LDKHTLCOutputInCommitment htlc_conv;
14802 htlc_conv.inner = (void*)(htlc & (~1));
14803 htlc_conv.is_owned = false;
14804 LDKPublicKey broadcaster_delayed_payment_key_ref;
14805 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
14806 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
14807 LDKPublicKey revocation_key_ref;
14808 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
14809 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
14810 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
14811 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14812 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14813 Transaction_free(arg_var);
14817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14818 LDKChannelTransactionParameters this_ptr_conv;
14819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14821 ChannelTransactionParameters_free(this_ptr_conv);
14824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14825 LDKChannelTransactionParameters orig_conv;
14826 orig_conv.inner = (void*)(orig & (~1));
14827 orig_conv.is_owned = false;
14828 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_clone(&orig_conv);
14829 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14830 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14831 long ret_ref = (long)ret_var.inner;
14832 if (ret_var.is_owned) {
14838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1pubkeys(JNIEnv * _env, jclass _b, jlong this_ptr) {
14839 LDKChannelTransactionParameters this_ptr_conv;
14840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14841 this_ptr_conv.is_owned = false;
14842 LDKChannelPublicKeys ret_var = ChannelTransactionParameters_get_holder_pubkeys(&this_ptr_conv);
14843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14845 long ret_ref = (long)ret_var.inner;
14846 if (ret_var.is_owned) {
14852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1pubkeys(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14853 LDKChannelTransactionParameters this_ptr_conv;
14854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14855 this_ptr_conv.is_owned = false;
14856 LDKChannelPublicKeys val_conv;
14857 val_conv.inner = (void*)(val & (~1));
14858 val_conv.is_owned = (val & 1) || (val == 0);
14859 if (val_conv.inner != NULL)
14860 val_conv = ChannelPublicKeys_clone(&val_conv);
14861 ChannelTransactionParameters_set_holder_pubkeys(&this_ptr_conv, val_conv);
14864 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
14865 LDKChannelTransactionParameters this_ptr_conv;
14866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14867 this_ptr_conv.is_owned = false;
14868 jshort ret_val = ChannelTransactionParameters_get_holder_selected_contest_delay(&this_ptr_conv);
14872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
14873 LDKChannelTransactionParameters this_ptr_conv;
14874 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14875 this_ptr_conv.is_owned = false;
14876 ChannelTransactionParameters_set_holder_selected_contest_delay(&this_ptr_conv, val);
14879 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1is_1outbound_1from_1holder(JNIEnv * _env, jclass _b, jlong this_ptr) {
14880 LDKChannelTransactionParameters this_ptr_conv;
14881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14882 this_ptr_conv.is_owned = false;
14883 jboolean ret_val = ChannelTransactionParameters_get_is_outbound_from_holder(&this_ptr_conv);
14887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1is_1outbound_1from_1holder(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
14888 LDKChannelTransactionParameters this_ptr_conv;
14889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14890 this_ptr_conv.is_owned = false;
14891 ChannelTransactionParameters_set_is_outbound_from_holder(&this_ptr_conv, val);
14894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1counterparty_1parameters(JNIEnv * _env, jclass _b, jlong this_ptr) {
14895 LDKChannelTransactionParameters this_ptr_conv;
14896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14897 this_ptr_conv.is_owned = false;
14898 LDKCounterpartyChannelTransactionParameters ret_var = ChannelTransactionParameters_get_counterparty_parameters(&this_ptr_conv);
14899 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14900 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14901 long ret_ref = (long)ret_var.inner;
14902 if (ret_var.is_owned) {
14908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1counterparty_1parameters(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14909 LDKChannelTransactionParameters this_ptr_conv;
14910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14911 this_ptr_conv.is_owned = false;
14912 LDKCounterpartyChannelTransactionParameters val_conv;
14913 val_conv.inner = (void*)(val & (~1));
14914 val_conv.is_owned = (val & 1) || (val == 0);
14915 if (val_conv.inner != NULL)
14916 val_conv = CounterpartyChannelTransactionParameters_clone(&val_conv);
14917 ChannelTransactionParameters_set_counterparty_parameters(&this_ptr_conv, val_conv);
14920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1funding_1outpoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
14921 LDKChannelTransactionParameters this_ptr_conv;
14922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14923 this_ptr_conv.is_owned = false;
14924 LDKOutPoint ret_var = ChannelTransactionParameters_get_funding_outpoint(&this_ptr_conv);
14925 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14926 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14927 long ret_ref = (long)ret_var.inner;
14928 if (ret_var.is_owned) {
14934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14935 LDKChannelTransactionParameters this_ptr_conv;
14936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14937 this_ptr_conv.is_owned = false;
14938 LDKOutPoint val_conv;
14939 val_conv.inner = (void*)(val & (~1));
14940 val_conv.is_owned = (val & 1) || (val == 0);
14941 if (val_conv.inner != NULL)
14942 val_conv = OutPoint_clone(&val_conv);
14943 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv);
14946 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv * _env, jclass _b, jlong holder_pubkeys_arg, jshort holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, jlong counterparty_parameters_arg, jlong funding_outpoint_arg) {
14947 LDKChannelPublicKeys holder_pubkeys_arg_conv;
14948 holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1));
14949 holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0);
14950 if (holder_pubkeys_arg_conv.inner != NULL)
14951 holder_pubkeys_arg_conv = ChannelPublicKeys_clone(&holder_pubkeys_arg_conv);
14952 LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg_conv;
14953 counterparty_parameters_arg_conv.inner = (void*)(counterparty_parameters_arg & (~1));
14954 counterparty_parameters_arg_conv.is_owned = (counterparty_parameters_arg & 1) || (counterparty_parameters_arg == 0);
14955 if (counterparty_parameters_arg_conv.inner != NULL)
14956 counterparty_parameters_arg_conv = CounterpartyChannelTransactionParameters_clone(&counterparty_parameters_arg_conv);
14957 LDKOutPoint funding_outpoint_arg_conv;
14958 funding_outpoint_arg_conv.inner = (void*)(funding_outpoint_arg & (~1));
14959 funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0);
14960 if (funding_outpoint_arg_conv.inner != NULL)
14961 funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv);
14962 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);
14963 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14964 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14965 long ret_ref = (long)ret_var.inner;
14966 if (ret_var.is_owned) {
14972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14973 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14976 CounterpartyChannelTransactionParameters_free(this_ptr_conv);
14979 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14980 LDKCounterpartyChannelTransactionParameters orig_conv;
14981 orig_conv.inner = (void*)(orig & (~1));
14982 orig_conv.is_owned = false;
14983 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_clone(&orig_conv);
14984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14986 long ret_ref = (long)ret_var.inner;
14987 if (ret_var.is_owned) {
14993 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_ptr) {
14994 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
14995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14996 this_ptr_conv.is_owned = false;
14997 LDKChannelPublicKeys ret_var = CounterpartyChannelTransactionParameters_get_pubkeys(&this_ptr_conv);
14998 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14999 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15000 long ret_ref = (long)ret_var.inner;
15001 if (ret_var.is_owned) {
15007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1pubkeys(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
15008 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15010 this_ptr_conv.is_owned = false;
15011 LDKChannelPublicKeys val_conv;
15012 val_conv.inner = (void*)(val & (~1));
15013 val_conv.is_owned = (val & 1) || (val == 0);
15014 if (val_conv.inner != NULL)
15015 val_conv = ChannelPublicKeys_clone(&val_conv);
15016 CounterpartyChannelTransactionParameters_set_pubkeys(&this_ptr_conv, val_conv);
15019 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1get_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
15020 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15022 this_ptr_conv.is_owned = false;
15023 jshort ret_val = CounterpartyChannelTransactionParameters_get_selected_contest_delay(&this_ptr_conv);
15027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1set_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
15028 LDKCounterpartyChannelTransactionParameters this_ptr_conv;
15029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15030 this_ptr_conv.is_owned = false;
15031 CounterpartyChannelTransactionParameters_set_selected_contest_delay(&this_ptr_conv, val);
15034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1new(JNIEnv * _env, jclass _b, jlong pubkeys_arg, jshort selected_contest_delay_arg) {
15035 LDKChannelPublicKeys pubkeys_arg_conv;
15036 pubkeys_arg_conv.inner = (void*)(pubkeys_arg & (~1));
15037 pubkeys_arg_conv.is_owned = (pubkeys_arg & 1) || (pubkeys_arg == 0);
15038 if (pubkeys_arg_conv.inner != NULL)
15039 pubkeys_arg_conv = ChannelPublicKeys_clone(&pubkeys_arg_conv);
15040 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_new(pubkeys_arg_conv, selected_contest_delay_arg);
15041 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15042 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15043 long ret_ref = (long)ret_var.inner;
15044 if (ret_var.is_owned) {
15050 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1is_1populated(JNIEnv * _env, jclass _b, jlong this_arg) {
15051 LDKChannelTransactionParameters this_arg_conv;
15052 this_arg_conv.inner = (void*)(this_arg & (~1));
15053 this_arg_conv.is_owned = false;
15054 jboolean ret_val = ChannelTransactionParameters_is_populated(&this_arg_conv);
15058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1holder_1broadcastable(JNIEnv * _env, jclass _b, jlong this_arg) {
15059 LDKChannelTransactionParameters this_arg_conv;
15060 this_arg_conv.inner = (void*)(this_arg & (~1));
15061 this_arg_conv.is_owned = false;
15062 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_holder_broadcastable(&this_arg_conv);
15063 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15064 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15065 long ret_ref = (long)ret_var.inner;
15066 if (ret_var.is_owned) {
15072 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1as_1counterparty_1broadcastable(JNIEnv * _env, jclass _b, jlong this_arg) {
15073 LDKChannelTransactionParameters this_arg_conv;
15074 this_arg_conv.inner = (void*)(this_arg & (~1));
15075 this_arg_conv.is_owned = false;
15076 LDKDirectedChannelTransactionParameters ret_var = ChannelTransactionParameters_as_counterparty_broadcastable(&this_arg_conv);
15077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15079 long ret_ref = (long)ret_var.inner;
15080 if (ret_var.is_owned) {
15086 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1write(JNIEnv * _env, jclass _b, jlong obj) {
15087 LDKCounterpartyChannelTransactionParameters obj_conv;
15088 obj_conv.inner = (void*)(obj & (~1));
15089 obj_conv.is_owned = false;
15090 LDKCVec_u8Z arg_var = CounterpartyChannelTransactionParameters_write(&obj_conv);
15091 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
15092 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
15093 CVec_u8Z_free(arg_var);
15097 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyChannelTransactionParameters_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
15098 LDKu8slice ser_ref;
15099 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
15100 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
15101 LDKCounterpartyChannelTransactionParameters ret_var = CounterpartyChannelTransactionParameters_read(ser_ref);
15102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15104 long ret_ref = (long)ret_var.inner;
15105 if (ret_var.is_owned) {
15108 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
15112 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1write(JNIEnv * _env, jclass _b, jlong obj) {
15113 LDKChannelTransactionParameters obj_conv;
15114 obj_conv.inner = (void*)(obj & (~1));
15115 obj_conv.is_owned = false;
15116 LDKCVec_u8Z arg_var = ChannelTransactionParameters_write(&obj_conv);
15117 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
15118 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
15119 CVec_u8Z_free(arg_var);
15123 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
15124 LDKu8slice ser_ref;
15125 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
15126 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
15127 LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_read(ser_ref);
15128 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15129 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15130 long ret_ref = (long)ret_var.inner;
15131 if (ret_var.is_owned) {
15134 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
15138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15139 LDKDirectedChannelTransactionParameters this_ptr_conv;
15140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15141 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15142 DirectedChannelTransactionParameters_free(this_ptr_conv);
15145 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1broadcaster_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
15146 LDKDirectedChannelTransactionParameters this_arg_conv;
15147 this_arg_conv.inner = (void*)(this_arg & (~1));
15148 this_arg_conv.is_owned = false;
15149 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_broadcaster_pubkeys(&this_arg_conv);
15150 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15151 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15152 long ret_ref = (long)ret_var.inner;
15153 if (ret_var.is_owned) {
15159 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1countersignatory_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
15160 LDKDirectedChannelTransactionParameters this_arg_conv;
15161 this_arg_conv.inner = (void*)(this_arg & (~1));
15162 this_arg_conv.is_owned = false;
15163 LDKChannelPublicKeys ret_var = DirectedChannelTransactionParameters_countersignatory_pubkeys(&this_arg_conv);
15164 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15165 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15166 long ret_ref = (long)ret_var.inner;
15167 if (ret_var.is_owned) {
15173 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
15174 LDKDirectedChannelTransactionParameters this_arg_conv;
15175 this_arg_conv.inner = (void*)(this_arg & (~1));
15176 this_arg_conv.is_owned = false;
15177 jshort ret_val = DirectedChannelTransactionParameters_contest_delay(&this_arg_conv);
15181 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1is_1outbound(JNIEnv * _env, jclass _b, jlong this_arg) {
15182 LDKDirectedChannelTransactionParameters this_arg_conv;
15183 this_arg_conv.inner = (void*)(this_arg & (~1));
15184 this_arg_conv.is_owned = false;
15185 jboolean ret_val = DirectedChannelTransactionParameters_is_outbound(&this_arg_conv);
15189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint(JNIEnv * _env, jclass _b, jlong this_arg) {
15190 LDKDirectedChannelTransactionParameters this_arg_conv;
15191 this_arg_conv.inner = (void*)(this_arg & (~1));
15192 this_arg_conv.is_owned = false;
15193 LDKOutPoint ret_var = DirectedChannelTransactionParameters_funding_outpoint(&this_arg_conv);
15194 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15195 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15196 long ret_ref = (long)ret_var.inner;
15197 if (ret_var.is_owned) {
15203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15204 LDKHolderCommitmentTransaction this_ptr_conv;
15205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15206 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15207 HolderCommitmentTransaction_free(this_ptr_conv);
15210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
15211 LDKHolderCommitmentTransaction orig_conv;
15212 orig_conv.inner = (void*)(orig & (~1));
15213 orig_conv.is_owned = false;
15214 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
15215 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15216 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15217 long ret_ref = (long)ret_var.inner;
15218 if (ret_var.is_owned) {
15224 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
15225 LDKHolderCommitmentTransaction this_ptr_conv;
15226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15227 this_ptr_conv.is_owned = false;
15228 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
15229 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
15233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
15234 LDKHolderCommitmentTransaction this_ptr_conv;
15235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15236 this_ptr_conv.is_owned = false;
15237 LDKSignature val_ref;
15238 CHECK((*_env)->GetArrayLength (_env, val) == 64);
15239 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
15240 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
15243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1htlc_1sigs(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
15244 LDKHolderCommitmentTransaction this_ptr_conv;
15245 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15246 this_ptr_conv.is_owned = false;
15247 LDKCVec_SignatureZ val_constr;
15248 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
15249 if (val_constr.datalen > 0)
15250 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15252 val_constr.data = NULL;
15253 for (size_t i = 0; i < val_constr.datalen; i++) {
15254 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
15255 LDKSignature arr_conv_8_ref;
15256 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
15257 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15258 val_constr.data[i] = arr_conv_8_ref;
15260 HolderCommitmentTransaction_set_counterparty_htlc_sigs(&this_ptr_conv, val_constr);
15263 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
15264 LDKHolderCommitmentTransaction obj_conv;
15265 obj_conv.inner = (void*)(obj & (~1));
15266 obj_conv.is_owned = false;
15267 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
15268 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
15269 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
15270 CVec_u8Z_free(arg_var);
15274 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
15275 LDKu8slice ser_ref;
15276 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
15277 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
15278 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
15279 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15280 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15281 long ret_ref = (long)ret_var.inner;
15282 if (ret_var.is_owned) {
15285 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
15289 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new(JNIEnv * _env, jclass _b, jlong commitment_tx, jbyteArray counterparty_sig, jobjectArray counterparty_htlc_sigs, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key) {
15290 LDKCommitmentTransaction commitment_tx_conv;
15291 commitment_tx_conv.inner = (void*)(commitment_tx & (~1));
15292 commitment_tx_conv.is_owned = (commitment_tx & 1) || (commitment_tx == 0);
15293 if (commitment_tx_conv.inner != NULL)
15294 commitment_tx_conv = CommitmentTransaction_clone(&commitment_tx_conv);
15295 LDKSignature counterparty_sig_ref;
15296 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
15297 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
15298 LDKCVec_SignatureZ counterparty_htlc_sigs_constr;
15299 counterparty_htlc_sigs_constr.datalen = (*_env)->GetArrayLength (_env, counterparty_htlc_sigs);
15300 if (counterparty_htlc_sigs_constr.datalen > 0)
15301 counterparty_htlc_sigs_constr.data = MALLOC(counterparty_htlc_sigs_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
15303 counterparty_htlc_sigs_constr.data = NULL;
15304 for (size_t i = 0; i < counterparty_htlc_sigs_constr.datalen; i++) {
15305 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, counterparty_htlc_sigs, i);
15306 LDKSignature arr_conv_8_ref;
15307 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
15308 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
15309 counterparty_htlc_sigs_constr.data[i] = arr_conv_8_ref;
15311 LDKPublicKey holder_funding_key_ref;
15312 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
15313 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
15314 LDKPublicKey counterparty_funding_key_ref;
15315 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
15316 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
15317 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new(commitment_tx_conv, counterparty_sig_ref, counterparty_htlc_sigs_constr, holder_funding_key_ref, counterparty_funding_key_ref);
15318 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15319 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15320 long ret_ref = (long)ret_var.inner;
15321 if (ret_var.is_owned) {
15327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15328 LDKBuiltCommitmentTransaction this_ptr_conv;
15329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15331 BuiltCommitmentTransaction_free(this_ptr_conv);
15334 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
15335 LDKBuiltCommitmentTransaction orig_conv;
15336 orig_conv.inner = (void*)(orig & (~1));
15337 orig_conv.is_owned = false;
15338 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
15339 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15340 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15341 long ret_ref = (long)ret_var.inner;
15342 if (ret_var.is_owned) {
15348 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1transaction(JNIEnv * _env, jclass _b, jlong this_ptr) {
15349 LDKBuiltCommitmentTransaction this_ptr_conv;
15350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15351 this_ptr_conv.is_owned = false;
15352 LDKTransaction arg_var = BuiltCommitmentTransaction_get_transaction(&this_ptr_conv);
15353 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
15354 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
15355 Transaction_free(arg_var);
15359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1transaction(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
15360 LDKBuiltCommitmentTransaction this_ptr_conv;
15361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15362 this_ptr_conv.is_owned = false;
15363 LDKTransaction val_ref;
15364 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
15365 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
15366 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
15367 val_ref.data_is_owned = true;
15368 BuiltCommitmentTransaction_set_transaction(&this_ptr_conv, val_ref);
15371 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
15372 LDKBuiltCommitmentTransaction this_ptr_conv;
15373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15374 this_ptr_conv.is_owned = false;
15375 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
15376 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *BuiltCommitmentTransaction_get_txid(&this_ptr_conv));
15380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
15381 LDKBuiltCommitmentTransaction this_ptr_conv;
15382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15383 this_ptr_conv.is_owned = false;
15384 LDKThirtyTwoBytes val_ref;
15385 CHECK((*_env)->GetArrayLength (_env, val) == 32);
15386 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
15387 BuiltCommitmentTransaction_set_txid(&this_ptr_conv, val_ref);
15390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1new(JNIEnv * _env, jclass _b, jbyteArray transaction_arg, jbyteArray txid_arg) {
15391 LDKTransaction transaction_arg_ref;
15392 transaction_arg_ref.datalen = (*_env)->GetArrayLength (_env, transaction_arg);
15393 transaction_arg_ref.data = MALLOC(transaction_arg_ref.datalen, "LDKTransaction Bytes");
15394 (*_env)->GetByteArrayRegion(_env, transaction_arg, 0, transaction_arg_ref.datalen, transaction_arg_ref.data);
15395 transaction_arg_ref.data_is_owned = true;
15396 LDKThirtyTwoBytes txid_arg_ref;
15397 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
15398 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
15399 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_new(transaction_arg_ref, txid_arg_ref);
15400 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15401 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15402 long ret_ref = (long)ret_var.inner;
15403 if (ret_var.is_owned) {
15409 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
15410 LDKBuiltCommitmentTransaction obj_conv;
15411 obj_conv.inner = (void*)(obj & (~1));
15412 obj_conv.is_owned = false;
15413 LDKCVec_u8Z arg_var = BuiltCommitmentTransaction_write(&obj_conv);
15414 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
15415 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
15416 CVec_u8Z_free(arg_var);
15420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
15421 LDKu8slice ser_ref;
15422 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
15423 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
15424 LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_read(ser_ref);
15425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15427 long ret_ref = (long)ret_var.inner;
15428 if (ret_var.is_owned) {
15431 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
15435 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_redeemscript, jlong channel_value_satoshis) {
15436 LDKBuiltCommitmentTransaction this_arg_conv;
15437 this_arg_conv.inner = (void*)(this_arg & (~1));
15438 this_arg_conv.is_owned = false;
15439 LDKu8slice funding_redeemscript_ref;
15440 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
15441 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
15442 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
15443 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
15444 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15448 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jbyteArray funding_redeemscript, jlong channel_value_satoshis) {
15449 LDKBuiltCommitmentTransaction this_arg_conv;
15450 this_arg_conv.inner = (void*)(this_arg & (~1));
15451 this_arg_conv.is_owned = false;
15452 unsigned char funding_key_arr[32];
15453 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
15454 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
15455 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
15456 LDKu8slice funding_redeemscript_ref;
15457 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
15458 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
15459 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
15460 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
15461 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
15465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15466 LDKCommitmentTransaction this_ptr_conv;
15467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15469 CommitmentTransaction_free(this_ptr_conv);
15472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
15473 LDKCommitmentTransaction orig_conv;
15474 orig_conv.inner = (void*)(orig & (~1));
15475 orig_conv.is_owned = false;
15476 LDKCommitmentTransaction ret_var = CommitmentTransaction_clone(&orig_conv);
15477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15479 long ret_ref = (long)ret_var.inner;
15480 if (ret_var.is_owned) {
15486 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
15487 LDKCommitmentTransaction obj_conv;
15488 obj_conv.inner = (void*)(obj & (~1));
15489 obj_conv.is_owned = false;
15490 LDKCVec_u8Z arg_var = CommitmentTransaction_write(&obj_conv);
15491 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
15492 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
15493 CVec_u8Z_free(arg_var);
15497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
15498 LDKu8slice ser_ref;
15499 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
15500 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
15501 LDKCommitmentTransaction ret_var = CommitmentTransaction_read(ser_ref);
15502 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15503 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15504 long ret_ref = (long)ret_var.inner;
15505 if (ret_var.is_owned) {
15508 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
15512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_arg) {
15513 LDKCommitmentTransaction this_arg_conv;
15514 this_arg_conv.inner = (void*)(this_arg & (~1));
15515 this_arg_conv.is_owned = false;
15516 jlong ret_val = CommitmentTransaction_commitment_number(&this_arg_conv);
15520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat(JNIEnv * _env, jclass _b, jlong this_arg) {
15521 LDKCommitmentTransaction this_arg_conv;
15522 this_arg_conv.inner = (void*)(this_arg & (~1));
15523 this_arg_conv.is_owned = false;
15524 jlong ret_val = CommitmentTransaction_to_broadcaster_value_sat(&this_arg_conv);
15528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat(JNIEnv * _env, jclass _b, jlong this_arg) {
15529 LDKCommitmentTransaction this_arg_conv;
15530 this_arg_conv.inner = (void*)(this_arg & (~1));
15531 this_arg_conv.is_owned = false;
15532 jlong ret_val = CommitmentTransaction_to_countersignatory_value_sat(&this_arg_conv);
15536 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_arg) {
15537 LDKCommitmentTransaction this_arg_conv;
15538 this_arg_conv.inner = (void*)(this_arg & (~1));
15539 this_arg_conv.is_owned = false;
15540 jint ret_val = CommitmentTransaction_feerate_per_kw(&this_arg_conv);
15544 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust(JNIEnv * _env, jclass _b, jlong this_arg) {
15545 LDKCommitmentTransaction this_arg_conv;
15546 this_arg_conv.inner = (void*)(this_arg & (~1));
15547 this_arg_conv.is_owned = false;
15548 LDKTrustedCommitmentTransaction ret_var = CommitmentTransaction_trust(&this_arg_conv);
15549 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15550 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15551 long ret_ref = (long)ret_var.inner;
15552 if (ret_var.is_owned) {
15558 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_parameters, jlong broadcaster_keys, jlong countersignatory_keys) {
15559 LDKCommitmentTransaction this_arg_conv;
15560 this_arg_conv.inner = (void*)(this_arg & (~1));
15561 this_arg_conv.is_owned = false;
15562 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15563 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15564 channel_parameters_conv.is_owned = false;
15565 LDKChannelPublicKeys broadcaster_keys_conv;
15566 broadcaster_keys_conv.inner = (void*)(broadcaster_keys & (~1));
15567 broadcaster_keys_conv.is_owned = false;
15568 LDKChannelPublicKeys countersignatory_keys_conv;
15569 countersignatory_keys_conv.inner = (void*)(countersignatory_keys & (~1));
15570 countersignatory_keys_conv.is_owned = false;
15571 LDKCResult_TrustedCommitmentTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ), "LDKCResult_TrustedCommitmentTransactionNoneZ");
15572 *ret_conv = CommitmentTransaction_verify(&this_arg_conv, &channel_parameters_conv, &broadcaster_keys_conv, &countersignatory_keys_conv);
15573 return (long)ret_conv;
15576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15577 LDKTrustedCommitmentTransaction this_ptr_conv;
15578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15580 TrustedCommitmentTransaction_free(this_ptr_conv);
15583 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
15584 LDKTrustedCommitmentTransaction this_arg_conv;
15585 this_arg_conv.inner = (void*)(this_arg & (~1));
15586 this_arg_conv.is_owned = false;
15587 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
15588 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, TrustedCommitmentTransaction_txid(&this_arg_conv).data);
15592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction(JNIEnv * _env, jclass _b, jlong this_arg) {
15593 LDKTrustedCommitmentTransaction this_arg_conv;
15594 this_arg_conv.inner = (void*)(this_arg & (~1));
15595 this_arg_conv.is_owned = false;
15596 LDKBuiltCommitmentTransaction ret_var = TrustedCommitmentTransaction_built_transaction(&this_arg_conv);
15597 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15598 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15599 long ret_ref = (long)ret_var.inner;
15600 if (ret_var.is_owned) {
15606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys(JNIEnv * _env, jclass _b, jlong this_arg) {
15607 LDKTrustedCommitmentTransaction this_arg_conv;
15608 this_arg_conv.inner = (void*)(this_arg & (~1));
15609 this_arg_conv.is_owned = false;
15610 LDKTxCreationKeys ret_var = TrustedCommitmentTransaction_keys(&this_arg_conv);
15611 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15612 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15613 long ret_ref = (long)ret_var.inner;
15614 if (ret_var.is_owned) {
15620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_base_key, jlong channel_parameters) {
15621 LDKTrustedCommitmentTransaction this_arg_conv;
15622 this_arg_conv.inner = (void*)(this_arg & (~1));
15623 this_arg_conv.is_owned = false;
15624 unsigned char htlc_base_key_arr[32];
15625 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
15626 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
15627 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
15628 LDKDirectedChannelTransactionParameters channel_parameters_conv;
15629 channel_parameters_conv.inner = (void*)(channel_parameters & (~1));
15630 channel_parameters_conv.is_owned = false;
15631 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
15632 *ret_conv = TrustedCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, &channel_parameters_conv);
15633 return (long)ret_conv;
15636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1commitment_1transaction_1number_1obscure_1factor(JNIEnv * _env, jclass _b, jbyteArray broadcaster_payment_basepoint, jbyteArray countersignatory_payment_basepoint, jboolean outbound_from_broadcaster) {
15637 LDKPublicKey broadcaster_payment_basepoint_ref;
15638 CHECK((*_env)->GetArrayLength (_env, broadcaster_payment_basepoint) == 33);
15639 (*_env)->GetByteArrayRegion (_env, broadcaster_payment_basepoint, 0, 33, broadcaster_payment_basepoint_ref.compressed_form);
15640 LDKPublicKey countersignatory_payment_basepoint_ref;
15641 CHECK((*_env)->GetArrayLength (_env, countersignatory_payment_basepoint) == 33);
15642 (*_env)->GetByteArrayRegion (_env, countersignatory_payment_basepoint, 0, 33, countersignatory_payment_basepoint_ref.compressed_form);
15643 jlong ret_val = get_commitment_transaction_number_obscure_factor(broadcaster_payment_basepoint_ref, countersignatory_payment_basepoint_ref, outbound_from_broadcaster);
15647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15648 LDKInitFeatures this_ptr_conv;
15649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15651 InitFeatures_free(this_ptr_conv);
15654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15655 LDKNodeFeatures this_ptr_conv;
15656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15658 NodeFeatures_free(this_ptr_conv);
15661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15662 LDKChannelFeatures this_ptr_conv;
15663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15665 ChannelFeatures_free(this_ptr_conv);
15668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15669 LDKRouteHop this_ptr_conv;
15670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15672 RouteHop_free(this_ptr_conv);
15675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
15676 LDKRouteHop orig_conv;
15677 orig_conv.inner = (void*)(orig & (~1));
15678 orig_conv.is_owned = false;
15679 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
15680 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15681 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15682 long ret_ref = (long)ret_var.inner;
15683 if (ret_var.is_owned) {
15689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
15690 LDKRouteHop this_ptr_conv;
15691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15692 this_ptr_conv.is_owned = false;
15693 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
15694 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
15698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
15699 LDKRouteHop this_ptr_conv;
15700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15701 this_ptr_conv.is_owned = false;
15702 LDKPublicKey val_ref;
15703 CHECK((*_env)->GetArrayLength (_env, val) == 33);
15704 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
15705 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
15708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
15709 LDKRouteHop this_ptr_conv;
15710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15711 this_ptr_conv.is_owned = false;
15712 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
15713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15715 long ret_ref = (long)ret_var.inner;
15716 if (ret_var.is_owned) {
15722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
15723 LDKRouteHop this_ptr_conv;
15724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15725 this_ptr_conv.is_owned = false;
15726 LDKNodeFeatures val_conv;
15727 val_conv.inner = (void*)(val & (~1));
15728 val_conv.is_owned = (val & 1) || (val == 0);
15729 // Warning: we may need a move here but can't clone!
15730 RouteHop_set_node_features(&this_ptr_conv, val_conv);
15733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
15734 LDKRouteHop this_ptr_conv;
15735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15736 this_ptr_conv.is_owned = false;
15737 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
15741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
15742 LDKRouteHop this_ptr_conv;
15743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15744 this_ptr_conv.is_owned = false;
15745 RouteHop_set_short_channel_id(&this_ptr_conv, val);
15748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
15749 LDKRouteHop this_ptr_conv;
15750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15751 this_ptr_conv.is_owned = false;
15752 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
15753 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15754 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15755 long ret_ref = (long)ret_var.inner;
15756 if (ret_var.is_owned) {
15762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
15763 LDKRouteHop this_ptr_conv;
15764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15765 this_ptr_conv.is_owned = false;
15766 LDKChannelFeatures val_conv;
15767 val_conv.inner = (void*)(val & (~1));
15768 val_conv.is_owned = (val & 1) || (val == 0);
15769 // Warning: we may need a move here but can't clone!
15770 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
15773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
15774 LDKRouteHop this_ptr_conv;
15775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15776 this_ptr_conv.is_owned = false;
15777 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
15781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
15782 LDKRouteHop this_ptr_conv;
15783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15784 this_ptr_conv.is_owned = false;
15785 RouteHop_set_fee_msat(&this_ptr_conv, val);
15788 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
15789 LDKRouteHop this_ptr_conv;
15790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15791 this_ptr_conv.is_owned = false;
15792 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
15796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
15797 LDKRouteHop this_ptr_conv;
15798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15799 this_ptr_conv.is_owned = false;
15800 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
15803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1new(JNIEnv * _env, jclass _b, jbyteArray pubkey_arg, jlong node_features_arg, jlong short_channel_id_arg, jlong channel_features_arg, jlong fee_msat_arg, jint cltv_expiry_delta_arg) {
15804 LDKPublicKey pubkey_arg_ref;
15805 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
15806 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
15807 LDKNodeFeatures node_features_arg_conv;
15808 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
15809 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
15810 // Warning: we may need a move here but can't clone!
15811 LDKChannelFeatures channel_features_arg_conv;
15812 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
15813 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
15814 // Warning: we may need a move here but can't clone!
15815 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);
15816 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15817 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15818 long ret_ref = (long)ret_var.inner;
15819 if (ret_var.is_owned) {
15825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15826 LDKRoute this_ptr_conv;
15827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15829 Route_free(this_ptr_conv);
15832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
15833 LDKRoute orig_conv;
15834 orig_conv.inner = (void*)(orig & (~1));
15835 orig_conv.is_owned = false;
15836 LDKRoute ret_var = Route_clone(&orig_conv);
15837 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15838 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15839 long ret_ref = (long)ret_var.inner;
15840 if (ret_var.is_owned) {
15846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
15847 LDKRoute this_ptr_conv;
15848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15849 this_ptr_conv.is_owned = false;
15850 LDKCVec_CVec_RouteHopZZ val_constr;
15851 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
15852 if (val_constr.datalen > 0)
15853 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15855 val_constr.data = NULL;
15856 for (size_t m = 0; m < val_constr.datalen; m++) {
15857 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
15858 LDKCVec_RouteHopZ arr_conv_12_constr;
15859 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
15860 if (arr_conv_12_constr.datalen > 0)
15861 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15863 arr_conv_12_constr.data = NULL;
15864 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
15865 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15866 long arr_conv_10 = arr_conv_12_vals[k];
15867 LDKRouteHop arr_conv_10_conv;
15868 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15869 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15870 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15872 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
15873 val_constr.data[m] = arr_conv_12_constr;
15875 Route_set_paths(&this_ptr_conv, val_constr);
15878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
15879 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
15880 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
15881 if (paths_arg_constr.datalen > 0)
15882 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
15884 paths_arg_constr.data = NULL;
15885 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
15886 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
15887 LDKCVec_RouteHopZ arr_conv_12_constr;
15888 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
15889 if (arr_conv_12_constr.datalen > 0)
15890 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
15892 arr_conv_12_constr.data = NULL;
15893 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
15894 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
15895 long arr_conv_10 = arr_conv_12_vals[k];
15896 LDKRouteHop arr_conv_10_conv;
15897 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
15898 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
15899 arr_conv_12_constr.data[k] = arr_conv_10_conv;
15901 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
15902 paths_arg_constr.data[m] = arr_conv_12_constr;
15904 LDKRoute ret_var = Route_new(paths_arg_constr);
15905 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15906 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15907 long ret_ref = (long)ret_var.inner;
15908 if (ret_var.is_owned) {
15914 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
15916 obj_conv.inner = (void*)(obj & (~1));
15917 obj_conv.is_owned = false;
15918 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
15919 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
15920 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
15921 CVec_u8Z_free(arg_var);
15925 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
15926 LDKu8slice ser_ref;
15927 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
15928 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
15929 LDKCResult_RouteDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteDecodeErrorZ), "LDKCResult_RouteDecodeErrorZ");
15930 *ret_conv = Route_read(ser_ref);
15931 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
15932 return (long)ret_conv;
15935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
15936 LDKRouteHint this_ptr_conv;
15937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15938 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
15939 RouteHint_free(this_ptr_conv);
15942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
15943 LDKRouteHint orig_conv;
15944 orig_conv.inner = (void*)(orig & (~1));
15945 orig_conv.is_owned = false;
15946 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
15947 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15948 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15949 long ret_ref = (long)ret_var.inner;
15950 if (ret_var.is_owned) {
15956 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
15957 LDKRouteHint this_ptr_conv;
15958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15959 this_ptr_conv.is_owned = false;
15960 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
15961 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
15965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
15966 LDKRouteHint this_ptr_conv;
15967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15968 this_ptr_conv.is_owned = false;
15969 LDKPublicKey val_ref;
15970 CHECK((*_env)->GetArrayLength (_env, val) == 33);
15971 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
15972 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
15975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
15976 LDKRouteHint this_ptr_conv;
15977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15978 this_ptr_conv.is_owned = false;
15979 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
15983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
15984 LDKRouteHint this_ptr_conv;
15985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15986 this_ptr_conv.is_owned = false;
15987 RouteHint_set_short_channel_id(&this_ptr_conv, val);
15990 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
15991 LDKRouteHint this_ptr_conv;
15992 this_ptr_conv.inner = (void*)(this_ptr & (~1));
15993 this_ptr_conv.is_owned = false;
15994 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
15995 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
15996 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
15997 long ret_ref = (long)ret_var.inner;
15998 if (ret_var.is_owned) {
16004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16005 LDKRouteHint this_ptr_conv;
16006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16007 this_ptr_conv.is_owned = false;
16008 LDKRoutingFees val_conv;
16009 val_conv.inner = (void*)(val & (~1));
16010 val_conv.is_owned = (val & 1) || (val == 0);
16011 if (val_conv.inner != NULL)
16012 val_conv = RoutingFees_clone(&val_conv);
16013 RouteHint_set_fees(&this_ptr_conv, val_conv);
16016 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
16017 LDKRouteHint this_ptr_conv;
16018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16019 this_ptr_conv.is_owned = false;
16020 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
16024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
16025 LDKRouteHint this_ptr_conv;
16026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16027 this_ptr_conv.is_owned = false;
16028 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
16031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
16032 LDKRouteHint this_ptr_conv;
16033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16034 this_ptr_conv.is_owned = false;
16035 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
16039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16040 LDKRouteHint this_ptr_conv;
16041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16042 this_ptr_conv.is_owned = false;
16043 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
16046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv * _env, jclass _b, jbyteArray src_node_id_arg, jlong short_channel_id_arg, jlong fees_arg, jshort cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
16047 LDKPublicKey src_node_id_arg_ref;
16048 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
16049 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
16050 LDKRoutingFees fees_arg_conv;
16051 fees_arg_conv.inner = (void*)(fees_arg & (~1));
16052 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
16053 if (fees_arg_conv.inner != NULL)
16054 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
16055 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);
16056 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16057 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16058 long ret_ref = (long)ret_var.inner;
16059 if (ret_var.is_owned) {
16065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv * _env, jclass _b, jbyteArray our_node_id, jlong network, jbyteArray target, jlongArray first_hops, jlongArray last_hops, jlong final_value_msat, jint final_cltv, jlong logger) {
16066 LDKPublicKey our_node_id_ref;
16067 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
16068 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
16069 LDKNetworkGraph network_conv;
16070 network_conv.inner = (void*)(network & (~1));
16071 network_conv.is_owned = false;
16072 LDKPublicKey target_ref;
16073 CHECK((*_env)->GetArrayLength (_env, target) == 33);
16074 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
16075 LDKCVec_ChannelDetailsZ first_hops_constr;
16076 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
16077 if (first_hops_constr.datalen > 0)
16078 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
16080 first_hops_constr.data = NULL;
16081 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
16082 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
16083 long arr_conv_16 = first_hops_vals[q];
16084 LDKChannelDetails arr_conv_16_conv;
16085 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
16086 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
16087 first_hops_constr.data[q] = arr_conv_16_conv;
16089 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
16090 LDKCVec_RouteHintZ last_hops_constr;
16091 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
16092 if (last_hops_constr.datalen > 0)
16093 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
16095 last_hops_constr.data = NULL;
16096 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
16097 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
16098 long arr_conv_11 = last_hops_vals[l];
16099 LDKRouteHint arr_conv_11_conv;
16100 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
16101 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
16102 last_hops_constr.data[l] = arr_conv_11_conv;
16104 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
16105 LDKLogger logger_conv = *(LDKLogger*)logger;
16106 if (logger_conv.free == LDKLogger_JCalls_free) {
16107 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16108 LDKLogger_JCalls_clone(logger_conv.this_arg);
16110 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
16111 *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);
16112 FREE(first_hops_constr.data);
16113 return (long)ret_conv;
16116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16117 LDKNetworkGraph this_ptr_conv;
16118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16120 NetworkGraph_free(this_ptr_conv);
16123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16124 LDKLockedNetworkGraph this_ptr_conv;
16125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16127 LockedNetworkGraph_free(this_ptr_conv);
16130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16131 LDKNetGraphMsgHandler this_ptr_conv;
16132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16134 NetGraphMsgHandler_free(this_ptr_conv);
16137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jbyteArray genesis_hash, jlong chain_access, jlong logger) {
16138 LDKThirtyTwoBytes genesis_hash_ref;
16139 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
16140 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_ref.data);
16141 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16142 LDKLogger logger_conv = *(LDKLogger*)logger;
16143 if (logger_conv.free == LDKLogger_JCalls_free) {
16144 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16145 LDKLogger_JCalls_clone(logger_conv.this_arg);
16147 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv, logger_conv);
16148 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16149 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16150 long ret_ref = (long)ret_var.inner;
16151 if (ret_var.is_owned) {
16157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
16158 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
16159 LDKLogger logger_conv = *(LDKLogger*)logger;
16160 if (logger_conv.free == LDKLogger_JCalls_free) {
16161 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
16162 LDKLogger_JCalls_clone(logger_conv.this_arg);
16164 LDKNetworkGraph network_graph_conv;
16165 network_graph_conv.inner = (void*)(network_graph & (~1));
16166 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
16167 // Warning: we may need a move here but can't clone!
16168 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
16169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16171 long ret_ref = (long)ret_var.inner;
16172 if (ret_var.is_owned) {
16178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
16179 LDKNetGraphMsgHandler this_arg_conv;
16180 this_arg_conv.inner = (void*)(this_arg & (~1));
16181 this_arg_conv.is_owned = false;
16182 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
16183 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16184 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16185 long ret_ref = (long)ret_var.inner;
16186 if (ret_var.is_owned) {
16192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
16193 LDKLockedNetworkGraph this_arg_conv;
16194 this_arg_conv.inner = (void*)(this_arg & (~1));
16195 this_arg_conv.is_owned = false;
16196 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
16197 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16198 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16199 long ret_ref = (long)ret_var.inner;
16200 if (ret_var.is_owned) {
16206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
16207 LDKNetGraphMsgHandler this_arg_conv;
16208 this_arg_conv.inner = (void*)(this_arg & (~1));
16209 this_arg_conv.is_owned = false;
16210 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
16211 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
16215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
16216 LDKNetGraphMsgHandler this_arg_conv;
16217 this_arg_conv.inner = (void*)(this_arg & (~1));
16218 this_arg_conv.is_owned = false;
16219 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
16220 *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
16224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16225 LDKDirectionalChannelInfo this_ptr_conv;
16226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16227 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16228 DirectionalChannelInfo_free(this_ptr_conv);
16231 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
16232 LDKDirectionalChannelInfo this_ptr_conv;
16233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16234 this_ptr_conv.is_owned = false;
16235 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
16239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
16240 LDKDirectionalChannelInfo this_ptr_conv;
16241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16242 this_ptr_conv.is_owned = false;
16243 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
16246 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
16247 LDKDirectionalChannelInfo this_ptr_conv;
16248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16249 this_ptr_conv.is_owned = false;
16250 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
16254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
16255 LDKDirectionalChannelInfo this_ptr_conv;
16256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16257 this_ptr_conv.is_owned = false;
16258 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
16261 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
16262 LDKDirectionalChannelInfo this_ptr_conv;
16263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16264 this_ptr_conv.is_owned = false;
16265 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
16269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
16270 LDKDirectionalChannelInfo this_ptr_conv;
16271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16272 this_ptr_conv.is_owned = false;
16273 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
16276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
16277 LDKDirectionalChannelInfo this_ptr_conv;
16278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16279 this_ptr_conv.is_owned = false;
16280 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
16284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16285 LDKDirectionalChannelInfo this_ptr_conv;
16286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16287 this_ptr_conv.is_owned = false;
16288 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
16291 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
16292 LDKDirectionalChannelInfo this_ptr_conv;
16293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16294 this_ptr_conv.is_owned = false;
16295 LDKRoutingFees ret_var = DirectionalChannelInfo_get_fees(&this_ptr_conv);
16296 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16297 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16298 long ret_ref = (long)ret_var.inner;
16299 if (ret_var.is_owned) {
16305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16306 LDKDirectionalChannelInfo this_ptr_conv;
16307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16308 this_ptr_conv.is_owned = false;
16309 LDKRoutingFees val_conv;
16310 val_conv.inner = (void*)(val & (~1));
16311 val_conv.is_owned = (val & 1) || (val == 0);
16312 if (val_conv.inner != NULL)
16313 val_conv = RoutingFees_clone(&val_conv);
16314 DirectionalChannelInfo_set_fees(&this_ptr_conv, val_conv);
16317 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
16318 LDKDirectionalChannelInfo this_ptr_conv;
16319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16320 this_ptr_conv.is_owned = false;
16321 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
16322 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16323 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16324 long ret_ref = (long)ret_var.inner;
16325 if (ret_var.is_owned) {
16331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16332 LDKDirectionalChannelInfo this_ptr_conv;
16333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16334 this_ptr_conv.is_owned = false;
16335 LDKChannelUpdate val_conv;
16336 val_conv.inner = (void*)(val & (~1));
16337 val_conv.is_owned = (val & 1) || (val == 0);
16338 if (val_conv.inner != NULL)
16339 val_conv = ChannelUpdate_clone(&val_conv);
16340 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
16343 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
16344 LDKDirectionalChannelInfo obj_conv;
16345 obj_conv.inner = (void*)(obj & (~1));
16346 obj_conv.is_owned = false;
16347 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
16348 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
16349 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
16350 CVec_u8Z_free(arg_var);
16354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
16355 LDKu8slice ser_ref;
16356 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
16357 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
16358 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
16359 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16360 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16361 long ret_ref = (long)ret_var.inner;
16362 if (ret_var.is_owned) {
16365 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
16369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16370 LDKChannelInfo this_ptr_conv;
16371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16373 ChannelInfo_free(this_ptr_conv);
16376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
16377 LDKChannelInfo this_ptr_conv;
16378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16379 this_ptr_conv.is_owned = false;
16380 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
16381 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16382 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16383 long ret_ref = (long)ret_var.inner;
16384 if (ret_var.is_owned) {
16390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16391 LDKChannelInfo this_ptr_conv;
16392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16393 this_ptr_conv.is_owned = false;
16394 LDKChannelFeatures val_conv;
16395 val_conv.inner = (void*)(val & (~1));
16396 val_conv.is_owned = (val & 1) || (val == 0);
16397 // Warning: we may need a move here but can't clone!
16398 ChannelInfo_set_features(&this_ptr_conv, val_conv);
16401 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
16402 LDKChannelInfo this_ptr_conv;
16403 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16404 this_ptr_conv.is_owned = false;
16405 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
16406 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
16410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
16411 LDKChannelInfo this_ptr_conv;
16412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16413 this_ptr_conv.is_owned = false;
16414 LDKPublicKey val_ref;
16415 CHECK((*_env)->GetArrayLength (_env, val) == 33);
16416 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
16417 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
16420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
16421 LDKChannelInfo this_ptr_conv;
16422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16423 this_ptr_conv.is_owned = false;
16424 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
16425 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16426 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16427 long ret_ref = (long)ret_var.inner;
16428 if (ret_var.is_owned) {
16434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16435 LDKChannelInfo this_ptr_conv;
16436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16437 this_ptr_conv.is_owned = false;
16438 LDKDirectionalChannelInfo val_conv;
16439 val_conv.inner = (void*)(val & (~1));
16440 val_conv.is_owned = (val & 1) || (val == 0);
16441 // Warning: we may need a move here but can't clone!
16442 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
16445 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
16446 LDKChannelInfo this_ptr_conv;
16447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16448 this_ptr_conv.is_owned = false;
16449 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
16450 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
16454 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
16455 LDKChannelInfo this_ptr_conv;
16456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16457 this_ptr_conv.is_owned = false;
16458 LDKPublicKey val_ref;
16459 CHECK((*_env)->GetArrayLength (_env, val) == 33);
16460 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
16461 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
16464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
16465 LDKChannelInfo this_ptr_conv;
16466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16467 this_ptr_conv.is_owned = false;
16468 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
16469 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16470 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16471 long ret_ref = (long)ret_var.inner;
16472 if (ret_var.is_owned) {
16478 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16479 LDKChannelInfo this_ptr_conv;
16480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16481 this_ptr_conv.is_owned = false;
16482 LDKDirectionalChannelInfo val_conv;
16483 val_conv.inner = (void*)(val & (~1));
16484 val_conv.is_owned = (val & 1) || (val == 0);
16485 // Warning: we may need a move here but can't clone!
16486 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
16489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
16490 LDKChannelInfo this_ptr_conv;
16491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16492 this_ptr_conv.is_owned = false;
16493 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
16494 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16495 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16496 long ret_ref = (long)ret_var.inner;
16497 if (ret_var.is_owned) {
16503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16504 LDKChannelInfo this_ptr_conv;
16505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16506 this_ptr_conv.is_owned = false;
16507 LDKChannelAnnouncement val_conv;
16508 val_conv.inner = (void*)(val & (~1));
16509 val_conv.is_owned = (val & 1) || (val == 0);
16510 if (val_conv.inner != NULL)
16511 val_conv = ChannelAnnouncement_clone(&val_conv);
16512 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
16515 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
16516 LDKChannelInfo obj_conv;
16517 obj_conv.inner = (void*)(obj & (~1));
16518 obj_conv.is_owned = false;
16519 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
16520 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
16521 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
16522 CVec_u8Z_free(arg_var);
16526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
16527 LDKu8slice ser_ref;
16528 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
16529 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
16530 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
16531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16533 long ret_ref = (long)ret_var.inner;
16534 if (ret_var.is_owned) {
16537 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
16541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16542 LDKRoutingFees this_ptr_conv;
16543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16545 RoutingFees_free(this_ptr_conv);
16548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
16549 LDKRoutingFees orig_conv;
16550 orig_conv.inner = (void*)(orig & (~1));
16551 orig_conv.is_owned = false;
16552 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
16553 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16554 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16555 long ret_ref = (long)ret_var.inner;
16556 if (ret_var.is_owned) {
16562 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
16563 LDKRoutingFees this_ptr_conv;
16564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16565 this_ptr_conv.is_owned = false;
16566 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
16570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
16571 LDKRoutingFees this_ptr_conv;
16572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16573 this_ptr_conv.is_owned = false;
16574 RoutingFees_set_base_msat(&this_ptr_conv, val);
16577 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
16578 LDKRoutingFees this_ptr_conv;
16579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16580 this_ptr_conv.is_owned = false;
16581 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
16585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
16586 LDKRoutingFees this_ptr_conv;
16587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16588 this_ptr_conv.is_owned = false;
16589 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
16592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
16593 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
16594 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16595 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16596 long ret_ref = (long)ret_var.inner;
16597 if (ret_var.is_owned) {
16603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
16604 LDKu8slice ser_ref;
16605 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
16606 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
16607 LDKCResult_RoutingFeesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RoutingFeesDecodeErrorZ), "LDKCResult_RoutingFeesDecodeErrorZ");
16608 *ret_conv = RoutingFees_read(ser_ref);
16609 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
16610 return (long)ret_conv;
16613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
16614 LDKRoutingFees obj_conv;
16615 obj_conv.inner = (void*)(obj & (~1));
16616 obj_conv.is_owned = false;
16617 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
16618 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
16619 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
16620 CVec_u8Z_free(arg_var);
16624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16625 LDKNodeAnnouncementInfo this_ptr_conv;
16626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16627 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16628 NodeAnnouncementInfo_free(this_ptr_conv);
16631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
16632 LDKNodeAnnouncementInfo this_ptr_conv;
16633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16634 this_ptr_conv.is_owned = false;
16635 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
16636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16638 long ret_ref = (long)ret_var.inner;
16639 if (ret_var.is_owned) {
16645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16646 LDKNodeAnnouncementInfo this_ptr_conv;
16647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16648 this_ptr_conv.is_owned = false;
16649 LDKNodeFeatures val_conv;
16650 val_conv.inner = (void*)(val & (~1));
16651 val_conv.is_owned = (val & 1) || (val == 0);
16652 // Warning: we may need a move here but can't clone!
16653 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
16656 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
16657 LDKNodeAnnouncementInfo this_ptr_conv;
16658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16659 this_ptr_conv.is_owned = false;
16660 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
16664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
16665 LDKNodeAnnouncementInfo this_ptr_conv;
16666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16667 this_ptr_conv.is_owned = false;
16668 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
16671 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
16672 LDKNodeAnnouncementInfo this_ptr_conv;
16673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16674 this_ptr_conv.is_owned = false;
16675 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
16676 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
16680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
16681 LDKNodeAnnouncementInfo this_ptr_conv;
16682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16683 this_ptr_conv.is_owned = false;
16684 LDKThreeBytes val_ref;
16685 CHECK((*_env)->GetArrayLength (_env, val) == 3);
16686 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
16687 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
16690 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
16691 LDKNodeAnnouncementInfo this_ptr_conv;
16692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16693 this_ptr_conv.is_owned = false;
16694 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
16695 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
16699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
16700 LDKNodeAnnouncementInfo this_ptr_conv;
16701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16702 this_ptr_conv.is_owned = false;
16703 LDKThirtyTwoBytes val_ref;
16704 CHECK((*_env)->GetArrayLength (_env, val) == 32);
16705 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
16706 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
16709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
16710 LDKNodeAnnouncementInfo this_ptr_conv;
16711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16712 this_ptr_conv.is_owned = false;
16713 LDKCVec_NetAddressZ val_constr;
16714 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
16715 if (val_constr.datalen > 0)
16716 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16718 val_constr.data = NULL;
16719 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
16720 for (size_t m = 0; m < val_constr.datalen; m++) {
16721 long arr_conv_12 = val_vals[m];
16722 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
16723 FREE((void*)arr_conv_12);
16724 val_constr.data[m] = arr_conv_12_conv;
16726 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
16727 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
16730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
16731 LDKNodeAnnouncementInfo this_ptr_conv;
16732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16733 this_ptr_conv.is_owned = false;
16734 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
16735 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16736 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16737 long ret_ref = (long)ret_var.inner;
16738 if (ret_var.is_owned) {
16744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16745 LDKNodeAnnouncementInfo this_ptr_conv;
16746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16747 this_ptr_conv.is_owned = false;
16748 LDKNodeAnnouncement val_conv;
16749 val_conv.inner = (void*)(val & (~1));
16750 val_conv.is_owned = (val & 1) || (val == 0);
16751 if (val_conv.inner != NULL)
16752 val_conv = NodeAnnouncement_clone(&val_conv);
16753 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
16756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1new(JNIEnv * _env, jclass _b, jlong features_arg, jint last_update_arg, jbyteArray rgb_arg, jbyteArray alias_arg, jlongArray addresses_arg, jlong announcement_message_arg) {
16757 LDKNodeFeatures features_arg_conv;
16758 features_arg_conv.inner = (void*)(features_arg & (~1));
16759 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
16760 // Warning: we may need a move here but can't clone!
16761 LDKThreeBytes rgb_arg_ref;
16762 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
16763 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
16764 LDKThirtyTwoBytes alias_arg_ref;
16765 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
16766 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
16767 LDKCVec_NetAddressZ addresses_arg_constr;
16768 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
16769 if (addresses_arg_constr.datalen > 0)
16770 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
16772 addresses_arg_constr.data = NULL;
16773 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
16774 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
16775 long arr_conv_12 = addresses_arg_vals[m];
16776 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
16777 FREE((void*)arr_conv_12);
16778 addresses_arg_constr.data[m] = arr_conv_12_conv;
16780 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
16781 LDKNodeAnnouncement announcement_message_arg_conv;
16782 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
16783 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
16784 if (announcement_message_arg_conv.inner != NULL)
16785 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
16786 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
16787 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16788 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16789 long ret_ref = (long)ret_var.inner;
16790 if (ret_var.is_owned) {
16796 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
16797 LDKNodeAnnouncementInfo obj_conv;
16798 obj_conv.inner = (void*)(obj & (~1));
16799 obj_conv.is_owned = false;
16800 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
16801 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
16802 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
16803 CVec_u8Z_free(arg_var);
16807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
16808 LDKu8slice ser_ref;
16809 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
16810 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
16811 LDKCResult_NodeAnnouncementInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ), "LDKCResult_NodeAnnouncementInfoDecodeErrorZ");
16812 *ret_conv = NodeAnnouncementInfo_read(ser_ref);
16813 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
16814 return (long)ret_conv;
16817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
16818 LDKNodeInfo this_ptr_conv;
16819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
16821 NodeInfo_free(this_ptr_conv);
16824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
16825 LDKNodeInfo this_ptr_conv;
16826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16827 this_ptr_conv.is_owned = false;
16828 LDKCVec_u64Z val_constr;
16829 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
16830 if (val_constr.datalen > 0)
16831 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
16833 val_constr.data = NULL;
16834 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
16835 for (size_t g = 0; g < val_constr.datalen; g++) {
16836 long arr_conv_6 = val_vals[g];
16837 val_constr.data[g] = arr_conv_6;
16839 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
16840 NodeInfo_set_channels(&this_ptr_conv, val_constr);
16843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
16844 LDKNodeInfo this_ptr_conv;
16845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16846 this_ptr_conv.is_owned = false;
16847 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
16848 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16849 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16850 long ret_ref = (long)ret_var.inner;
16851 if (ret_var.is_owned) {
16857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16858 LDKNodeInfo this_ptr_conv;
16859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16860 this_ptr_conv.is_owned = false;
16861 LDKRoutingFees val_conv;
16862 val_conv.inner = (void*)(val & (~1));
16863 val_conv.is_owned = (val & 1) || (val == 0);
16864 if (val_conv.inner != NULL)
16865 val_conv = RoutingFees_clone(&val_conv);
16866 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
16869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
16870 LDKNodeInfo this_ptr_conv;
16871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16872 this_ptr_conv.is_owned = false;
16873 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
16874 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16875 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16876 long ret_ref = (long)ret_var.inner;
16877 if (ret_var.is_owned) {
16883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
16884 LDKNodeInfo this_ptr_conv;
16885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
16886 this_ptr_conv.is_owned = false;
16887 LDKNodeAnnouncementInfo val_conv;
16888 val_conv.inner = (void*)(val & (~1));
16889 val_conv.is_owned = (val & 1) || (val == 0);
16890 // Warning: we may need a move here but can't clone!
16891 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
16894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv * _env, jclass _b, jlongArray channels_arg, jlong lowest_inbound_channel_fees_arg, jlong announcement_info_arg) {
16895 LDKCVec_u64Z channels_arg_constr;
16896 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
16897 if (channels_arg_constr.datalen > 0)
16898 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
16900 channels_arg_constr.data = NULL;
16901 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
16902 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
16903 long arr_conv_6 = channels_arg_vals[g];
16904 channels_arg_constr.data[g] = arr_conv_6;
16906 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
16907 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
16908 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
16909 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
16910 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
16911 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
16912 LDKNodeAnnouncementInfo announcement_info_arg_conv;
16913 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
16914 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
16915 // Warning: we may need a move here but can't clone!
16916 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
16917 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16918 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16919 long ret_ref = (long)ret_var.inner;
16920 if (ret_var.is_owned) {
16926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
16927 LDKNodeInfo obj_conv;
16928 obj_conv.inner = (void*)(obj & (~1));
16929 obj_conv.is_owned = false;
16930 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
16931 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
16932 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
16933 CVec_u8Z_free(arg_var);
16937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
16938 LDKu8slice ser_ref;
16939 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
16940 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
16941 LDKCResult_NodeInfoDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeInfoDecodeErrorZ), "LDKCResult_NodeInfoDecodeErrorZ");
16942 *ret_conv = NodeInfo_read(ser_ref);
16943 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
16944 return (long)ret_conv;
16947 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
16948 LDKNetworkGraph obj_conv;
16949 obj_conv.inner = (void*)(obj & (~1));
16950 obj_conv.is_owned = false;
16951 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
16952 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
16953 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
16954 CVec_u8Z_free(arg_var);
16958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
16959 LDKu8slice ser_ref;
16960 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
16961 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
16962 LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
16963 *ret_conv = NetworkGraph_read(ser_ref);
16964 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
16965 return (long)ret_conv;
16968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b, jbyteArray genesis_hash) {
16969 LDKThirtyTwoBytes genesis_hash_ref;
16970 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
16971 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_ref.data);
16972 LDKNetworkGraph ret_var = NetworkGraph_new(genesis_hash_ref);
16973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
16974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
16975 long ret_ref = (long)ret_var.inner;
16976 if (ret_var.is_owned) {
16982 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
16983 LDKNetworkGraph this_arg_conv;
16984 this_arg_conv.inner = (void*)(this_arg & (~1));
16985 this_arg_conv.is_owned = false;
16986 LDKNodeAnnouncement msg_conv;
16987 msg_conv.inner = (void*)(msg & (~1));
16988 msg_conv.is_owned = false;
16989 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
16990 *ret_conv = NetworkGraph_update_node_from_announcement(&this_arg_conv, &msg_conv);
16991 return (long)ret_conv;
16994 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1unsigned_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
16995 LDKNetworkGraph this_arg_conv;
16996 this_arg_conv.inner = (void*)(this_arg & (~1));
16997 this_arg_conv.is_owned = false;
16998 LDKUnsignedNodeAnnouncement msg_conv;
16999 msg_conv.inner = (void*)(msg & (~1));
17000 msg_conv.is_owned = false;
17001 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17002 *ret_conv = NetworkGraph_update_node_from_unsigned_announcement(&this_arg_conv, &msg_conv);
17003 return (long)ret_conv;
17006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg, jlong chain_access) {
17007 LDKNetworkGraph this_arg_conv;
17008 this_arg_conv.inner = (void*)(this_arg & (~1));
17009 this_arg_conv.is_owned = false;
17010 LDKChannelAnnouncement msg_conv;
17011 msg_conv.inner = (void*)(msg & (~1));
17012 msg_conv.is_owned = false;
17013 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17014 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17015 *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17016 return (long)ret_conv;
17019 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1from_1unsigned_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg, jlong chain_access) {
17020 LDKNetworkGraph this_arg_conv;
17021 this_arg_conv.inner = (void*)(this_arg & (~1));
17022 this_arg_conv.is_owned = false;
17023 LDKUnsignedChannelAnnouncement msg_conv;
17024 msg_conv.inner = (void*)(msg & (~1));
17025 msg_conv.is_owned = false;
17026 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
17027 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17028 *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
17029 return (long)ret_conv;
17032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong short_channel_id, jboolean is_permanent) {
17033 LDKNetworkGraph this_arg_conv;
17034 this_arg_conv.inner = (void*)(this_arg & (~1));
17035 this_arg_conv.is_owned = false;
17036 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
17039 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
17040 LDKNetworkGraph this_arg_conv;
17041 this_arg_conv.inner = (void*)(this_arg & (~1));
17042 this_arg_conv.is_owned = false;
17043 LDKChannelUpdate msg_conv;
17044 msg_conv.inner = (void*)(msg & (~1));
17045 msg_conv.is_owned = false;
17046 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17047 *ret_conv = NetworkGraph_update_channel(&this_arg_conv, &msg_conv);
17048 return (long)ret_conv;
17051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel_1unsigned(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
17052 LDKNetworkGraph this_arg_conv;
17053 this_arg_conv.inner = (void*)(this_arg & (~1));
17054 this_arg_conv.is_owned = false;
17055 LDKUnsignedChannelUpdate msg_conv;
17056 msg_conv.inner = (void*)(msg & (~1));
17057 msg_conv.is_owned = false;
17058 LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
17059 *ret_conv = NetworkGraph_update_channel_unsigned(&this_arg_conv, &msg_conv);
17060 return (long)ret_conv;