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_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
456 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)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_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
460 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
461 ret->datalen = (*env)->GetArrayLength(env, elems);
462 if (ret->datalen == 0) {
465 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 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_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
475 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
477 LDKTransaction b_ref;
478 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
479 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
480 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
481 b_ref.data_is_owned = false;
485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
486 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
489 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
490 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
491 LDKTransaction b_var = tuple->b;
492 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
493 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
497 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
499 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
500 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
501 CHECK(val->result_ok);
502 return *val->contents.result;
504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
505 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
506 CHECK(!val->result_ok);
507 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
511 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
513 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
514 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
515 CHECK(val->result_ok);
516 return *val->contents.result;
518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
519 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
520 CHECK(!val->result_ok);
521 LDKMonitorUpdateError err_var = (*val->contents.err);
522 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
523 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
524 long err_ref = (long)err_var.inner & ~1;
527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
528 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
530 a_conv.inner = (void*)(a & (~1));
531 a_conv.is_owned = (a & 1) || (a == 0);
532 if (a_conv.inner != NULL)
533 a_conv = OutPoint_clone(&a_conv);
536 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
537 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
538 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
543 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
544 LDKOutPoint a_var = tuple->a;
545 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
546 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
547 long a_ref = (long)a_var.inner & ~1;
550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
551 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
552 LDKCVec_u8Z b_var = tuple->b;
553 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
554 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
558 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
559 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
562 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
563 ret->datalen = (*env)->GetArrayLength(env, elems);
564 if (ret->datalen == 0) {
567 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
568 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
569 for (size_t i = 0; i < ret->datalen; i++) {
570 jlong arr_elem = java_elems[i];
571 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
572 FREE((void*)arr_elem);
573 ret->data[i] = arr_elem_conv;
575 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
580 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
581 LDKThirtyTwoBytes a_ref;
582 CHECK((*_env)->GetArrayLength (_env, a) == 32);
583 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
585 LDKCVecTempl_TxOut b_constr;
586 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
587 if (b_constr.datalen > 0)
588 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
590 b_constr.data = NULL;
591 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
592 for (size_t h = 0; h < b_constr.datalen; h++) {
593 long arr_conv_7 = b_vals[h];
594 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
595 FREE((void*)arr_conv_7);
596 b_constr.data[h] = arr_conv_7_conv;
598 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
602 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
603 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
604 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
605 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
608 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
609 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
610 LDKCVecTempl_TxOut b_var = tuple->b;
611 jlongArray b_arr = (*_env)->NewLongArray(_env, b_var.datalen);
612 jlong *b_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, b_arr, NULL);
613 for (size_t h = 0; h < b_var.datalen; h++) {
614 long arr_conv_7_ref = (long)&b_var.data[h];
615 b_arr_ptr[h] = arr_conv_7_ref;
617 (*_env)->ReleasePrimitiveArrayCritical(_env, b_arr, b_arr_ptr, 0);
620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
621 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
626 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
627 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
631 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
634 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
635 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
636 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
639 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
641 CHECK((*_env)->GetArrayLength (_env, a) == 64);
642 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
644 LDKCVecTempl_Signature b_constr;
645 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
646 if (b_constr.datalen > 0)
647 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
649 b_constr.data = NULL;
650 for (size_t i = 0; i < b_constr.datalen; i++) {
651 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
652 LDKSignature arr_conv_8_ref;
653 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
654 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
655 b_constr.data[i] = arr_conv_8_ref;
660 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
661 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
662 jbyteArray a_arr = (*_env)->NewByteArray(_env, 64);
663 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 64, tuple->a.compact_form);
666 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
667 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
668 LDKCVecTempl_Signature b_var = tuple->b;
669 jobjectArray b_arr = (*_env)->NewObjectArray(_env, b_var.datalen, arr_of_B_clz, NULL);
670 for (size_t i = 0; i < b_var.datalen; i++) {
671 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
672 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
673 (*_env)->SetObjectArrayElement(_env, b_arr, i, arr_conv_8_arr);
677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
678 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
681 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
682 CHECK(val->result_ok);
683 long res_ref = (long)&(*val->contents.result);
686 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
687 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
688 CHECK(!val->result_ok);
689 return *val->contents.err;
691 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
692 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
694 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
695 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
696 CHECK(val->result_ok);
697 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
698 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
701 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
702 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
703 CHECK(!val->result_ok);
704 return *val->contents.err;
706 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
707 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
709 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
710 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
711 CHECK(val->result_ok);
712 LDKCVecTempl_Signature res_var = (*val->contents.result);
713 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, arr_of_B_clz, NULL);
714 for (size_t i = 0; i < res_var.datalen; i++) {
715 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
716 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
717 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
721 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
722 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
723 CHECK(!val->result_ok);
724 return *val->contents.err;
726 static jclass LDKAPIError_APIMisuseError_class = NULL;
727 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
728 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
729 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
730 static jclass LDKAPIError_RouteError_class = NULL;
731 static jmethodID LDKAPIError_RouteError_meth = NULL;
732 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
733 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
734 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
735 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
737 LDKAPIError_APIMisuseError_class =
738 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
739 CHECK(LDKAPIError_APIMisuseError_class != NULL);
740 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
741 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
742 LDKAPIError_FeeRateTooHigh_class =
743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
744 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
745 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
746 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
747 LDKAPIError_RouteError_class =
748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
749 CHECK(LDKAPIError_RouteError_class != NULL);
750 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
751 CHECK(LDKAPIError_RouteError_meth != NULL);
752 LDKAPIError_ChannelUnavailable_class =
753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
754 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
755 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
756 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
757 LDKAPIError_MonitorUpdateFailed_class =
758 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
759 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
760 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
761 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
763 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
764 LDKAPIError *obj = (LDKAPIError*)ptr;
766 case LDKAPIError_APIMisuseError: {
767 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
768 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
769 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
770 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
772 case LDKAPIError_FeeRateTooHigh: {
773 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
774 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
775 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
776 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
778 case LDKAPIError_RouteError: {
779 LDKStr err_str = obj->route_error.err;
780 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
781 memcpy(err_buf, err_str.chars, err_str.len);
782 err_buf[err_str.len] = 0;
783 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
785 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
787 case LDKAPIError_ChannelUnavailable: {
788 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
789 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
790 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
791 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
793 case LDKAPIError_MonitorUpdateFailed: {
794 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
799 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
800 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
802 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
803 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
804 CHECK(val->result_ok);
805 return *val->contents.result;
807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
808 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
809 CHECK(!val->result_ok);
810 long err_ref = (long)&(*val->contents.err);
813 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
814 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
816 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
817 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
818 CHECK(val->result_ok);
819 return *val->contents.result;
821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
822 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
823 CHECK(!val->result_ok);
824 LDKPaymentSendFailure err_var = (*val->contents.err);
825 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
826 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
827 long err_ref = (long)err_var.inner & ~1;
830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *_env, jclass _b, jlong a, jlong b, jlong c) {
831 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
832 LDKChannelAnnouncement a_conv;
833 a_conv.inner = (void*)(a & (~1));
834 a_conv.is_owned = (a & 1) || (a == 0);
835 if (a_conv.inner != NULL)
836 a_conv = ChannelAnnouncement_clone(&a_conv);
838 LDKChannelUpdate b_conv;
839 b_conv.inner = (void*)(b & (~1));
840 b_conv.is_owned = (b & 1) || (b == 0);
841 if (b_conv.inner != NULL)
842 b_conv = ChannelUpdate_clone(&b_conv);
844 LDKChannelUpdate c_conv;
845 c_conv.inner = (void*)(c & (~1));
846 c_conv.is_owned = (c & 1) || (c == 0);
847 if (c_conv.inner != NULL)
848 c_conv = ChannelUpdate_clone(&c_conv);
852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
853 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
854 LDKChannelAnnouncement a_var = tuple->a;
855 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
856 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
857 long a_ref = (long)a_var.inner & ~1;
860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
861 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
862 LDKChannelUpdate b_var = tuple->b;
863 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
864 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
865 long b_ref = (long)b_var.inner & ~1;
868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *_env, jclass _b, jlong ptr) {
869 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
870 LDKChannelUpdate c_var = tuple->c;
871 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
872 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
873 long c_ref = (long)c_var.inner & ~1;
876 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
877 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
879 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
880 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
881 CHECK(val->result_ok);
882 return *val->contents.result;
884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
885 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
886 CHECK(!val->result_ok);
887 LDKPeerHandleError err_var = (*val->contents.err);
888 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
889 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
890 long err_ref = (long)err_var.inner & ~1;
893 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
894 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
895 LDKHTLCOutputInCommitment a_conv;
896 a_conv.inner = (void*)(a & (~1));
897 a_conv.is_owned = (a & 1) || (a == 0);
898 if (a_conv.inner != NULL)
899 a_conv = HTLCOutputInCommitment_clone(&a_conv);
902 CHECK((*_env)->GetArrayLength (_env, b) == 64);
903 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
908 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
909 LDKHTLCOutputInCommitment a_var = tuple->a;
910 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
911 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
912 long a_ref = (long)a_var.inner & ~1;
915 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
916 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
917 jbyteArray b_arr = (*_env)->NewByteArray(_env, 64);
918 (*_env)->SetByteArrayRegion(_env, b_arr, 0, 64, tuple->b.compact_form);
921 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
922 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
923 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
924 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
925 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
926 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
928 LDKSpendableOutputDescriptor_StaticOutput_class =
929 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
930 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
931 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
932 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
933 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
934 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
935 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
936 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
937 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
938 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
939 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
940 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
941 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
942 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
944 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
945 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
947 case LDKSpendableOutputDescriptor_StaticOutput: {
948 LDKOutPoint outpoint_var = obj->static_output.outpoint;
949 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
950 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
951 long outpoint_ref = (long)outpoint_var.inner & ~1;
952 long output_ref = (long)&obj->static_output.output;
953 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
955 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
956 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
957 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
958 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
959 long outpoint_ref = (long)outpoint_var.inner & ~1;
960 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
961 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
962 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
963 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
964 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
965 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
966 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth, outpoint_ref, per_commitment_point_arr, obj->dynamic_output_p2wsh.to_self_delay, output_ref, key_derivation_params_ref, revocation_pubkey_arr);
968 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
969 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
970 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
971 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
972 long outpoint_ref = (long)outpoint_var.inner & ~1;
973 long output_ref = (long)&obj->static_output_counterparty_payment.output;
974 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
975 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
980 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
981 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
982 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
985 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
986 ret->datalen = (*env)->GetArrayLength(env, elems);
987 if (ret->datalen == 0) {
990 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
991 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
992 for (size_t i = 0; i < ret->datalen; i++) {
993 jlong arr_elem = java_elems[i];
994 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
995 FREE((void*)arr_elem);
996 ret->data[i] = arr_elem_conv;
998 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1002 static jclass LDKEvent_FundingGenerationReady_class = NULL;
1003 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
1004 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1005 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1006 static jclass LDKEvent_PaymentReceived_class = NULL;
1007 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1008 static jclass LDKEvent_PaymentSent_class = NULL;
1009 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1010 static jclass LDKEvent_PaymentFailed_class = NULL;
1011 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1012 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1013 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1014 static jclass LDKEvent_SpendableOutputs_class = NULL;
1015 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
1017 LDKEvent_FundingGenerationReady_class =
1018 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1019 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1020 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1021 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1022 LDKEvent_FundingBroadcastSafe_class =
1023 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1024 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1025 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1026 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1027 LDKEvent_PaymentReceived_class =
1028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1029 CHECK(LDKEvent_PaymentReceived_class != NULL);
1030 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1031 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1032 LDKEvent_PaymentSent_class =
1033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1034 CHECK(LDKEvent_PaymentSent_class != NULL);
1035 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1036 CHECK(LDKEvent_PaymentSent_meth != NULL);
1037 LDKEvent_PaymentFailed_class =
1038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1039 CHECK(LDKEvent_PaymentFailed_class != NULL);
1040 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1041 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1042 LDKEvent_PendingHTLCsForwardable_class =
1043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1044 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1045 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1046 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1047 LDKEvent_SpendableOutputs_class =
1048 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1049 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1050 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1051 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1053 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1054 LDKEvent *obj = (LDKEvent*)ptr;
1056 case LDKEvent_FundingGenerationReady: {
1057 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
1058 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1059 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1060 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
1061 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1062 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);
1064 case LDKEvent_FundingBroadcastSafe: {
1065 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1066 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1067 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1068 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1069 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1071 case LDKEvent_PaymentReceived: {
1072 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1073 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1074 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
1075 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1076 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1078 case LDKEvent_PaymentSent: {
1079 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
1080 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1081 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1083 case LDKEvent_PaymentFailed: {
1084 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1085 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1086 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1088 case LDKEvent_PendingHTLCsForwardable: {
1089 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1091 case LDKEvent_SpendableOutputs: {
1092 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1093 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
1094 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
1095 for (size_t b = 0; b < outputs_var.datalen; b++) {
1096 long arr_conv_27_ref = (long)&outputs_var.data[b];
1097 outputs_arr_ptr[b] = arr_conv_27_ref;
1099 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
1100 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1105 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1106 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1107 static jclass LDKErrorAction_IgnoreError_class = NULL;
1108 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1109 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1110 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
1112 LDKErrorAction_DisconnectPeer_class =
1113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1114 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1115 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1116 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1117 LDKErrorAction_IgnoreError_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1119 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1120 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1121 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1122 LDKErrorAction_SendErrorMessage_class =
1123 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1124 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1125 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1126 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1128 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1129 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1131 case LDKErrorAction_DisconnectPeer: {
1132 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1133 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1134 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1135 long msg_ref = (long)msg_var.inner & ~1;
1136 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1138 case LDKErrorAction_IgnoreError: {
1139 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1141 case LDKErrorAction_SendErrorMessage: {
1142 LDKErrorMessage msg_var = obj->send_error_message.msg;
1143 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1144 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1145 long msg_ref = (long)msg_var.inner & ~1;
1146 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1151 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1152 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1153 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1154 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1155 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1156 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1158 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1159 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1160 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1161 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1162 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1163 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1164 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1165 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1166 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1167 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1168 LDKHTLCFailChannelUpdate_NodeFailure_class =
1169 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1170 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1171 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1172 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1174 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1175 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1177 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1178 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1179 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1180 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1181 long msg_ref = (long)msg_var.inner & ~1;
1182 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1184 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1185 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1187 case LDKHTLCFailChannelUpdate_NodeFailure: {
1188 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1189 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1190 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1195 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1196 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1197 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1198 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1199 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1200 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1201 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1202 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1203 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1204 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1205 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1206 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1207 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1208 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1209 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1210 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1211 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1212 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1213 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1214 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1215 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1216 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1217 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1218 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1219 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1220 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1221 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1222 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1223 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1224 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1225 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1226 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1228 LDKMessageSendEvent_SendAcceptChannel_class =
1229 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1230 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1231 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1232 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1233 LDKMessageSendEvent_SendOpenChannel_class =
1234 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1235 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1236 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1237 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1238 LDKMessageSendEvent_SendFundingCreated_class =
1239 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1240 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1241 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1242 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1243 LDKMessageSendEvent_SendFundingSigned_class =
1244 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1245 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1246 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1247 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1248 LDKMessageSendEvent_SendFundingLocked_class =
1249 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1250 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1251 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1252 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1253 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1254 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1255 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1256 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1257 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1258 LDKMessageSendEvent_UpdateHTLCs_class =
1259 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1260 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1261 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1262 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1263 LDKMessageSendEvent_SendRevokeAndACK_class =
1264 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1265 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1266 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1267 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1268 LDKMessageSendEvent_SendClosingSigned_class =
1269 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1270 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1271 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1272 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1273 LDKMessageSendEvent_SendShutdown_class =
1274 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1275 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1276 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1277 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1278 LDKMessageSendEvent_SendChannelReestablish_class =
1279 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1280 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1281 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1282 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1283 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1284 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1285 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1286 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1287 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1288 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1289 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1290 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1291 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1292 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1293 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1294 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1295 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1296 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1297 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1298 LDKMessageSendEvent_HandleError_class =
1299 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1300 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1301 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1302 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1303 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1304 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1305 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1306 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1307 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1309 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1310 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1312 case LDKMessageSendEvent_SendAcceptChannel: {
1313 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1314 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1315 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1316 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1317 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1318 long msg_ref = (long)msg_var.inner & ~1;
1319 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1321 case LDKMessageSendEvent_SendOpenChannel: {
1322 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1323 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1324 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1325 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1326 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1327 long msg_ref = (long)msg_var.inner & ~1;
1328 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1330 case LDKMessageSendEvent_SendFundingCreated: {
1331 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1332 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1333 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1334 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1335 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1336 long msg_ref = (long)msg_var.inner & ~1;
1337 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1339 case LDKMessageSendEvent_SendFundingSigned: {
1340 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1341 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1342 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1343 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1344 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1345 long msg_ref = (long)msg_var.inner & ~1;
1346 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1348 case LDKMessageSendEvent_SendFundingLocked: {
1349 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1350 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1351 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1352 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1353 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1354 long msg_ref = (long)msg_var.inner & ~1;
1355 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1357 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1358 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1359 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1360 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1361 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1362 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1363 long msg_ref = (long)msg_var.inner & ~1;
1364 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1366 case LDKMessageSendEvent_UpdateHTLCs: {
1367 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1368 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1369 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1370 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1371 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1372 long updates_ref = (long)updates_var.inner & ~1;
1373 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1375 case LDKMessageSendEvent_SendRevokeAndACK: {
1376 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1377 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1378 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1379 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1380 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1381 long msg_ref = (long)msg_var.inner & ~1;
1382 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1384 case LDKMessageSendEvent_SendClosingSigned: {
1385 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1386 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1387 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1388 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1389 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1390 long msg_ref = (long)msg_var.inner & ~1;
1391 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1393 case LDKMessageSendEvent_SendShutdown: {
1394 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1395 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1396 LDKShutdown msg_var = obj->send_shutdown.msg;
1397 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1398 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1399 long msg_ref = (long)msg_var.inner & ~1;
1400 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1402 case LDKMessageSendEvent_SendChannelReestablish: {
1403 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1404 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1405 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1406 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1407 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1408 long msg_ref = (long)msg_var.inner & ~1;
1409 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1411 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1412 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1413 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1414 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1415 long msg_ref = (long)msg_var.inner & ~1;
1416 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1417 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1418 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1419 long update_msg_ref = (long)update_msg_var.inner & ~1;
1420 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1422 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1423 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1424 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1425 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1426 long msg_ref = (long)msg_var.inner & ~1;
1427 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1429 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1430 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1431 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1432 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1433 long msg_ref = (long)msg_var.inner & ~1;
1434 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1436 case LDKMessageSendEvent_HandleError: {
1437 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1438 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1439 long action_ref = (long)&obj->handle_error.action;
1440 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1442 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1443 long update_ref = (long)&obj->payment_failure_network_update.update;
1444 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1449 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1450 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1451 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1454 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1455 ret->datalen = (*env)->GetArrayLength(env, elems);
1456 if (ret->datalen == 0) {
1459 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1460 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1461 for (size_t i = 0; i < ret->datalen; i++) {
1462 jlong arr_elem = java_elems[i];
1463 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1464 FREE((void*)arr_elem);
1465 ret->data[i] = arr_elem_conv;
1467 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1471 typedef struct LDKMessageSendEventsProvider_JCalls {
1472 atomic_size_t refcnt;
1475 jmethodID get_and_clear_pending_msg_events_meth;
1476 } LDKMessageSendEventsProvider_JCalls;
1477 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1478 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_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 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1484 LDKCVec_MessageSendEventZ arg_constr;
1485 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1486 if (arg_constr.datalen > 0)
1487 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1489 arg_constr.data = NULL;
1490 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1491 for (size_t s = 0; s < arg_constr.datalen; s++) {
1492 long arr_conv_18 = arg_vals[s];
1493 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1494 FREE((void*)arr_conv_18);
1495 arg_constr.data[s] = arr_conv_18_conv;
1497 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1500 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1501 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1502 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1504 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1505 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1509 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1510 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1511 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1512 return (void*) this_arg;
1514 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1515 jclass c = (*env)->GetObjectClass(env, o);
1517 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1518 atomic_init(&calls->refcnt, 1);
1519 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1520 calls->o = (*env)->NewWeakGlobalRef(env, o);
1521 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1522 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1524 LDKMessageSendEventsProvider ret = {
1525 .this_arg = (void*) calls,
1526 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1527 .free = LDKMessageSendEventsProvider_JCalls_free,
1531 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1532 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1533 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1534 return (long)res_ptr;
1536 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1537 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1541 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1542 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1543 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1544 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1545 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1546 for (size_t s = 0; s < ret_var.datalen; s++) {
1547 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1548 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1549 long arr_conv_18_ref = (long)arr_conv_18_copy;
1550 ret_arr_ptr[s] = arr_conv_18_ref;
1552 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1553 CVec_MessageSendEventZ_free(ret_var);
1557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1558 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1559 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1562 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1563 ret->datalen = (*env)->GetArrayLength(env, elems);
1564 if (ret->datalen == 0) {
1567 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1568 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1569 for (size_t i = 0; i < ret->datalen; i++) {
1570 jlong arr_elem = java_elems[i];
1571 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1572 FREE((void*)arr_elem);
1573 ret->data[i] = arr_elem_conv;
1575 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1579 typedef struct LDKEventsProvider_JCalls {
1580 atomic_size_t refcnt;
1583 jmethodID get_and_clear_pending_events_meth;
1584 } LDKEventsProvider_JCalls;
1585 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1586 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1588 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1589 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1591 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1592 LDKCVec_EventZ arg_constr;
1593 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1594 if (arg_constr.datalen > 0)
1595 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1597 arg_constr.data = NULL;
1598 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1599 for (size_t h = 0; h < arg_constr.datalen; h++) {
1600 long arr_conv_7 = arg_vals[h];
1601 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1602 FREE((void*)arr_conv_7);
1603 arg_constr.data[h] = arr_conv_7_conv;
1605 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1608 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1609 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1610 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1612 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1613 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1617 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1618 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1619 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1620 return (void*) this_arg;
1622 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1623 jclass c = (*env)->GetObjectClass(env, o);
1625 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1626 atomic_init(&calls->refcnt, 1);
1627 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1628 calls->o = (*env)->NewWeakGlobalRef(env, o);
1629 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1630 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1632 LDKEventsProvider ret = {
1633 .this_arg = (void*) calls,
1634 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1635 .free = LDKEventsProvider_JCalls_free,
1639 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1640 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1641 *res_ptr = LDKEventsProvider_init(env, _a, o);
1642 return (long)res_ptr;
1644 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1645 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1649 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1650 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1651 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1652 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1653 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1654 for (size_t h = 0; h < ret_var.datalen; h++) {
1655 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1656 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1657 long arr_conv_7_ref = (long)arr_conv_7_copy;
1658 ret_arr_ptr[h] = arr_conv_7_ref;
1660 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1661 CVec_EventZ_free(ret_var);
1665 typedef struct LDKLogger_JCalls {
1666 atomic_size_t refcnt;
1671 void log_jcall(const void* this_arg, const char *record) {
1672 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1674 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1675 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1676 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1678 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1680 static void LDKLogger_JCalls_free(void* this_arg) {
1681 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1682 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1684 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1685 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1689 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1690 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1691 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1692 return (void*) this_arg;
1694 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1695 jclass c = (*env)->GetObjectClass(env, o);
1697 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1698 atomic_init(&calls->refcnt, 1);
1699 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1700 calls->o = (*env)->NewWeakGlobalRef(env, o);
1701 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1702 CHECK(calls->log_meth != NULL);
1705 .this_arg = (void*) calls,
1707 .free = LDKLogger_JCalls_free,
1711 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1712 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1713 *res_ptr = LDKLogger_init(env, _a, o);
1714 return (long)res_ptr;
1716 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1717 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1721 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1722 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1725 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1726 CHECK(val->result_ok);
1727 long res_ref = (long)&(*val->contents.result);
1730 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1731 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1732 CHECK(!val->result_ok);
1733 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1736 typedef struct LDKAccess_JCalls {
1737 atomic_size_t refcnt;
1740 jmethodID get_utxo_meth;
1742 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1743 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1745 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1746 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1747 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1748 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1750 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1751 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
1755 static void LDKAccess_JCalls_free(void* this_arg) {
1756 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1757 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1759 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1760 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1764 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1765 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1766 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1767 return (void*) this_arg;
1769 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1770 jclass c = (*env)->GetObjectClass(env, o);
1772 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1773 atomic_init(&calls->refcnt, 1);
1774 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1775 calls->o = (*env)->NewWeakGlobalRef(env, o);
1776 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1777 CHECK(calls->get_utxo_meth != NULL);
1780 .this_arg = (void*) calls,
1781 .get_utxo = get_utxo_jcall,
1782 .free = LDKAccess_JCalls_free,
1786 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1787 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1788 *res_ptr = LDKAccess_init(env, _a, o);
1789 return (long)res_ptr;
1791 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1792 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1796 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) {
1797 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1798 unsigned char genesis_hash_arr[32];
1799 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1800 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1801 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1802 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1803 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1804 return (long)ret_conv;
1807 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1808 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1809 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1810 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1811 for (size_t i = 0; i < vec->datalen; i++) {
1812 CHECK((((long)vec->data[i].inner) & 1) == 0);
1813 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1815 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1819 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1820 ret->datalen = (*env)->GetArrayLength(env, elems);
1821 if (ret->datalen == 0) {
1824 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1825 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1826 for (size_t i = 0; i < ret->datalen; i++) {
1827 jlong arr_elem = java_elems[i];
1828 LDKHTLCOutputInCommitment arr_elem_conv;
1829 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1830 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1831 if (arr_elem_conv.inner != NULL)
1832 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1833 ret->data[i] = arr_elem_conv;
1835 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1839 typedef struct LDKChannelKeys_JCalls {
1840 atomic_size_t refcnt;
1843 jmethodID get_per_commitment_point_meth;
1844 jmethodID release_commitment_secret_meth;
1845 jmethodID key_derivation_params_meth;
1846 jmethodID sign_counterparty_commitment_meth;
1847 jmethodID sign_holder_commitment_meth;
1848 jmethodID sign_holder_commitment_htlc_transactions_meth;
1849 jmethodID sign_justice_transaction_meth;
1850 jmethodID sign_counterparty_htlc_transaction_meth;
1851 jmethodID sign_closing_transaction_meth;
1852 jmethodID sign_channel_announcement_meth;
1853 jmethodID on_accept_meth;
1854 jmethodID write_meth;
1855 } LDKChannelKeys_JCalls;
1856 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1857 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1859 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1860 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1862 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1863 LDKPublicKey arg_ref;
1864 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1865 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1868 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1869 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1871 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1872 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1874 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1875 LDKThirtyTwoBytes arg_ref;
1876 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1877 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1880 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1881 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1883 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1884 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1886 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1887 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1891 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_jcall(const void* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs) {
1892 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1894 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1895 LDKTransaction commitment_tx_var = commitment_tx;
1896 jbyteArray commitment_tx_arr = (*_env)->NewByteArray(_env, commitment_tx_var.datalen);
1897 (*_env)->SetByteArrayRegion(_env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
1898 Transaction_free(commitment_tx_var);
1899 LDKPreCalculatedTxCreationKeys keys_var = *keys;
1900 if (keys->inner != NULL)
1901 keys_var = PreCalculatedTxCreationKeys_clone(keys);
1902 CHECK((((long)keys_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1903 CHECK((((long)&keys_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1904 long keys_ref = (long)keys_var.inner;
1905 if (keys_var.is_owned) {
1908 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1909 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1910 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1911 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1912 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1913 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1914 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1915 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1916 if (arr_conv_24_var.is_owned) {
1917 arr_conv_24_ref |= 1;
1919 htlcs_arr_ptr[y] = arr_conv_24_ref;
1921 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1922 FREE(htlcs_var.data);
1923 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1925 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_arr, keys_ref, htlcs_arr);
1926 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1930 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1931 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1933 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1934 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1935 if (holder_commitment_tx->inner != NULL)
1936 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1937 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1938 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1939 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner;
1940 if (holder_commitment_tx_var.is_owned) {
1941 holder_commitment_tx_ref |= 1;
1943 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1945 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx_ref);
1946 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1950 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1951 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1953 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1954 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1955 if (holder_commitment_tx->inner != NULL)
1956 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1957 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1958 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1959 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner;
1960 if (holder_commitment_tx_var.is_owned) {
1961 holder_commitment_tx_ref |= 1;
1963 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1965 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx_ref);
1966 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1970 LDKCResult_SignatureNoneZ sign_justice_transaction_jcall(const void* this_arg, LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const LDKHTLCOutputInCommitment *htlc) {
1971 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1973 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1974 LDKTransaction justice_tx_var = justice_tx;
1975 jbyteArray justice_tx_arr = (*_env)->NewByteArray(_env, justice_tx_var.datalen);
1976 (*_env)->SetByteArrayRegion(_env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1977 Transaction_free(justice_tx_var);
1978 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1979 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1980 LDKHTLCOutputInCommitment htlc_var = *htlc;
1981 if (htlc->inner != NULL)
1982 htlc_var = HTLCOutputInCommitment_clone(htlc);
1983 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1984 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1985 long htlc_ref = (long)htlc_var.inner;
1986 if (htlc_var.is_owned) {
1989 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1991 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);
1992 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1996 LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc) {
1997 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1999 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2000 LDKTransaction htlc_tx_var = htlc_tx;
2001 jbyteArray htlc_tx_arr = (*_env)->NewByteArray(_env, htlc_tx_var.datalen);
2002 (*_env)->SetByteArrayRegion(_env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2003 Transaction_free(htlc_tx_var);
2004 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
2005 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2006 LDKHTLCOutputInCommitment htlc_var = *htlc;
2007 if (htlc->inner != NULL)
2008 htlc_var = HTLCOutputInCommitment_clone(htlc);
2009 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2010 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2011 long htlc_ref = (long)htlc_var.inner;
2012 if (htlc_var.is_owned) {
2015 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2017 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);
2018 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2022 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
2023 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2025 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2026 LDKTransaction closing_tx_var = closing_tx;
2027 jbyteArray closing_tx_arr = (*_env)->NewByteArray(_env, closing_tx_var.datalen);
2028 (*_env)->SetByteArrayRegion(_env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2029 Transaction_free(closing_tx_var);
2030 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2032 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2033 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2037 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
2038 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2040 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2041 LDKUnsignedChannelAnnouncement msg_var = *msg;
2042 if (msg->inner != NULL)
2043 msg_var = UnsignedChannelAnnouncement_clone(msg);
2044 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2045 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2046 long msg_ref = (long)msg_var.inner;
2047 if (msg_var.is_owned) {
2050 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2052 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2053 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2057 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
2058 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2060 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2061 LDKChannelPublicKeys channel_points_var = *channel_points;
2062 if (channel_points->inner != NULL)
2063 channel_points_var = ChannelPublicKeys_clone(channel_points);
2064 CHECK((((long)channel_points_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2065 CHECK((((long)&channel_points_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2066 long channel_points_ref = (long)channel_points_var.inner;
2067 if (channel_points_var.is_owned) {
2068 channel_points_ref |= 1;
2070 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2072 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points_ref, counterparty_selected_contest_delay, holder_selected_contest_delay);
2074 LDKCVec_u8Z write_jcall(const void* this_arg) {
2075 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2077 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2078 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2080 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->write_meth);
2081 LDKCVec_u8Z arg_ref;
2082 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2083 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2084 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
2087 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2088 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2089 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2091 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2092 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2096 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2097 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2098 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2099 return (void*) this_arg;
2101 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2102 jclass c = (*env)->GetObjectClass(env, o);
2104 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2105 atomic_init(&calls->refcnt, 1);
2106 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2107 calls->o = (*env)->NewWeakGlobalRef(env, o);
2108 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2109 CHECK(calls->get_per_commitment_point_meth != NULL);
2110 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2111 CHECK(calls->release_commitment_secret_meth != NULL);
2112 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2113 CHECK(calls->key_derivation_params_meth != NULL);
2114 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(I[BJ[J)J");
2115 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2116 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2117 CHECK(calls->sign_holder_commitment_meth != NULL);
2118 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2119 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2120 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2121 CHECK(calls->sign_justice_transaction_meth != NULL);
2122 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2123 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2124 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2125 CHECK(calls->sign_closing_transaction_meth != NULL);
2126 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2127 CHECK(calls->sign_channel_announcement_meth != NULL);
2128 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2129 CHECK(calls->on_accept_meth != NULL);
2131 LDKChannelPublicKeys pubkeys_conv;
2132 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2133 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2134 if (pubkeys_conv.inner != NULL)
2135 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2137 LDKChannelKeys ret = {
2138 .this_arg = (void*) calls,
2139 .get_per_commitment_point = get_per_commitment_point_jcall,
2140 .release_commitment_secret = release_commitment_secret_jcall,
2141 .key_derivation_params = key_derivation_params_jcall,
2142 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2143 .sign_holder_commitment = sign_holder_commitment_jcall,
2144 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2145 .sign_justice_transaction = sign_justice_transaction_jcall,
2146 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2147 .sign_closing_transaction = sign_closing_transaction_jcall,
2148 .sign_channel_announcement = sign_channel_announcement_jcall,
2149 .on_accept = on_accept_jcall,
2150 .clone = LDKChannelKeys_JCalls_clone,
2151 .write = write_jcall,
2152 .free = LDKChannelKeys_JCalls_free,
2153 .pubkeys = pubkeys_conv,
2154 .set_pubkeys = NULL,
2158 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2159 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2160 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
2161 return (long)res_ptr;
2163 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2164 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2168 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2169 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2170 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2171 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2175 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2176 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2177 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2178 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2183 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2184 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2185 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2186 return (long)ret_ref;
2189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jbyteArray commitment_tx, jlong keys, jlongArray htlcs) {
2190 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2191 LDKTransaction commitment_tx_ref;
2192 commitment_tx_ref.datalen = (*_env)->GetArrayLength (_env, commitment_tx);
2193 commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
2194 (*_env)->GetByteArrayRegion(_env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
2195 commitment_tx_ref.data_is_owned = true;
2196 LDKPreCalculatedTxCreationKeys keys_conv;
2197 keys_conv.inner = (void*)(keys & (~1));
2198 keys_conv.is_owned = false;
2199 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2200 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2201 if (htlcs_constr.datalen > 0)
2202 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2204 htlcs_constr.data = NULL;
2205 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2206 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2207 long arr_conv_24 = htlcs_vals[y];
2208 LDKHTLCOutputInCommitment arr_conv_24_conv;
2209 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2210 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2211 if (arr_conv_24_conv.inner != NULL)
2212 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2213 htlcs_constr.data[y] = arr_conv_24_conv;
2215 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2216 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2217 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_ref, &keys_conv, htlcs_constr);
2218 return (long)ret_conv;
2221 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2222 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2223 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2224 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2225 holder_commitment_tx_conv.is_owned = false;
2226 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2227 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2228 return (long)ret_conv;
2231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment_1htlc_1transactions(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2232 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2233 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2234 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2235 holder_commitment_tx_conv.is_owned = false;
2236 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2237 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2238 return (long)ret_conv;
2241 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) {
2242 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2243 LDKTransaction justice_tx_ref;
2244 justice_tx_ref.datalen = (*_env)->GetArrayLength (_env, justice_tx);
2245 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2246 (*_env)->GetByteArrayRegion(_env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2247 justice_tx_ref.data_is_owned = true;
2248 unsigned char per_commitment_key_arr[32];
2249 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2250 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2251 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2252 LDKHTLCOutputInCommitment htlc_conv;
2253 htlc_conv.inner = (void*)(htlc & (~1));
2254 htlc_conv.is_owned = false;
2255 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2256 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2257 return (long)ret_conv;
2260 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) {
2261 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2262 LDKTransaction htlc_tx_ref;
2263 htlc_tx_ref.datalen = (*_env)->GetArrayLength (_env, htlc_tx);
2264 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2265 (*_env)->GetByteArrayRegion(_env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2266 htlc_tx_ref.data_is_owned = true;
2267 LDKPublicKey per_commitment_point_ref;
2268 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2269 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2270 LDKHTLCOutputInCommitment htlc_conv;
2271 htlc_conv.inner = (void*)(htlc & (~1));
2272 htlc_conv.is_owned = false;
2273 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2274 *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);
2275 return (long)ret_conv;
2278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray closing_tx) {
2279 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2280 LDKTransaction closing_tx_ref;
2281 closing_tx_ref.datalen = (*_env)->GetArrayLength (_env, closing_tx);
2282 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2283 (*_env)->GetByteArrayRegion(_env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2284 closing_tx_ref.data_is_owned = true;
2285 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2286 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2287 return (long)ret_conv;
2290 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2291 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2292 LDKUnsignedChannelAnnouncement msg_conv;
2293 msg_conv.inner = (void*)(msg & (~1));
2294 msg_conv.is_owned = false;
2295 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2296 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2297 return (long)ret_conv;
2300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1on_1accept(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_points, jshort counterparty_selected_contest_delay, jshort holder_selected_contest_delay) {
2301 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2302 LDKChannelPublicKeys channel_points_conv;
2303 channel_points_conv.inner = (void*)(channel_points & (~1));
2304 channel_points_conv.is_owned = false;
2305 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2308 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1write(JNIEnv * _env, jclass _b, jlong this_arg) {
2309 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2310 LDKCVec_u8Z arg_var = (this_arg_conv->write)(this_arg_conv->this_arg);
2311 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2312 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2313 CVec_u8Z_free(arg_var);
2317 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2318 if (this_arg->set_pubkeys != NULL)
2319 this_arg->set_pubkeys(this_arg);
2320 return this_arg->pubkeys;
2322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2323 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2324 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2325 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2326 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2327 long ret_ref = (long)ret_var.inner;
2328 if (ret_var.is_owned) {
2334 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2335 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2336 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2337 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2338 for (size_t i = 0; i < vec->datalen; i++) {
2339 CHECK((((long)vec->data[i].inner) & 1) == 0);
2340 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2342 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2346 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2347 ret->datalen = (*env)->GetArrayLength(env, elems);
2348 if (ret->datalen == 0) {
2351 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2352 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2353 for (size_t i = 0; i < ret->datalen; i++) {
2354 jlong arr_elem = java_elems[i];
2355 LDKMonitorEvent arr_elem_conv;
2356 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2357 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2358 if (arr_elem_conv.inner != NULL)
2359 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2360 ret->data[i] = arr_elem_conv;
2362 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2366 typedef struct LDKWatch_JCalls {
2367 atomic_size_t refcnt;
2370 jmethodID watch_channel_meth;
2371 jmethodID update_channel_meth;
2372 jmethodID release_pending_monitor_events_meth;
2374 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2375 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2377 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2378 LDKOutPoint funding_txo_var = funding_txo;
2379 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2380 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2381 long funding_txo_ref = (long)funding_txo_var.inner;
2382 if (funding_txo_var.is_owned) {
2383 funding_txo_ref |= 1;
2385 LDKChannelMonitor monitor_var = monitor;
2386 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2387 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2388 long monitor_ref = (long)monitor_var.inner;
2389 if (monitor_var.is_owned) {
2392 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2394 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2395 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2399 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2400 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2402 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2403 LDKOutPoint funding_txo_var = funding_txo;
2404 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2405 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2406 long funding_txo_ref = (long)funding_txo_var.inner;
2407 if (funding_txo_var.is_owned) {
2408 funding_txo_ref |= 1;
2410 LDKChannelMonitorUpdate update_var = update;
2411 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2412 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2413 long update_ref = (long)update_var.inner;
2414 if (update_var.is_owned) {
2417 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2419 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2420 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2424 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2425 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2427 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2428 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2430 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2431 LDKCVec_MonitorEventZ arg_constr;
2432 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2433 if (arg_constr.datalen > 0)
2434 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2436 arg_constr.data = NULL;
2437 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2438 for (size_t o = 0; o < arg_constr.datalen; o++) {
2439 long arr_conv_14 = arg_vals[o];
2440 LDKMonitorEvent arr_conv_14_conv;
2441 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2442 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2443 if (arr_conv_14_conv.inner != NULL)
2444 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2445 arg_constr.data[o] = arr_conv_14_conv;
2447 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2450 static void LDKWatch_JCalls_free(void* this_arg) {
2451 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2452 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2454 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2455 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2459 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2460 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2461 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2462 return (void*) this_arg;
2464 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2465 jclass c = (*env)->GetObjectClass(env, o);
2467 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2468 atomic_init(&calls->refcnt, 1);
2469 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2470 calls->o = (*env)->NewWeakGlobalRef(env, o);
2471 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2472 CHECK(calls->watch_channel_meth != NULL);
2473 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2474 CHECK(calls->update_channel_meth != NULL);
2475 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2476 CHECK(calls->release_pending_monitor_events_meth != NULL);
2479 .this_arg = (void*) calls,
2480 .watch_channel = watch_channel_jcall,
2481 .update_channel = update_channel_jcall,
2482 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2483 .free = LDKWatch_JCalls_free,
2487 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2488 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2489 *res_ptr = LDKWatch_init(env, _a, o);
2490 return (long)res_ptr;
2492 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2493 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2498 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2499 LDKOutPoint funding_txo_conv;
2500 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2501 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2502 if (funding_txo_conv.inner != NULL)
2503 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2504 LDKChannelMonitor monitor_conv;
2505 monitor_conv.inner = (void*)(monitor & (~1));
2506 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2507 // Warning: we may need a move here but can't clone!
2508 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2509 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2510 return (long)ret_conv;
2513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2514 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2515 LDKOutPoint funding_txo_conv;
2516 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2517 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2518 if (funding_txo_conv.inner != NULL)
2519 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2520 LDKChannelMonitorUpdate update_conv;
2521 update_conv.inner = (void*)(update & (~1));
2522 update_conv.is_owned = (update & 1) || (update == 0);
2523 if (update_conv.inner != NULL)
2524 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2525 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2526 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2527 return (long)ret_conv;
2530 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2531 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2532 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2533 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2534 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2535 for (size_t o = 0; o < ret_var.datalen; o++) {
2536 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2537 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2538 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2539 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2540 if (arr_conv_14_var.is_owned) {
2541 arr_conv_14_ref |= 1;
2543 ret_arr_ptr[o] = arr_conv_14_ref;
2545 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2550 typedef struct LDKFilter_JCalls {
2551 atomic_size_t refcnt;
2554 jmethodID register_tx_meth;
2555 jmethodID register_output_meth;
2557 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2558 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2560 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2561 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2562 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2563 LDKu8slice script_pubkey_var = script_pubkey;
2564 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2565 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2566 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2568 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2570 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2571 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2573 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2574 LDKOutPoint outpoint_var = *outpoint;
2575 if (outpoint->inner != NULL)
2576 outpoint_var = OutPoint_clone(outpoint);
2577 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2578 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2579 long outpoint_ref = (long)outpoint_var.inner;
2580 if (outpoint_var.is_owned) {
2583 LDKu8slice script_pubkey_var = script_pubkey;
2584 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2585 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2586 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2588 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
2590 static void LDKFilter_JCalls_free(void* this_arg) {
2591 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2592 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2594 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2595 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2599 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2600 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2601 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2602 return (void*) this_arg;
2604 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2605 jclass c = (*env)->GetObjectClass(env, o);
2607 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2608 atomic_init(&calls->refcnt, 1);
2609 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2610 calls->o = (*env)->NewWeakGlobalRef(env, o);
2611 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2612 CHECK(calls->register_tx_meth != NULL);
2613 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2614 CHECK(calls->register_output_meth != NULL);
2617 .this_arg = (void*) calls,
2618 .register_tx = register_tx_jcall,
2619 .register_output = register_output_jcall,
2620 .free = LDKFilter_JCalls_free,
2624 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2625 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2626 *res_ptr = LDKFilter_init(env, _a, o);
2627 return (long)res_ptr;
2629 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2630 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2635 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2636 unsigned char txid_arr[32];
2637 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2638 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2639 unsigned char (*txid_ref)[32] = &txid_arr;
2640 LDKu8slice script_pubkey_ref;
2641 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2642 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2643 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2644 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2648 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2649 LDKOutPoint outpoint_conv;
2650 outpoint_conv.inner = (void*)(outpoint & (~1));
2651 outpoint_conv.is_owned = false;
2652 LDKu8slice script_pubkey_ref;
2653 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2654 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2655 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2656 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2659 typedef struct LDKBroadcasterInterface_JCalls {
2660 atomic_size_t refcnt;
2663 jmethodID broadcast_transaction_meth;
2664 } LDKBroadcasterInterface_JCalls;
2665 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2666 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2668 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2669 LDKTransaction tx_var = tx;
2670 jbyteArray tx_arr = (*_env)->NewByteArray(_env, tx_var.datalen);
2671 (*_env)->SetByteArrayRegion(_env, tx_arr, 0, tx_var.datalen, tx_var.data);
2672 Transaction_free(tx_var);
2673 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2675 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2677 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2678 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2679 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2681 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2682 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2686 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2687 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2688 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2689 return (void*) this_arg;
2691 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2692 jclass c = (*env)->GetObjectClass(env, o);
2694 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2695 atomic_init(&calls->refcnt, 1);
2696 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2697 calls->o = (*env)->NewWeakGlobalRef(env, o);
2698 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2699 CHECK(calls->broadcast_transaction_meth != NULL);
2701 LDKBroadcasterInterface ret = {
2702 .this_arg = (void*) calls,
2703 .broadcast_transaction = broadcast_transaction_jcall,
2704 .free = LDKBroadcasterInterface_JCalls_free,
2708 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2709 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2710 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2711 return (long)res_ptr;
2713 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2714 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray tx) {
2719 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2720 LDKTransaction tx_ref;
2721 tx_ref.datalen = (*_env)->GetArrayLength (_env, tx);
2722 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2723 (*_env)->GetByteArrayRegion(_env, tx, 0, tx_ref.datalen, tx_ref.data);
2724 tx_ref.data_is_owned = true;
2725 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2728 typedef struct LDKFeeEstimator_JCalls {
2729 atomic_size_t refcnt;
2732 jmethodID get_est_sat_per_1000_weight_meth;
2733 } LDKFeeEstimator_JCalls;
2734 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2735 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2737 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2738 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2739 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2741 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2743 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2744 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2745 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2747 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2748 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2752 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2753 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2754 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2755 return (void*) this_arg;
2757 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2758 jclass c = (*env)->GetObjectClass(env, o);
2760 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2761 atomic_init(&calls->refcnt, 1);
2762 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2763 calls->o = (*env)->NewWeakGlobalRef(env, o);
2764 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2765 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2767 LDKFeeEstimator ret = {
2768 .this_arg = (void*) calls,
2769 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2770 .free = LDKFeeEstimator_JCalls_free,
2774 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2775 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2776 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2777 return (long)res_ptr;
2779 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2780 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2784 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) {
2785 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2786 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2787 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2791 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2792 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2793 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2796 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2797 ret->datalen = (*env)->GetArrayLength(env, elems);
2798 if (ret->datalen == 0) {
2801 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2802 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2803 for (size_t i = 0; i < ret->datalen; i++) {
2804 jlong arr_elem = java_elems[i];
2805 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2806 FREE((void*)arr_elem);
2807 ret->data[i] = arr_elem_conv;
2809 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2813 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2814 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2815 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2817 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2818 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2819 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2822 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2823 ret->datalen = (*env)->GetArrayLength(env, elems);
2824 if (ret->datalen == 0) {
2827 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2828 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2829 for (size_t i = 0; i < ret->datalen; i++) {
2830 jlong arr_elem = java_elems[i];
2831 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2832 FREE((void*)arr_elem);
2833 ret->data[i] = arr_elem_conv;
2835 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2839 typedef struct LDKKeysInterface_JCalls {
2840 atomic_size_t refcnt;
2843 jmethodID get_node_secret_meth;
2844 jmethodID get_destination_script_meth;
2845 jmethodID get_shutdown_pubkey_meth;
2846 jmethodID get_channel_keys_meth;
2847 jmethodID get_secure_random_bytes_meth;
2848 } LDKKeysInterface_JCalls;
2849 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2850 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2852 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2853 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2855 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2856 LDKSecretKey arg_ref;
2857 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2858 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2861 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2862 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2864 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2865 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2867 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2868 LDKCVec_u8Z arg_ref;
2869 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2870 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2871 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
2874 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2875 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2877 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2878 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2880 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2881 LDKPublicKey arg_ref;
2882 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2883 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2886 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2887 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2889 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2890 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2892 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2893 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2894 ret_conv = ChannelKeys_clone(ret);
2897 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2898 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2900 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2901 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2903 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2904 LDKThirtyTwoBytes arg_ref;
2905 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2906 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2909 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2910 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2911 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2913 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2914 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2918 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2919 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2920 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2921 return (void*) this_arg;
2923 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2924 jclass c = (*env)->GetObjectClass(env, o);
2926 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2927 atomic_init(&calls->refcnt, 1);
2928 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2929 calls->o = (*env)->NewWeakGlobalRef(env, o);
2930 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2931 CHECK(calls->get_node_secret_meth != NULL);
2932 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2933 CHECK(calls->get_destination_script_meth != NULL);
2934 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2935 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2936 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2937 CHECK(calls->get_channel_keys_meth != NULL);
2938 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2939 CHECK(calls->get_secure_random_bytes_meth != NULL);
2941 LDKKeysInterface ret = {
2942 .this_arg = (void*) calls,
2943 .get_node_secret = get_node_secret_jcall,
2944 .get_destination_script = get_destination_script_jcall,
2945 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2946 .get_channel_keys = get_channel_keys_jcall,
2947 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2948 .free = LDKKeysInterface_JCalls_free,
2952 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2953 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2954 *res_ptr = LDKKeysInterface_init(env, _a, o);
2955 return (long)res_ptr;
2957 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2958 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2962 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2963 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2964 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2965 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2969 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2970 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2971 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2972 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2973 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2974 CVec_u8Z_free(arg_var);
2978 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2979 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2980 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2981 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2985 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) {
2986 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2987 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2988 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2992 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2993 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2994 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2995 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2999 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3000 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
3001 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3002 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3003 for (size_t i = 0; i < vec->datalen; i++) {
3004 CHECK((((long)vec->data[i].inner) & 1) == 0);
3005 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3007 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3010 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
3011 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
3012 ret->datalen = (*env)->GetArrayLength(env, elems);
3013 if (ret->datalen == 0) {
3016 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
3017 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3018 for (size_t i = 0; i < ret->datalen; i++) {
3019 jlong arr_elem = java_elems[i];
3020 LDKChannelDetails arr_elem_conv;
3021 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3022 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3023 if (arr_elem_conv.inner != NULL)
3024 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
3025 ret->data[i] = arr_elem_conv;
3027 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3031 static jclass LDKNetAddress_IPv4_class = NULL;
3032 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3033 static jclass LDKNetAddress_IPv6_class = NULL;
3034 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3035 static jclass LDKNetAddress_OnionV2_class = NULL;
3036 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3037 static jclass LDKNetAddress_OnionV3_class = NULL;
3038 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
3040 LDKNetAddress_IPv4_class =
3041 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3042 CHECK(LDKNetAddress_IPv4_class != NULL);
3043 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3044 CHECK(LDKNetAddress_IPv4_meth != NULL);
3045 LDKNetAddress_IPv6_class =
3046 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3047 CHECK(LDKNetAddress_IPv6_class != NULL);
3048 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3049 CHECK(LDKNetAddress_IPv6_meth != NULL);
3050 LDKNetAddress_OnionV2_class =
3051 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3052 CHECK(LDKNetAddress_OnionV2_class != NULL);
3053 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3054 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3055 LDKNetAddress_OnionV3_class =
3056 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3057 CHECK(LDKNetAddress_OnionV3_class != NULL);
3058 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3059 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3061 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
3062 LDKNetAddress *obj = (LDKNetAddress*)ptr;
3064 case LDKNetAddress_IPv4: {
3065 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
3066 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3067 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3069 case LDKNetAddress_IPv6: {
3070 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
3071 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3072 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3074 case LDKNetAddress_OnionV2: {
3075 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
3076 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3077 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3079 case LDKNetAddress_OnionV3: {
3080 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
3081 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3082 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);
3087 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3088 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
3089 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
3091 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
3092 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
3093 ret->datalen = (*env)->GetArrayLength(env, elems);
3094 if (ret->datalen == 0) {
3097 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
3098 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3099 for (size_t i = 0; i < ret->datalen; i++) {
3100 jlong arr_elem = java_elems[i];
3101 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
3102 FREE((void*)arr_elem);
3103 ret->data[i] = arr_elem_conv;
3105 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3109 typedef struct LDKChannelMessageHandler_JCalls {
3110 atomic_size_t refcnt;
3113 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3114 jmethodID handle_open_channel_meth;
3115 jmethodID handle_accept_channel_meth;
3116 jmethodID handle_funding_created_meth;
3117 jmethodID handle_funding_signed_meth;
3118 jmethodID handle_funding_locked_meth;
3119 jmethodID handle_shutdown_meth;
3120 jmethodID handle_closing_signed_meth;
3121 jmethodID handle_update_add_htlc_meth;
3122 jmethodID handle_update_fulfill_htlc_meth;
3123 jmethodID handle_update_fail_htlc_meth;
3124 jmethodID handle_update_fail_malformed_htlc_meth;
3125 jmethodID handle_commitment_signed_meth;
3126 jmethodID handle_revoke_and_ack_meth;
3127 jmethodID handle_update_fee_meth;
3128 jmethodID handle_announcement_signatures_meth;
3129 jmethodID peer_disconnected_meth;
3130 jmethodID peer_connected_meth;
3131 jmethodID handle_channel_reestablish_meth;
3132 jmethodID handle_error_meth;
3133 } LDKChannelMessageHandler_JCalls;
3134 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
3135 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3137 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3138 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3139 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3140 LDKInitFeatures their_features_var = their_features;
3141 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3142 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3143 long their_features_ref = (long)their_features_var.inner;
3144 if (their_features_var.is_owned) {
3145 their_features_ref |= 1;
3147 LDKOpenChannel msg_var = *msg;
3148 if (msg->inner != NULL)
3149 msg_var = OpenChannel_clone(msg);
3150 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3151 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3152 long msg_ref = (long)msg_var.inner;
3153 if (msg_var.is_owned) {
3156 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3158 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3160 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3161 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3163 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3164 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3165 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3166 LDKInitFeatures their_features_var = their_features;
3167 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3168 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3169 long their_features_ref = (long)their_features_var.inner;
3170 if (their_features_var.is_owned) {
3171 their_features_ref |= 1;
3173 LDKAcceptChannel msg_var = *msg;
3174 if (msg->inner != NULL)
3175 msg_var = AcceptChannel_clone(msg);
3176 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3177 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3178 long msg_ref = (long)msg_var.inner;
3179 if (msg_var.is_owned) {
3182 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3184 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3186 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3187 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3189 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3190 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3191 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3192 LDKFundingCreated msg_var = *msg;
3193 if (msg->inner != NULL)
3194 msg_var = FundingCreated_clone(msg);
3195 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3196 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3197 long msg_ref = (long)msg_var.inner;
3198 if (msg_var.is_owned) {
3201 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3203 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
3205 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3206 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3208 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3209 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3210 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3211 LDKFundingSigned msg_var = *msg;
3212 if (msg->inner != NULL)
3213 msg_var = FundingSigned_clone(msg);
3214 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3215 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3216 long msg_ref = (long)msg_var.inner;
3217 if (msg_var.is_owned) {
3220 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3222 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
3224 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3225 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3227 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3228 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3229 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3230 LDKFundingLocked msg_var = *msg;
3231 if (msg->inner != NULL)
3232 msg_var = FundingLocked_clone(msg);
3233 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3234 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3235 long msg_ref = (long)msg_var.inner;
3236 if (msg_var.is_owned) {
3239 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3241 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
3243 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3244 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3246 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3247 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3248 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3249 LDKShutdown msg_var = *msg;
3250 if (msg->inner != NULL)
3251 msg_var = Shutdown_clone(msg);
3252 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3253 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3254 long msg_ref = (long)msg_var.inner;
3255 if (msg_var.is_owned) {
3258 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3260 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
3262 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3263 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3265 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3266 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3267 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3268 LDKClosingSigned msg_var = *msg;
3269 if (msg->inner != NULL)
3270 msg_var = ClosingSigned_clone(msg);
3271 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3272 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3273 long msg_ref = (long)msg_var.inner;
3274 if (msg_var.is_owned) {
3277 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3279 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
3281 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3282 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3284 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3285 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3286 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3287 LDKUpdateAddHTLC msg_var = *msg;
3288 if (msg->inner != NULL)
3289 msg_var = UpdateAddHTLC_clone(msg);
3290 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3291 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3292 long msg_ref = (long)msg_var.inner;
3293 if (msg_var.is_owned) {
3296 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3298 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
3300 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3301 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3303 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3304 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3305 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3306 LDKUpdateFulfillHTLC msg_var = *msg;
3307 if (msg->inner != NULL)
3308 msg_var = UpdateFulfillHTLC_clone(msg);
3309 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3310 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3311 long msg_ref = (long)msg_var.inner;
3312 if (msg_var.is_owned) {
3315 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3317 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
3319 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3320 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3322 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3323 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3324 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3325 LDKUpdateFailHTLC msg_var = *msg;
3326 if (msg->inner != NULL)
3327 msg_var = UpdateFailHTLC_clone(msg);
3328 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3329 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3330 long msg_ref = (long)msg_var.inner;
3331 if (msg_var.is_owned) {
3334 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3336 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
3338 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3339 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3341 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3342 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3343 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3344 LDKUpdateFailMalformedHTLC msg_var = *msg;
3345 if (msg->inner != NULL)
3346 msg_var = UpdateFailMalformedHTLC_clone(msg);
3347 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3348 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3349 long msg_ref = (long)msg_var.inner;
3350 if (msg_var.is_owned) {
3353 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3355 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
3357 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3358 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3360 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3361 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3362 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3363 LDKCommitmentSigned msg_var = *msg;
3364 if (msg->inner != NULL)
3365 msg_var = CommitmentSigned_clone(msg);
3366 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3367 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3368 long msg_ref = (long)msg_var.inner;
3369 if (msg_var.is_owned) {
3372 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3374 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
3376 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3377 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3379 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3380 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3381 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3382 LDKRevokeAndACK msg_var = *msg;
3383 if (msg->inner != NULL)
3384 msg_var = RevokeAndACK_clone(msg);
3385 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3386 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3387 long msg_ref = (long)msg_var.inner;
3388 if (msg_var.is_owned) {
3391 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3393 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
3395 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3396 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3398 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3399 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3400 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3401 LDKUpdateFee msg_var = *msg;
3402 if (msg->inner != NULL)
3403 msg_var = UpdateFee_clone(msg);
3404 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3405 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3406 long msg_ref = (long)msg_var.inner;
3407 if (msg_var.is_owned) {
3410 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3412 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
3414 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3415 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3417 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3418 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3419 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3420 LDKAnnouncementSignatures msg_var = *msg;
3421 if (msg->inner != NULL)
3422 msg_var = AnnouncementSignatures_clone(msg);
3423 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3424 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3425 long msg_ref = (long)msg_var.inner;
3426 if (msg_var.is_owned) {
3429 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3431 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
3433 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3434 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3436 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3437 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3438 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3439 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3441 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3443 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3444 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3446 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3447 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3448 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3449 LDKInit msg_var = *msg;
3450 if (msg->inner != NULL)
3451 msg_var = Init_clone(msg);
3452 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3453 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3454 long msg_ref = (long)msg_var.inner;
3455 if (msg_var.is_owned) {
3458 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3460 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
3462 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3463 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3465 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3466 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3467 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3468 LDKChannelReestablish msg_var = *msg;
3469 if (msg->inner != NULL)
3470 msg_var = ChannelReestablish_clone(msg);
3471 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3472 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3473 long msg_ref = (long)msg_var.inner;
3474 if (msg_var.is_owned) {
3477 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3479 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
3481 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3482 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3484 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3485 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3486 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3487 LDKErrorMessage msg_var = *msg;
3488 if (msg->inner != NULL)
3489 msg_var = ErrorMessage_clone(msg);
3490 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3491 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3492 long msg_ref = (long)msg_var.inner;
3493 if (msg_var.is_owned) {
3496 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3498 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
3500 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3501 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3502 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3504 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3505 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3509 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3510 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3511 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3512 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3513 return (void*) this_arg;
3515 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3516 jclass c = (*env)->GetObjectClass(env, o);
3518 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3519 atomic_init(&calls->refcnt, 1);
3520 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3521 calls->o = (*env)->NewWeakGlobalRef(env, o);
3522 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3523 CHECK(calls->handle_open_channel_meth != NULL);
3524 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3525 CHECK(calls->handle_accept_channel_meth != NULL);
3526 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3527 CHECK(calls->handle_funding_created_meth != NULL);
3528 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3529 CHECK(calls->handle_funding_signed_meth != NULL);
3530 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3531 CHECK(calls->handle_funding_locked_meth != NULL);
3532 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3533 CHECK(calls->handle_shutdown_meth != NULL);
3534 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3535 CHECK(calls->handle_closing_signed_meth != NULL);
3536 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3537 CHECK(calls->handle_update_add_htlc_meth != NULL);
3538 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3539 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3540 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3541 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3542 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3543 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3544 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3545 CHECK(calls->handle_commitment_signed_meth != NULL);
3546 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3547 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3548 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3549 CHECK(calls->handle_update_fee_meth != NULL);
3550 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3551 CHECK(calls->handle_announcement_signatures_meth != NULL);
3552 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3553 CHECK(calls->peer_disconnected_meth != NULL);
3554 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3555 CHECK(calls->peer_connected_meth != NULL);
3556 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3557 CHECK(calls->handle_channel_reestablish_meth != NULL);
3558 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3559 CHECK(calls->handle_error_meth != NULL);
3561 LDKChannelMessageHandler ret = {
3562 .this_arg = (void*) calls,
3563 .handle_open_channel = handle_open_channel_jcall,
3564 .handle_accept_channel = handle_accept_channel_jcall,
3565 .handle_funding_created = handle_funding_created_jcall,
3566 .handle_funding_signed = handle_funding_signed_jcall,
3567 .handle_funding_locked = handle_funding_locked_jcall,
3568 .handle_shutdown = handle_shutdown_jcall,
3569 .handle_closing_signed = handle_closing_signed_jcall,
3570 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3571 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3572 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3573 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3574 .handle_commitment_signed = handle_commitment_signed_jcall,
3575 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3576 .handle_update_fee = handle_update_fee_jcall,
3577 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3578 .peer_disconnected = peer_disconnected_jcall,
3579 .peer_connected = peer_connected_jcall,
3580 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3581 .handle_error = handle_error_jcall,
3582 .free = LDKChannelMessageHandler_JCalls_free,
3583 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3585 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3588 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3589 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3590 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3591 return (long)res_ptr;
3593 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3594 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3598 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) {
3599 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3600 LDKPublicKey their_node_id_ref;
3601 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3602 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3603 LDKInitFeatures their_features_conv;
3604 their_features_conv.inner = (void*)(their_features & (~1));
3605 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3606 // Warning: we may need a move here but can't clone!
3607 LDKOpenChannel msg_conv;
3608 msg_conv.inner = (void*)(msg & (~1));
3609 msg_conv.is_owned = false;
3610 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3613 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) {
3614 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3615 LDKPublicKey their_node_id_ref;
3616 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3617 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3618 LDKInitFeatures their_features_conv;
3619 their_features_conv.inner = (void*)(their_features & (~1));
3620 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3621 // Warning: we may need a move here but can't clone!
3622 LDKAcceptChannel msg_conv;
3623 msg_conv.inner = (void*)(msg & (~1));
3624 msg_conv.is_owned = false;
3625 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3628 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) {
3629 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3630 LDKPublicKey their_node_id_ref;
3631 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3632 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3633 LDKFundingCreated msg_conv;
3634 msg_conv.inner = (void*)(msg & (~1));
3635 msg_conv.is_owned = false;
3636 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3639 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) {
3640 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3641 LDKPublicKey their_node_id_ref;
3642 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3643 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3644 LDKFundingSigned msg_conv;
3645 msg_conv.inner = (void*)(msg & (~1));
3646 msg_conv.is_owned = false;
3647 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3650 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) {
3651 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3652 LDKPublicKey their_node_id_ref;
3653 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3654 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3655 LDKFundingLocked msg_conv;
3656 msg_conv.inner = (void*)(msg & (~1));
3657 msg_conv.is_owned = false;
3658 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3662 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3663 LDKPublicKey their_node_id_ref;
3664 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3665 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3666 LDKShutdown msg_conv;
3667 msg_conv.inner = (void*)(msg & (~1));
3668 msg_conv.is_owned = false;
3669 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3672 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) {
3673 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3674 LDKPublicKey their_node_id_ref;
3675 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3676 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3677 LDKClosingSigned msg_conv;
3678 msg_conv.inner = (void*)(msg & (~1));
3679 msg_conv.is_owned = false;
3680 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3683 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) {
3684 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3685 LDKPublicKey their_node_id_ref;
3686 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3687 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3688 LDKUpdateAddHTLC msg_conv;
3689 msg_conv.inner = (void*)(msg & (~1));
3690 msg_conv.is_owned = false;
3691 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3694 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) {
3695 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3696 LDKPublicKey their_node_id_ref;
3697 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3698 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3699 LDKUpdateFulfillHTLC msg_conv;
3700 msg_conv.inner = (void*)(msg & (~1));
3701 msg_conv.is_owned = false;
3702 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3705 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) {
3706 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3707 LDKPublicKey their_node_id_ref;
3708 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3709 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3710 LDKUpdateFailHTLC msg_conv;
3711 msg_conv.inner = (void*)(msg & (~1));
3712 msg_conv.is_owned = false;
3713 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3716 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) {
3717 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3718 LDKPublicKey their_node_id_ref;
3719 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3720 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3721 LDKUpdateFailMalformedHTLC msg_conv;
3722 msg_conv.inner = (void*)(msg & (~1));
3723 msg_conv.is_owned = false;
3724 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3727 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) {
3728 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3729 LDKPublicKey their_node_id_ref;
3730 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3731 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3732 LDKCommitmentSigned msg_conv;
3733 msg_conv.inner = (void*)(msg & (~1));
3734 msg_conv.is_owned = false;
3735 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3738 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) {
3739 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3740 LDKPublicKey their_node_id_ref;
3741 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3742 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3743 LDKRevokeAndACK msg_conv;
3744 msg_conv.inner = (void*)(msg & (~1));
3745 msg_conv.is_owned = false;
3746 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3749 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) {
3750 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3751 LDKPublicKey their_node_id_ref;
3752 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3753 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3754 LDKUpdateFee msg_conv;
3755 msg_conv.inner = (void*)(msg & (~1));
3756 msg_conv.is_owned = false;
3757 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3760 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) {
3761 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3762 LDKPublicKey their_node_id_ref;
3763 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3764 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3765 LDKAnnouncementSignatures msg_conv;
3766 msg_conv.inner = (void*)(msg & (~1));
3767 msg_conv.is_owned = false;
3768 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3771 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) {
3772 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3773 LDKPublicKey their_node_id_ref;
3774 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3775 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3776 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3780 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3781 LDKPublicKey their_node_id_ref;
3782 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3783 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3785 msg_conv.inner = (void*)(msg & (~1));
3786 msg_conv.is_owned = false;
3787 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3790 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) {
3791 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3792 LDKPublicKey their_node_id_ref;
3793 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3794 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3795 LDKChannelReestablish msg_conv;
3796 msg_conv.inner = (void*)(msg & (~1));
3797 msg_conv.is_owned = false;
3798 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3802 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3803 LDKPublicKey their_node_id_ref;
3804 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3805 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3806 LDKErrorMessage msg_conv;
3807 msg_conv.inner = (void*)(msg & (~1));
3808 msg_conv.is_owned = false;
3809 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3812 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3813 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3814 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3815 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3816 for (size_t i = 0; i < vec->datalen; i++) {
3817 CHECK((((long)vec->data[i].inner) & 1) == 0);
3818 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3820 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3824 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3825 ret->datalen = (*env)->GetArrayLength(env, elems);
3826 if (ret->datalen == 0) {
3829 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3830 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3831 for (size_t i = 0; i < ret->datalen; i++) {
3832 jlong arr_elem = java_elems[i];
3833 LDKChannelMonitor arr_elem_conv;
3834 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3835 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3836 // Warning: we may need a move here but can't clone!
3837 ret->data[i] = arr_elem_conv;
3839 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3843 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3844 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3845 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3848 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3849 ret->datalen = (*env)->GetArrayLength(env, elems);
3850 if (ret->datalen == 0) {
3853 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3854 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3855 for (size_t i = 0; i < ret->datalen; i++) {
3856 ret->data[i] = java_elems[i];
3858 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3862 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3863 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3864 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3865 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3866 for (size_t i = 0; i < vec->datalen; i++) {
3867 CHECK((((long)vec->data[i].inner) & 1) == 0);
3868 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3870 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3873 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3874 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3875 ret->datalen = (*env)->GetArrayLength(env, elems);
3876 if (ret->datalen == 0) {
3879 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3880 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3881 for (size_t i = 0; i < ret->datalen; i++) {
3882 jlong arr_elem = java_elems[i];
3883 LDKUpdateAddHTLC arr_elem_conv;
3884 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3885 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3886 if (arr_elem_conv.inner != NULL)
3887 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3888 ret->data[i] = arr_elem_conv;
3890 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3894 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3895 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3896 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3897 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3898 for (size_t i = 0; i < vec->datalen; i++) {
3899 CHECK((((long)vec->data[i].inner) & 1) == 0);
3900 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3902 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3906 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3907 ret->datalen = (*env)->GetArrayLength(env, elems);
3908 if (ret->datalen == 0) {
3911 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3912 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3913 for (size_t i = 0; i < ret->datalen; i++) {
3914 jlong arr_elem = java_elems[i];
3915 LDKUpdateFulfillHTLC arr_elem_conv;
3916 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3917 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3918 if (arr_elem_conv.inner != NULL)
3919 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3920 ret->data[i] = arr_elem_conv;
3922 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3926 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3927 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3928 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3929 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3930 for (size_t i = 0; i < vec->datalen; i++) {
3931 CHECK((((long)vec->data[i].inner) & 1) == 0);
3932 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3934 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3938 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3939 ret->datalen = (*env)->GetArrayLength(env, elems);
3940 if (ret->datalen == 0) {
3943 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3944 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3945 for (size_t i = 0; i < ret->datalen; i++) {
3946 jlong arr_elem = java_elems[i];
3947 LDKUpdateFailHTLC arr_elem_conv;
3948 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3949 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3950 if (arr_elem_conv.inner != NULL)
3951 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3952 ret->data[i] = arr_elem_conv;
3954 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3958 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3959 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3960 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3961 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3962 for (size_t i = 0; i < vec->datalen; i++) {
3963 CHECK((((long)vec->data[i].inner) & 1) == 0);
3964 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3966 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3969 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3970 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3971 ret->datalen = (*env)->GetArrayLength(env, elems);
3972 if (ret->datalen == 0) {
3975 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3976 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3977 for (size_t i = 0; i < ret->datalen; i++) {
3978 jlong arr_elem = java_elems[i];
3979 LDKUpdateFailMalformedHTLC arr_elem_conv;
3980 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3981 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3982 if (arr_elem_conv.inner != NULL)
3983 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3984 ret->data[i] = arr_elem_conv;
3986 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3990 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3991 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3993 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3994 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3995 CHECK(val->result_ok);
3996 return *val->contents.result;
3998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3999 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
4000 CHECK(!val->result_ok);
4001 LDKLightningError err_var = (*val->contents.err);
4002 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4003 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4004 long err_ref = (long)err_var.inner & ~1;
4007 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4008 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
4009 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
4011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
4012 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
4013 ret->datalen = (*env)->GetArrayLength(env, elems);
4014 if (ret->datalen == 0) {
4017 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
4018 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4019 for (size_t i = 0; i < ret->datalen; i++) {
4020 jlong arr_elem = java_elems[i];
4021 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
4022 FREE((void*)arr_elem);
4023 ret->data[i] = arr_elem_conv;
4025 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4029 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4030 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
4031 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4032 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4033 for (size_t i = 0; i < vec->datalen; i++) {
4034 CHECK((((long)vec->data[i].inner) & 1) == 0);
4035 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4037 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
4041 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
4042 ret->datalen = (*env)->GetArrayLength(env, elems);
4043 if (ret->datalen == 0) {
4046 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
4047 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4048 for (size_t i = 0; i < ret->datalen; i++) {
4049 jlong arr_elem = java_elems[i];
4050 LDKNodeAnnouncement arr_elem_conv;
4051 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4052 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4053 if (arr_elem_conv.inner != NULL)
4054 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4055 ret->data[i] = arr_elem_conv;
4057 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4061 typedef struct LDKRoutingMessageHandler_JCalls {
4062 atomic_size_t refcnt;
4065 jmethodID handle_node_announcement_meth;
4066 jmethodID handle_channel_announcement_meth;
4067 jmethodID handle_channel_update_meth;
4068 jmethodID handle_htlc_fail_channel_update_meth;
4069 jmethodID get_next_channel_announcements_meth;
4070 jmethodID get_next_node_announcements_meth;
4071 jmethodID should_request_full_sync_meth;
4072 } LDKRoutingMessageHandler_JCalls;
4073 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
4074 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4076 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4077 LDKNodeAnnouncement msg_var = *msg;
4078 if (msg->inner != NULL)
4079 msg_var = NodeAnnouncement_clone(msg);
4080 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4081 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4082 long msg_ref = (long)msg_var.inner;
4083 if (msg_var.is_owned) {
4086 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4088 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg_ref);
4089 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4093 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
4094 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4096 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4097 LDKChannelAnnouncement msg_var = *msg;
4098 if (msg->inner != NULL)
4099 msg_var = ChannelAnnouncement_clone(msg);
4100 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4101 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4102 long msg_ref = (long)msg_var.inner;
4103 if (msg_var.is_owned) {
4106 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4108 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
4109 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4113 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
4114 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4116 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4117 LDKChannelUpdate msg_var = *msg;
4118 if (msg->inner != NULL)
4119 msg_var = ChannelUpdate_clone(msg);
4120 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4121 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4122 long msg_ref = (long)msg_var.inner;
4123 if (msg_var.is_owned) {
4126 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4128 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg_ref);
4129 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4133 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
4134 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4136 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4137 long ret_update = (long)update;
4138 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4140 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4142 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4143 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4145 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4146 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4148 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4149 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4150 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4151 if (arg_constr.datalen > 0)
4152 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4154 arg_constr.data = NULL;
4155 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4156 for (size_t l = 0; l < arg_constr.datalen; l++) {
4157 long arr_conv_63 = arg_vals[l];
4158 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4159 FREE((void*)arr_conv_63);
4160 arg_constr.data[l] = arr_conv_63_conv;
4162 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4165 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4166 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4168 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4169 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
4170 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
4171 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4173 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4174 LDKCVec_NodeAnnouncementZ arg_constr;
4175 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4176 if (arg_constr.datalen > 0)
4177 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4179 arg_constr.data = NULL;
4180 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4181 for (size_t s = 0; s < arg_constr.datalen; s++) {
4182 long arr_conv_18 = arg_vals[s];
4183 LDKNodeAnnouncement arr_conv_18_conv;
4184 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4185 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4186 if (arr_conv_18_conv.inner != NULL)
4187 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4188 arg_constr.data[s] = arr_conv_18_conv;
4190 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4193 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
4194 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4196 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4197 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
4198 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
4199 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4201 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
4203 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4204 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4205 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4207 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4208 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4212 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4213 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4214 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4215 return (void*) this_arg;
4217 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
4218 jclass c = (*env)->GetObjectClass(env, o);
4220 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4221 atomic_init(&calls->refcnt, 1);
4222 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4223 calls->o = (*env)->NewWeakGlobalRef(env, o);
4224 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
4225 CHECK(calls->handle_node_announcement_meth != NULL);
4226 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
4227 CHECK(calls->handle_channel_announcement_meth != NULL);
4228 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
4229 CHECK(calls->handle_channel_update_meth != NULL);
4230 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
4231 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
4232 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
4233 CHECK(calls->get_next_channel_announcements_meth != NULL);
4234 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
4235 CHECK(calls->get_next_node_announcements_meth != NULL);
4236 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
4237 CHECK(calls->should_request_full_sync_meth != NULL);
4239 LDKRoutingMessageHandler ret = {
4240 .this_arg = (void*) calls,
4241 .handle_node_announcement = handle_node_announcement_jcall,
4242 .handle_channel_announcement = handle_channel_announcement_jcall,
4243 .handle_channel_update = handle_channel_update_jcall,
4244 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4245 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4246 .get_next_node_announcements = get_next_node_announcements_jcall,
4247 .should_request_full_sync = should_request_full_sync_jcall,
4248 .free = LDKRoutingMessageHandler_JCalls_free,
4252 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
4253 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4254 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
4255 return (long)res_ptr;
4257 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4258 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
4262 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4263 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4264 LDKNodeAnnouncement msg_conv;
4265 msg_conv.inner = (void*)(msg & (~1));
4266 msg_conv.is_owned = false;
4267 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4268 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4269 return (long)ret_conv;
4272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4273 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4274 LDKChannelAnnouncement msg_conv;
4275 msg_conv.inner = (void*)(msg & (~1));
4276 msg_conv.is_owned = false;
4277 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4278 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4279 return (long)ret_conv;
4282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4283 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4284 LDKChannelUpdate msg_conv;
4285 msg_conv.inner = (void*)(msg & (~1));
4286 msg_conv.is_owned = false;
4287 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4288 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4289 return (long)ret_conv;
4292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
4293 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4294 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4295 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4298 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) {
4299 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4300 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4301 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4302 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4303 for (size_t l = 0; l < ret_var.datalen; l++) {
4304 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4305 *arr_conv_63_ref = ret_var.data[l];
4306 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4308 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4309 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
4313 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) {
4314 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4315 LDKPublicKey starting_point_ref;
4316 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
4317 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
4318 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4319 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4320 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4321 for (size_t s = 0; s < ret_var.datalen; s++) {
4322 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4323 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4324 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4325 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4326 if (arr_conv_18_var.is_owned) {
4327 arr_conv_18_ref |= 1;
4329 ret_arr_ptr[s] = arr_conv_18_ref;
4331 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4337 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4338 LDKPublicKey node_id_ref;
4339 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4340 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4341 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4345 typedef struct LDKSocketDescriptor_JCalls {
4346 atomic_size_t refcnt;
4349 jmethodID send_data_meth;
4350 jmethodID disconnect_socket_meth;
4352 jmethodID hash_meth;
4353 } LDKSocketDescriptor_JCalls;
4354 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4355 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4357 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4358 LDKu8slice data_var = data;
4359 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4360 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4361 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4363 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4365 void disconnect_socket_jcall(void* this_arg) {
4366 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4368 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4369 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4371 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4373 bool eq_jcall(const void* this_arg, const LDKSocketDescriptor *other_arg) {
4374 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4376 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4377 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4378 *other_arg_clone = SocketDescriptor_clone(other_arg);
4379 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4381 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, (long)other_arg_clone);
4383 uint64_t hash_jcall(const void* this_arg) {
4384 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4386 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4387 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4389 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4391 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4392 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4393 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4395 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4396 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4400 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4401 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4402 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4403 return (void*) this_arg;
4405 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4406 jclass c = (*env)->GetObjectClass(env, o);
4408 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4409 atomic_init(&calls->refcnt, 1);
4410 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4411 calls->o = (*env)->NewWeakGlobalRef(env, o);
4412 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4413 CHECK(calls->send_data_meth != NULL);
4414 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4415 CHECK(calls->disconnect_socket_meth != NULL);
4416 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4417 CHECK(calls->eq_meth != NULL);
4418 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4419 CHECK(calls->hash_meth != NULL);
4421 LDKSocketDescriptor ret = {
4422 .this_arg = (void*) calls,
4423 .send_data = send_data_jcall,
4424 .disconnect_socket = disconnect_socket_jcall,
4427 .clone = LDKSocketDescriptor_JCalls_clone,
4428 .free = LDKSocketDescriptor_JCalls_free,
4432 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4433 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4434 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4435 return (long)res_ptr;
4437 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4438 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4443 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4444 LDKu8slice data_ref;
4445 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4446 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4447 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4448 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4453 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4454 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4457 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4458 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4459 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4463 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4464 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4465 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4467 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4468 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4470 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4471 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4472 CHECK(val->result_ok);
4473 LDKCVecTempl_u8 res_var = (*val->contents.result);
4474 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4475 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4479 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4480 CHECK(!val->result_ok);
4481 LDKPeerHandleError err_var = (*val->contents.err);
4482 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4483 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4484 long err_ref = (long)err_var.inner & ~1;
4487 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4488 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4490 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4491 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4492 CHECK(val->result_ok);
4493 return *val->contents.result;
4495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4496 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4497 CHECK(!val->result_ok);
4498 LDKPeerHandleError err_var = (*val->contents.err);
4499 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4500 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4501 long err_ref = (long)err_var.inner & ~1;
4504 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4505 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4507 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4508 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4509 CHECK(val->result_ok);
4510 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4511 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4514 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4515 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4516 CHECK(!val->result_ok);
4517 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4520 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4521 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4523 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4524 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4525 CHECK(val->result_ok);
4526 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4527 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4530 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4531 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4532 CHECK(!val->result_ok);
4533 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4536 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4537 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4540 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4541 CHECK(val->result_ok);
4542 LDKTxCreationKeys res_var = (*val->contents.result);
4543 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4544 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4545 long res_ref = (long)res_var.inner & ~1;
4548 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4549 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4550 CHECK(!val->result_ok);
4551 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4554 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4555 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4556 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4558 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4559 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4560 ret->datalen = (*env)->GetArrayLength(env, elems);
4561 if (ret->datalen == 0) {
4564 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4565 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4566 for (size_t i = 0; i < ret->datalen; i++) {
4567 jlong arr_elem = java_elems[i];
4568 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4569 FREE((void*)arr_elem);
4570 ret->data[i] = arr_elem_conv;
4572 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4576 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4577 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4578 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4579 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4580 for (size_t i = 0; i < vec->datalen; i++) {
4581 CHECK((((long)vec->data[i].inner) & 1) == 0);
4582 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4584 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4588 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4589 ret->datalen = (*env)->GetArrayLength(env, elems);
4590 if (ret->datalen == 0) {
4593 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4594 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4595 for (size_t i = 0; i < ret->datalen; i++) {
4596 jlong arr_elem = java_elems[i];
4597 LDKRouteHop arr_elem_conv;
4598 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4599 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4600 if (arr_elem_conv.inner != NULL)
4601 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4602 ret->data[i] = arr_elem_conv;
4604 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4608 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4609 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4610 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4612 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4613 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4616 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4617 CHECK(val->result_ok);
4618 LDKRoute res_var = (*val->contents.result);
4619 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4620 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4621 long res_ref = (long)res_var.inner & ~1;
4624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4625 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4626 CHECK(!val->result_ok);
4627 LDKLightningError err_var = (*val->contents.err);
4628 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4629 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4630 long err_ref = (long)err_var.inner & ~1;
4633 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4634 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4635 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4636 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4637 for (size_t i = 0; i < vec->datalen; i++) {
4638 CHECK((((long)vec->data[i].inner) & 1) == 0);
4639 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4641 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4645 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4646 ret->datalen = (*env)->GetArrayLength(env, elems);
4647 if (ret->datalen == 0) {
4650 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4651 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4652 for (size_t i = 0; i < ret->datalen; i++) {
4653 jlong arr_elem = java_elems[i];
4654 LDKRouteHint arr_elem_conv;
4655 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4656 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4657 if (arr_elem_conv.inner != NULL)
4658 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4659 ret->data[i] = arr_elem_conv;
4661 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4666 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4668 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4672 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4674 C2Tuple_OutPointScriptZ_free(arg_conv);
4677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4678 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4680 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4684 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4686 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4690 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4692 C2Tuple_u64u64Z_free(arg_conv);
4695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4696 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4698 C2Tuple_usizeTransactionZ_free(arg_conv);
4701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4702 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4704 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4708 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4710 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4714 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4716 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4717 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4718 return (long)ret_conv;
4721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4722 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4724 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4728 LDKCVec_SignatureZ arg_constr;
4729 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4730 if (arg_constr.datalen > 0)
4731 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4733 arg_constr.data = NULL;
4734 for (size_t i = 0; i < arg_constr.datalen; i++) {
4735 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4736 LDKSignature arr_conv_8_ref;
4737 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4738 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4739 arg_constr.data[i] = arr_conv_8_ref;
4741 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4742 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4743 return (long)ret_conv;
4746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4747 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4749 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4750 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4751 return (long)ret_conv;
4754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4755 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4757 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4761 LDKCVec_u8Z arg_ref;
4762 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4763 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
4764 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
4765 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4766 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4767 return (long)ret_conv;
4770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4771 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4773 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4774 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4775 return (long)ret_conv;
4778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4779 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4781 CResult_NoneAPIErrorZ_free(arg_conv);
4784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4785 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4787 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4788 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4789 return (long)ret_conv;
4792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4793 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4795 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4798 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4799 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4801 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4802 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4803 return (long)ret_conv;
4806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4807 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4809 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4813 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4815 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4816 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4817 return (long)ret_conv;
4820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4821 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4823 CResult_NonePaymentSendFailureZ_free(arg_conv);
4826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4827 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4829 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4830 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4831 return (long)ret_conv;
4834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4835 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4837 CResult_NonePeerHandleErrorZ_free(arg_conv);
4840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4841 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4843 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4844 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4845 return (long)ret_conv;
4848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4849 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4851 CResult_PublicKeySecpErrorZ_free(arg_conv);
4854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4855 LDKPublicKey arg_ref;
4856 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4857 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4858 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4859 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4860 return (long)ret_conv;
4863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4864 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4866 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4867 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4868 return (long)ret_conv;
4871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4872 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4874 CResult_RouteLightningErrorZ_free(arg_conv);
4877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4878 LDKRoute arg_conv = *(LDKRoute*)arg;
4880 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4881 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4882 return (long)ret_conv;
4885 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4886 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4888 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4889 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4890 return (long)ret_conv;
4893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4894 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4896 CResult_SecretKeySecpErrorZ_free(arg_conv);
4899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4900 LDKSecretKey arg_ref;
4901 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4902 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4903 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4904 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4905 return (long)ret_conv;
4908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4909 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4911 CResult_SignatureNoneZ_free(arg_conv);
4914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4915 LDKSignature arg_ref;
4916 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4917 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4918 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4919 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4920 return (long)ret_conv;
4923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4924 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4926 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4927 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4928 return (long)ret_conv;
4931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4932 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4934 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4937 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4938 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4940 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4941 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4942 return (long)ret_conv;
4945 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4946 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4948 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4949 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4950 return (long)ret_conv;
4953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4954 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4956 CResult_TxOutAccessErrorZ_free(arg_conv);
4959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4960 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4962 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4963 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4964 return (long)ret_conv;
4967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4968 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4970 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4971 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4972 return (long)ret_conv;
4975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4976 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4978 CResult_boolLightningErrorZ_free(arg_conv);
4981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4982 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4983 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4984 return (long)ret_conv;
4987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4988 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4990 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4991 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4992 return (long)ret_conv;
4995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4996 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4998 CResult_boolPeerHandleErrorZ_free(arg_conv);
5001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
5002 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5003 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
5004 return (long)ret_conv;
5007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5008 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
5009 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5010 if (arg_constr.datalen > 0)
5011 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
5013 arg_constr.data = NULL;
5014 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5015 for (size_t q = 0; q < arg_constr.datalen; q++) {
5016 long arr_conv_42 = arg_vals[q];
5017 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
5018 FREE((void*)arr_conv_42);
5019 arg_constr.data[q] = arr_conv_42_conv;
5021 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5022 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
5025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5026 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
5027 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5028 if (arg_constr.datalen > 0)
5029 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
5031 arg_constr.data = NULL;
5032 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5033 for (size_t b = 0; b < arg_constr.datalen; b++) {
5034 long arr_conv_27 = arg_vals[b];
5035 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
5036 FREE((void*)arr_conv_27);
5037 arg_constr.data[b] = arr_conv_27_conv;
5039 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5040 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
5043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5044 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
5045 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5046 if (arg_constr.datalen > 0)
5047 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5049 arg_constr.data = NULL;
5050 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5051 for (size_t y = 0; y < arg_constr.datalen; y++) {
5052 long arr_conv_24 = arg_vals[y];
5053 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5054 FREE((void*)arr_conv_24);
5055 arg_constr.data[y] = arr_conv_24_conv;
5057 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5058 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
5061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5062 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
5063 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5064 if (arg_constr.datalen > 0)
5065 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5067 arg_constr.data = NULL;
5068 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5069 for (size_t l = 0; l < arg_constr.datalen; l++) {
5070 long arr_conv_63 = arg_vals[l];
5071 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5072 FREE((void*)arr_conv_63);
5073 arg_constr.data[l] = arr_conv_63_conv;
5075 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5076 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
5079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5080 LDKCVec_CVec_RouteHopZZ arg_constr;
5081 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5082 if (arg_constr.datalen > 0)
5083 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
5085 arg_constr.data = NULL;
5086 for (size_t m = 0; m < arg_constr.datalen; m++) {
5087 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
5088 LDKCVec_RouteHopZ arr_conv_12_constr;
5089 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
5090 if (arr_conv_12_constr.datalen > 0)
5091 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5093 arr_conv_12_constr.data = NULL;
5094 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
5095 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
5096 long arr_conv_10 = arr_conv_12_vals[k];
5097 LDKRouteHop arr_conv_10_conv;
5098 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5099 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5100 arr_conv_12_constr.data[k] = arr_conv_10_conv;
5102 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
5103 arg_constr.data[m] = arr_conv_12_constr;
5105 CVec_CVec_RouteHopZZ_free(arg_constr);
5108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5109 LDKCVec_ChannelDetailsZ arg_constr;
5110 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5111 if (arg_constr.datalen > 0)
5112 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
5114 arg_constr.data = NULL;
5115 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5116 for (size_t q = 0; q < arg_constr.datalen; q++) {
5117 long arr_conv_16 = arg_vals[q];
5118 LDKChannelDetails arr_conv_16_conv;
5119 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5120 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5121 arg_constr.data[q] = arr_conv_16_conv;
5123 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5124 CVec_ChannelDetailsZ_free(arg_constr);
5127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5128 LDKCVec_ChannelMonitorZ arg_constr;
5129 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5130 if (arg_constr.datalen > 0)
5131 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5133 arg_constr.data = NULL;
5134 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5135 for (size_t q = 0; q < arg_constr.datalen; q++) {
5136 long arr_conv_16 = arg_vals[q];
5137 LDKChannelMonitor arr_conv_16_conv;
5138 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5139 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5140 arg_constr.data[q] = arr_conv_16_conv;
5142 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5143 CVec_ChannelMonitorZ_free(arg_constr);
5146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5147 LDKCVec_EventZ arg_constr;
5148 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5149 if (arg_constr.datalen > 0)
5150 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5152 arg_constr.data = NULL;
5153 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5154 for (size_t h = 0; h < arg_constr.datalen; h++) {
5155 long arr_conv_7 = arg_vals[h];
5156 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5157 FREE((void*)arr_conv_7);
5158 arg_constr.data[h] = arr_conv_7_conv;
5160 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5161 CVec_EventZ_free(arg_constr);
5164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5165 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
5166 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5167 if (arg_constr.datalen > 0)
5168 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
5170 arg_constr.data = NULL;
5171 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5172 for (size_t y = 0; y < arg_constr.datalen; y++) {
5173 long arr_conv_24 = arg_vals[y];
5174 LDKHTLCOutputInCommitment arr_conv_24_conv;
5175 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
5176 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
5177 arg_constr.data[y] = arr_conv_24_conv;
5179 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5180 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
5183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5184 LDKCVec_MessageSendEventZ arg_constr;
5185 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5186 if (arg_constr.datalen > 0)
5187 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5189 arg_constr.data = NULL;
5190 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5191 for (size_t s = 0; s < arg_constr.datalen; s++) {
5192 long arr_conv_18 = arg_vals[s];
5193 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5194 FREE((void*)arr_conv_18);
5195 arg_constr.data[s] = arr_conv_18_conv;
5197 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5198 CVec_MessageSendEventZ_free(arg_constr);
5201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5202 LDKCVec_MonitorEventZ arg_constr;
5203 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5204 if (arg_constr.datalen > 0)
5205 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5207 arg_constr.data = NULL;
5208 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5209 for (size_t o = 0; o < arg_constr.datalen; o++) {
5210 long arr_conv_14 = arg_vals[o];
5211 LDKMonitorEvent arr_conv_14_conv;
5212 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5213 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5214 arg_constr.data[o] = arr_conv_14_conv;
5216 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5217 CVec_MonitorEventZ_free(arg_constr);
5220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5221 LDKCVec_NetAddressZ arg_constr;
5222 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5223 if (arg_constr.datalen > 0)
5224 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5226 arg_constr.data = NULL;
5227 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5228 for (size_t m = 0; m < arg_constr.datalen; m++) {
5229 long arr_conv_12 = arg_vals[m];
5230 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5231 FREE((void*)arr_conv_12);
5232 arg_constr.data[m] = arr_conv_12_conv;
5234 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5235 CVec_NetAddressZ_free(arg_constr);
5238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5239 LDKCVec_NodeAnnouncementZ arg_constr;
5240 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5241 if (arg_constr.datalen > 0)
5242 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5244 arg_constr.data = NULL;
5245 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5246 for (size_t s = 0; s < arg_constr.datalen; s++) {
5247 long arr_conv_18 = arg_vals[s];
5248 LDKNodeAnnouncement arr_conv_18_conv;
5249 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5250 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5251 arg_constr.data[s] = arr_conv_18_conv;
5253 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5254 CVec_NodeAnnouncementZ_free(arg_constr);
5257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5258 LDKCVec_PublicKeyZ arg_constr;
5259 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5260 if (arg_constr.datalen > 0)
5261 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5263 arg_constr.data = NULL;
5264 for (size_t i = 0; i < arg_constr.datalen; i++) {
5265 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5266 LDKPublicKey arr_conv_8_ref;
5267 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
5268 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
5269 arg_constr.data[i] = arr_conv_8_ref;
5271 CVec_PublicKeyZ_free(arg_constr);
5274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5275 LDKCVec_RouteHintZ arg_constr;
5276 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5277 if (arg_constr.datalen > 0)
5278 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5280 arg_constr.data = NULL;
5281 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5282 for (size_t l = 0; l < arg_constr.datalen; l++) {
5283 long arr_conv_11 = arg_vals[l];
5284 LDKRouteHint arr_conv_11_conv;
5285 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5286 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5287 arg_constr.data[l] = arr_conv_11_conv;
5289 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5290 CVec_RouteHintZ_free(arg_constr);
5293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5294 LDKCVec_RouteHopZ arg_constr;
5295 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5296 if (arg_constr.datalen > 0)
5297 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5299 arg_constr.data = NULL;
5300 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5301 for (size_t k = 0; k < arg_constr.datalen; k++) {
5302 long arr_conv_10 = arg_vals[k];
5303 LDKRouteHop arr_conv_10_conv;
5304 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5305 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5306 arg_constr.data[k] = arr_conv_10_conv;
5308 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5309 CVec_RouteHopZ_free(arg_constr);
5312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5313 LDKCVec_SignatureZ arg_constr;
5314 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5315 if (arg_constr.datalen > 0)
5316 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5318 arg_constr.data = NULL;
5319 for (size_t i = 0; i < arg_constr.datalen; i++) {
5320 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5321 LDKSignature arr_conv_8_ref;
5322 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5323 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5324 arg_constr.data[i] = arr_conv_8_ref;
5326 CVec_SignatureZ_free(arg_constr);
5329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5330 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5331 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5332 if (arg_constr.datalen > 0)
5333 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5335 arg_constr.data = NULL;
5336 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5337 for (size_t b = 0; b < arg_constr.datalen; b++) {
5338 long arr_conv_27 = arg_vals[b];
5339 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5340 FREE((void*)arr_conv_27);
5341 arg_constr.data[b] = arr_conv_27_conv;
5343 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5344 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5348 LDKCVec_TransactionZ arg_constr;
5349 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5350 if (arg_constr.datalen > 0)
5351 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5353 arg_constr.data = NULL;
5354 for (size_t i = 0; i < arg_constr.datalen; i++) {
5355 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5356 LDKTransaction arr_conv_8_ref;
5357 arr_conv_8_ref.datalen = (*_env)->GetArrayLength (_env, arr_conv_8);
5358 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5359 (*_env)->GetByteArrayRegion(_env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5360 arr_conv_8_ref.data_is_owned = true;
5361 arg_constr.data[i] = arr_conv_8_ref;
5363 CVec_TransactionZ_free(arg_constr);
5366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5367 LDKCVec_TxOutZ arg_constr;
5368 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5369 if (arg_constr.datalen > 0)
5370 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5372 arg_constr.data = NULL;
5373 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5374 for (size_t h = 0; h < arg_constr.datalen; h++) {
5375 long arr_conv_7 = arg_vals[h];
5376 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5377 FREE((void*)arr_conv_7);
5378 arg_constr.data[h] = arr_conv_7_conv;
5380 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5381 CVec_TxOutZ_free(arg_constr);
5384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5385 LDKCVec_UpdateAddHTLCZ arg_constr;
5386 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5387 if (arg_constr.datalen > 0)
5388 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5390 arg_constr.data = NULL;
5391 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5392 for (size_t p = 0; p < arg_constr.datalen; p++) {
5393 long arr_conv_15 = arg_vals[p];
5394 LDKUpdateAddHTLC arr_conv_15_conv;
5395 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5396 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5397 arg_constr.data[p] = arr_conv_15_conv;
5399 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5400 CVec_UpdateAddHTLCZ_free(arg_constr);
5403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5404 LDKCVec_UpdateFailHTLCZ arg_constr;
5405 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5406 if (arg_constr.datalen > 0)
5407 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5409 arg_constr.data = NULL;
5410 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5411 for (size_t q = 0; q < arg_constr.datalen; q++) {
5412 long arr_conv_16 = arg_vals[q];
5413 LDKUpdateFailHTLC arr_conv_16_conv;
5414 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5415 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5416 arg_constr.data[q] = arr_conv_16_conv;
5418 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5419 CVec_UpdateFailHTLCZ_free(arg_constr);
5422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5423 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5424 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5425 if (arg_constr.datalen > 0)
5426 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5428 arg_constr.data = NULL;
5429 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5430 for (size_t z = 0; z < arg_constr.datalen; z++) {
5431 long arr_conv_25 = arg_vals[z];
5432 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5433 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5434 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5435 arg_constr.data[z] = arr_conv_25_conv;
5437 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5438 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5442 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5443 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5444 if (arg_constr.datalen > 0)
5445 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5447 arg_constr.data = NULL;
5448 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5449 for (size_t t = 0; t < arg_constr.datalen; t++) {
5450 long arr_conv_19 = arg_vals[t];
5451 LDKUpdateFulfillHTLC arr_conv_19_conv;
5452 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5453 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5454 arg_constr.data[t] = arr_conv_19_conv;
5456 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5457 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5461 LDKCVec_u64Z arg_constr;
5462 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5463 if (arg_constr.datalen > 0)
5464 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5466 arg_constr.data = NULL;
5467 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5468 for (size_t g = 0; g < arg_constr.datalen; g++) {
5469 long arr_conv_6 = arg_vals[g];
5470 arg_constr.data[g] = arr_conv_6;
5472 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5473 CVec_u64Z_free(arg_constr);
5476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5477 LDKCVec_u8Z arg_ref;
5478 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5479 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
5480 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
5481 CVec_u8Z_free(arg_ref);
5484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jbyteArray _res) {
5485 LDKTransaction _res_ref;
5486 _res_ref.datalen = (*_env)->GetArrayLength (_env, _res);
5487 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5488 (*_env)->GetByteArrayRegion(_env, _res, 0, _res_ref.datalen, _res_ref.data);
5489 _res_ref.data_is_owned = true;
5490 Transaction_free(_res_ref);
5493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5494 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5496 TxOut_free(_res_conv);
5499 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5500 LDKTransaction b_ref;
5501 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5502 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5503 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5504 b_ref.data_is_owned = true;
5505 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5506 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5507 return (long)ret_ref;
5510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5511 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5512 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5513 return (long)ret_conv;
5516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5517 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5518 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5519 return (long)ret_conv;
5522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5524 a_conv.inner = (void*)(a & (~1));
5525 a_conv.is_owned = (a & 1) || (a == 0);
5526 if (a_conv.inner != NULL)
5527 a_conv = OutPoint_clone(&a_conv);
5529 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5530 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5531 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5532 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5533 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5534 return (long)ret_ref;
5537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5538 LDKThirtyTwoBytes a_ref;
5539 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5540 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5541 LDKCVec_TxOutZ b_constr;
5542 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5543 if (b_constr.datalen > 0)
5544 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5546 b_constr.data = NULL;
5547 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5548 for (size_t h = 0; h < b_constr.datalen; h++) {
5549 long arr_conv_7 = b_vals[h];
5550 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5551 FREE((void*)arr_conv_7);
5552 b_constr.data[h] = arr_conv_7_conv;
5554 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5555 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5556 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5557 return (long)ret_ref;
5560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5561 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5562 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5563 return (long)ret_ref;
5566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5568 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5569 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5570 LDKCVec_SignatureZ b_constr;
5571 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5572 if (b_constr.datalen > 0)
5573 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5575 b_constr.data = NULL;
5576 for (size_t i = 0; i < b_constr.datalen; i++) {
5577 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5578 LDKSignature arr_conv_8_ref;
5579 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5580 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5581 b_constr.data[i] = arr_conv_8_ref;
5583 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5584 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5585 return (long)ret_ref;
5588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5589 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5590 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5591 return (long)ret_conv;
5594 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5595 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5596 *ret_conv = CResult_SignatureNoneZ_err();
5597 return (long)ret_conv;
5600 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5601 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5602 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5603 return (long)ret_conv;
5606 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5607 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5608 *ret_conv = CResult_NoneAPIErrorZ_ok();
5609 return (long)ret_conv;
5612 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5613 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5614 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5615 return (long)ret_conv;
5618 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5619 LDKChannelAnnouncement a_conv;
5620 a_conv.inner = (void*)(a & (~1));
5621 a_conv.is_owned = (a & 1) || (a == 0);
5622 if (a_conv.inner != NULL)
5623 a_conv = ChannelAnnouncement_clone(&a_conv);
5624 LDKChannelUpdate b_conv;
5625 b_conv.inner = (void*)(b & (~1));
5626 b_conv.is_owned = (b & 1) || (b == 0);
5627 if (b_conv.inner != NULL)
5628 b_conv = ChannelUpdate_clone(&b_conv);
5629 LDKChannelUpdate c_conv;
5630 c_conv.inner = (void*)(c & (~1));
5631 c_conv.is_owned = (c & 1) || (c == 0);
5632 if (c_conv.inner != NULL)
5633 c_conv = ChannelUpdate_clone(&c_conv);
5634 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5635 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5636 return (long)ret_ref;
5639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5640 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5641 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5642 return (long)ret_conv;
5645 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5646 LDKHTLCOutputInCommitment a_conv;
5647 a_conv.inner = (void*)(a & (~1));
5648 a_conv.is_owned = (a & 1) || (a == 0);
5649 if (a_conv.inner != NULL)
5650 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5652 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5653 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5654 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5655 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5656 return (long)ret_ref;
5659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5660 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5661 FREE((void*)this_ptr);
5662 Event_free(this_ptr_conv);
5665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5666 LDKEvent* orig_conv = (LDKEvent*)orig;
5667 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5668 *ret_copy = Event_clone(orig_conv);
5669 long ret_ref = (long)ret_copy;
5673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5674 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5675 FREE((void*)this_ptr);
5676 MessageSendEvent_free(this_ptr_conv);
5679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5680 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5681 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5682 *ret_copy = MessageSendEvent_clone(orig_conv);
5683 long ret_ref = (long)ret_copy;
5687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5688 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5689 FREE((void*)this_ptr);
5690 MessageSendEventsProvider_free(this_ptr_conv);
5693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5694 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5695 FREE((void*)this_ptr);
5696 EventsProvider_free(this_ptr_conv);
5699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5700 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5701 FREE((void*)this_ptr);
5702 APIError_free(this_ptr_conv);
5705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5706 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5707 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5708 *ret_copy = APIError_clone(orig_conv);
5709 long ret_ref = (long)ret_copy;
5713 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5714 LDKLevel* orig_conv = (LDKLevel*)orig;
5715 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5719 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5720 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5725 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5726 FREE((void*)this_ptr);
5727 Logger_free(this_ptr_conv);
5730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5731 LDKChannelHandshakeConfig this_ptr_conv;
5732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5734 ChannelHandshakeConfig_free(this_ptr_conv);
5737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5738 LDKChannelHandshakeConfig orig_conv;
5739 orig_conv.inner = (void*)(orig & (~1));
5740 orig_conv.is_owned = false;
5741 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5744 long ret_ref = (long)ret_var.inner;
5745 if (ret_var.is_owned) {
5751 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5752 LDKChannelHandshakeConfig this_ptr_conv;
5753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5754 this_ptr_conv.is_owned = false;
5755 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5760 LDKChannelHandshakeConfig this_ptr_conv;
5761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5762 this_ptr_conv.is_owned = false;
5763 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5766 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5767 LDKChannelHandshakeConfig this_ptr_conv;
5768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5769 this_ptr_conv.is_owned = false;
5770 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5775 LDKChannelHandshakeConfig this_ptr_conv;
5776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5777 this_ptr_conv.is_owned = false;
5778 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5782 LDKChannelHandshakeConfig this_ptr_conv;
5783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5784 this_ptr_conv.is_owned = false;
5785 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5790 LDKChannelHandshakeConfig this_ptr_conv;
5791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5792 this_ptr_conv.is_owned = false;
5793 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5796 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) {
5797 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5798 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5799 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5800 long ret_ref = (long)ret_var.inner;
5801 if (ret_var.is_owned) {
5807 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5808 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5809 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5810 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5811 long ret_ref = (long)ret_var.inner;
5812 if (ret_var.is_owned) {
5818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5819 LDKChannelHandshakeLimits this_ptr_conv;
5820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5822 ChannelHandshakeLimits_free(this_ptr_conv);
5825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5826 LDKChannelHandshakeLimits orig_conv;
5827 orig_conv.inner = (void*)(orig & (~1));
5828 orig_conv.is_owned = false;
5829 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5830 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5831 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5832 long ret_ref = (long)ret_var.inner;
5833 if (ret_var.is_owned) {
5839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5840 LDKChannelHandshakeLimits this_ptr_conv;
5841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5842 this_ptr_conv.is_owned = false;
5843 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5848 LDKChannelHandshakeLimits this_ptr_conv;
5849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5850 this_ptr_conv.is_owned = false;
5851 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5855 LDKChannelHandshakeLimits this_ptr_conv;
5856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5857 this_ptr_conv.is_owned = false;
5858 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5862 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5863 LDKChannelHandshakeLimits this_ptr_conv;
5864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5865 this_ptr_conv.is_owned = false;
5866 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5870 LDKChannelHandshakeLimits this_ptr_conv;
5871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5872 this_ptr_conv.is_owned = false;
5873 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5877 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) {
5878 LDKChannelHandshakeLimits this_ptr_conv;
5879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5880 this_ptr_conv.is_owned = false;
5881 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5885 LDKChannelHandshakeLimits this_ptr_conv;
5886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5887 this_ptr_conv.is_owned = false;
5888 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5893 LDKChannelHandshakeLimits this_ptr_conv;
5894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5895 this_ptr_conv.is_owned = false;
5896 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5899 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5900 LDKChannelHandshakeLimits this_ptr_conv;
5901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5902 this_ptr_conv.is_owned = false;
5903 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5908 LDKChannelHandshakeLimits this_ptr_conv;
5909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5910 this_ptr_conv.is_owned = false;
5911 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5915 LDKChannelHandshakeLimits this_ptr_conv;
5916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5917 this_ptr_conv.is_owned = false;
5918 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5923 LDKChannelHandshakeLimits this_ptr_conv;
5924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5925 this_ptr_conv.is_owned = false;
5926 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5929 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5930 LDKChannelHandshakeLimits this_ptr_conv;
5931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5932 this_ptr_conv.is_owned = false;
5933 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5938 LDKChannelHandshakeLimits this_ptr_conv;
5939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5940 this_ptr_conv.is_owned = false;
5941 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5944 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5945 LDKChannelHandshakeLimits this_ptr_conv;
5946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5947 this_ptr_conv.is_owned = false;
5948 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5953 LDKChannelHandshakeLimits this_ptr_conv;
5954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5955 this_ptr_conv.is_owned = false;
5956 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5959 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5960 LDKChannelHandshakeLimits this_ptr_conv;
5961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5962 this_ptr_conv.is_owned = false;
5963 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5968 LDKChannelHandshakeLimits this_ptr_conv;
5969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5970 this_ptr_conv.is_owned = false;
5971 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5974 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5975 LDKChannelHandshakeLimits this_ptr_conv;
5976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5977 this_ptr_conv.is_owned = false;
5978 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5983 LDKChannelHandshakeLimits this_ptr_conv;
5984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5985 this_ptr_conv.is_owned = false;
5986 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5989 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) {
5990 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);
5991 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5992 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5993 long ret_ref = (long)ret_var.inner;
5994 if (ret_var.is_owned) {
6000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
6001 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
6002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6004 long ret_ref = (long)ret_var.inner;
6005 if (ret_var.is_owned) {
6011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6012 LDKChannelConfig this_ptr_conv;
6013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6014 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6015 ChannelConfig_free(this_ptr_conv);
6018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6019 LDKChannelConfig orig_conv;
6020 orig_conv.inner = (void*)(orig & (~1));
6021 orig_conv.is_owned = false;
6022 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
6023 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6024 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6025 long ret_ref = (long)ret_var.inner;
6026 if (ret_var.is_owned) {
6032 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
6033 LDKChannelConfig this_ptr_conv;
6034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6035 this_ptr_conv.is_owned = false;
6036 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
6040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6041 LDKChannelConfig this_ptr_conv;
6042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6043 this_ptr_conv.is_owned = false;
6044 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
6047 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
6048 LDKChannelConfig this_ptr_conv;
6049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6050 this_ptr_conv.is_owned = false;
6051 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
6055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6056 LDKChannelConfig this_ptr_conv;
6057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6058 this_ptr_conv.is_owned = false;
6059 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
6062 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6063 LDKChannelConfig this_ptr_conv;
6064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6065 this_ptr_conv.is_owned = false;
6066 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
6070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6071 LDKChannelConfig this_ptr_conv;
6072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6073 this_ptr_conv.is_owned = false;
6074 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
6077 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) {
6078 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
6079 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6080 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6081 long ret_ref = (long)ret_var.inner;
6082 if (ret_var.is_owned) {
6088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
6089 LDKChannelConfig ret_var = ChannelConfig_default();
6090 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6091 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6092 long ret_ref = (long)ret_var.inner;
6093 if (ret_var.is_owned) {
6099 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
6100 LDKChannelConfig obj_conv;
6101 obj_conv.inner = (void*)(obj & (~1));
6102 obj_conv.is_owned = false;
6103 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
6104 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6105 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6106 CVec_u8Z_free(arg_var);
6110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6112 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6113 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6114 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
6115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6117 long ret_ref = (long)ret_var.inner;
6118 if (ret_var.is_owned) {
6121 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6126 LDKUserConfig this_ptr_conv;
6127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6129 UserConfig_free(this_ptr_conv);
6132 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6133 LDKUserConfig orig_conv;
6134 orig_conv.inner = (void*)(orig & (~1));
6135 orig_conv.is_owned = false;
6136 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6137 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6138 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6139 long ret_ref = (long)ret_var.inner;
6140 if (ret_var.is_owned) {
6146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6147 LDKUserConfig this_ptr_conv;
6148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6149 this_ptr_conv.is_owned = false;
6150 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6151 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6152 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6153 long ret_ref = (long)ret_var.inner;
6154 if (ret_var.is_owned) {
6160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6161 LDKUserConfig this_ptr_conv;
6162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6163 this_ptr_conv.is_owned = false;
6164 LDKChannelHandshakeConfig val_conv;
6165 val_conv.inner = (void*)(val & (~1));
6166 val_conv.is_owned = (val & 1) || (val == 0);
6167 if (val_conv.inner != NULL)
6168 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6169 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
6173 LDKUserConfig this_ptr_conv;
6174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6175 this_ptr_conv.is_owned = false;
6176 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
6177 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6178 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6179 long ret_ref = (long)ret_var.inner;
6180 if (ret_var.is_owned) {
6186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6187 LDKUserConfig this_ptr_conv;
6188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6189 this_ptr_conv.is_owned = false;
6190 LDKChannelHandshakeLimits val_conv;
6191 val_conv.inner = (void*)(val & (~1));
6192 val_conv.is_owned = (val & 1) || (val == 0);
6193 if (val_conv.inner != NULL)
6194 val_conv = ChannelHandshakeLimits_clone(&val_conv);
6195 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6198 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
6199 LDKUserConfig this_ptr_conv;
6200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6201 this_ptr_conv.is_owned = false;
6202 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
6203 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6204 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6205 long ret_ref = (long)ret_var.inner;
6206 if (ret_var.is_owned) {
6212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6213 LDKUserConfig this_ptr_conv;
6214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6215 this_ptr_conv.is_owned = false;
6216 LDKChannelConfig val_conv;
6217 val_conv.inner = (void*)(val & (~1));
6218 val_conv.is_owned = (val & 1) || (val == 0);
6219 if (val_conv.inner != NULL)
6220 val_conv = ChannelConfig_clone(&val_conv);
6221 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6224 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) {
6225 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6226 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6227 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6228 if (own_channel_config_arg_conv.inner != NULL)
6229 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6230 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6231 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6232 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6233 if (peer_channel_config_limits_arg_conv.inner != NULL)
6234 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6235 LDKChannelConfig channel_options_arg_conv;
6236 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6237 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6238 if (channel_options_arg_conv.inner != NULL)
6239 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6240 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6241 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6242 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6243 long ret_ref = (long)ret_var.inner;
6244 if (ret_var.is_owned) {
6250 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
6251 LDKUserConfig ret_var = UserConfig_default();
6252 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6253 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6254 long ret_ref = (long)ret_var.inner;
6255 if (ret_var.is_owned) {
6261 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6262 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6263 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
6267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6268 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6269 FREE((void*)this_ptr);
6270 Access_free(this_ptr_conv);
6273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6274 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6275 FREE((void*)this_ptr);
6276 Watch_free(this_ptr_conv);
6279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6280 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6281 FREE((void*)this_ptr);
6282 Filter_free(this_ptr_conv);
6285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6286 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6287 FREE((void*)this_ptr);
6288 BroadcasterInterface_free(this_ptr_conv);
6291 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6292 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6293 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6298 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6299 FREE((void*)this_ptr);
6300 FeeEstimator_free(this_ptr_conv);
6303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6304 LDKChainMonitor this_ptr_conv;
6305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6307 ChainMonitor_free(this_ptr_conv);
6310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6311 LDKChainMonitor this_arg_conv;
6312 this_arg_conv.inner = (void*)(this_arg & (~1));
6313 this_arg_conv.is_owned = false;
6314 unsigned char header_arr[80];
6315 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6316 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6317 unsigned char (*header_ref)[80] = &header_arr;
6318 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6319 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6320 if (txdata_constr.datalen > 0)
6321 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6323 txdata_constr.data = NULL;
6324 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6325 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6326 long arr_conv_24 = txdata_vals[y];
6327 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6328 FREE((void*)arr_conv_24);
6329 txdata_constr.data[y] = arr_conv_24_conv;
6331 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6332 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6336 LDKChainMonitor this_arg_conv;
6337 this_arg_conv.inner = (void*)(this_arg & (~1));
6338 this_arg_conv.is_owned = false;
6339 unsigned char header_arr[80];
6340 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6341 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6342 unsigned char (*header_ref)[80] = &header_arr;
6343 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6346 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6347 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6348 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6349 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6350 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6351 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6353 LDKLogger logger_conv = *(LDKLogger*)logger;
6354 if (logger_conv.free == LDKLogger_JCalls_free) {
6355 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6356 LDKLogger_JCalls_clone(logger_conv.this_arg);
6358 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6359 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6360 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6361 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6363 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6364 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6365 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6366 long ret_ref = (long)ret_var.inner;
6367 if (ret_var.is_owned) {
6373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6374 LDKChainMonitor this_arg_conv;
6375 this_arg_conv.inner = (void*)(this_arg & (~1));
6376 this_arg_conv.is_owned = false;
6377 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6378 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6382 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6383 LDKChainMonitor this_arg_conv;
6384 this_arg_conv.inner = (void*)(this_arg & (~1));
6385 this_arg_conv.is_owned = false;
6386 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6387 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6391 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6392 LDKChannelMonitorUpdate this_ptr_conv;
6393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6395 ChannelMonitorUpdate_free(this_ptr_conv);
6398 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6399 LDKChannelMonitorUpdate orig_conv;
6400 orig_conv.inner = (void*)(orig & (~1));
6401 orig_conv.is_owned = false;
6402 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6403 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6404 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6405 long ret_ref = (long)ret_var.inner;
6406 if (ret_var.is_owned) {
6412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6413 LDKChannelMonitorUpdate this_ptr_conv;
6414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6415 this_ptr_conv.is_owned = false;
6416 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6421 LDKChannelMonitorUpdate this_ptr_conv;
6422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6423 this_ptr_conv.is_owned = false;
6424 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6427 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
6428 LDKChannelMonitorUpdate this_ptr_conv;
6429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6430 this_ptr_conv.is_owned = false;
6431 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&this_ptr_conv);
6432 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6433 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6434 CVec_u8Z_free(arg_var);
6438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6440 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6441 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6442 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6443 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6444 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6445 long ret_ref = (long)ret_var.inner;
6446 if (ret_var.is_owned) {
6449 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6453 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6454 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6455 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6460 LDKMonitorUpdateError this_ptr_conv;
6461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6462 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6463 MonitorUpdateError_free(this_ptr_conv);
6466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6467 LDKMonitorEvent this_ptr_conv;
6468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6470 MonitorEvent_free(this_ptr_conv);
6473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6474 LDKMonitorEvent orig_conv;
6475 orig_conv.inner = (void*)(orig & (~1));
6476 orig_conv.is_owned = false;
6477 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6478 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6479 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6480 long ret_ref = (long)ret_var.inner;
6481 if (ret_var.is_owned) {
6487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6488 LDKHTLCUpdate this_ptr_conv;
6489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6491 HTLCUpdate_free(this_ptr_conv);
6494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6495 LDKHTLCUpdate orig_conv;
6496 orig_conv.inner = (void*)(orig & (~1));
6497 orig_conv.is_owned = false;
6498 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6499 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6500 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6501 long ret_ref = (long)ret_var.inner;
6502 if (ret_var.is_owned) {
6508 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6509 LDKHTLCUpdate obj_conv;
6510 obj_conv.inner = (void*)(obj & (~1));
6511 obj_conv.is_owned = false;
6512 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6513 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6514 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6515 CVec_u8Z_free(arg_var);
6519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6521 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6522 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6523 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6524 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6525 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6526 long ret_ref = (long)ret_var.inner;
6527 if (ret_var.is_owned) {
6530 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6535 LDKChannelMonitor this_ptr_conv;
6536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6538 ChannelMonitor_free(this_ptr_conv);
6541 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
6542 LDKChannelMonitor this_ptr_conv;
6543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6544 this_ptr_conv.is_owned = false;
6545 LDKCVec_u8Z arg_var = ChannelMonitor_write(&this_ptr_conv);
6546 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6547 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6548 CVec_u8Z_free(arg_var);
6552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6553 LDKChannelMonitor this_arg_conv;
6554 this_arg_conv.inner = (void*)(this_arg & (~1));
6555 this_arg_conv.is_owned = false;
6556 LDKChannelMonitorUpdate updates_conv;
6557 updates_conv.inner = (void*)(updates & (~1));
6558 updates_conv.is_owned = (updates & 1) || (updates == 0);
6559 if (updates_conv.inner != NULL)
6560 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6561 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6562 LDKLogger* logger_conv = (LDKLogger*)logger;
6563 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6564 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6565 return (long)ret_conv;
6568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6569 LDKChannelMonitor this_arg_conv;
6570 this_arg_conv.inner = (void*)(this_arg & (~1));
6571 this_arg_conv.is_owned = false;
6572 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6577 LDKChannelMonitor this_arg_conv;
6578 this_arg_conv.inner = (void*)(this_arg & (~1));
6579 this_arg_conv.is_owned = false;
6580 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6581 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6582 return (long)ret_ref;
6585 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6586 LDKChannelMonitor this_arg_conv;
6587 this_arg_conv.inner = (void*)(this_arg & (~1));
6588 this_arg_conv.is_owned = false;
6589 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6590 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6591 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6592 for (size_t o = 0; o < ret_var.datalen; o++) {
6593 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6594 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6595 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6596 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6597 if (arr_conv_14_var.is_owned) {
6598 arr_conv_14_ref |= 1;
6600 ret_arr_ptr[o] = arr_conv_14_ref;
6602 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6607 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6608 LDKChannelMonitor this_arg_conv;
6609 this_arg_conv.inner = (void*)(this_arg & (~1));
6610 this_arg_conv.is_owned = false;
6611 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6612 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6613 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6614 for (size_t h = 0; h < ret_var.datalen; h++) {
6615 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6616 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6617 long arr_conv_7_ref = (long)arr_conv_7_copy;
6618 ret_arr_ptr[h] = arr_conv_7_ref;
6620 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6621 CVec_EventZ_free(ret_var);
6625 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6626 LDKChannelMonitor this_arg_conv;
6627 this_arg_conv.inner = (void*)(this_arg & (~1));
6628 this_arg_conv.is_owned = false;
6629 LDKLogger* logger_conv = (LDKLogger*)logger;
6630 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6631 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
6632 for (size_t i = 0; i < ret_var.datalen; i++) {
6633 LDKTransaction arr_conv_8_var = ret_var.data[i];
6634 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, arr_conv_8_var.datalen);
6635 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
6636 Transaction_free(arr_conv_8_var);
6637 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
6639 CVec_TransactionZ_free(ret_var);
6643 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) {
6644 LDKChannelMonitor this_arg_conv;
6645 this_arg_conv.inner = (void*)(this_arg & (~1));
6646 this_arg_conv.is_owned = false;
6647 unsigned char header_arr[80];
6648 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6649 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6650 unsigned char (*header_ref)[80] = &header_arr;
6651 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6652 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6653 if (txdata_constr.datalen > 0)
6654 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6656 txdata_constr.data = NULL;
6657 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6658 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6659 long arr_conv_24 = txdata_vals[y];
6660 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6661 FREE((void*)arr_conv_24);
6662 txdata_constr.data[y] = arr_conv_24_conv;
6664 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6665 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6666 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6667 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6668 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6670 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6671 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6672 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6673 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6675 LDKLogger logger_conv = *(LDKLogger*)logger;
6676 if (logger_conv.free == LDKLogger_JCalls_free) {
6677 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6678 LDKLogger_JCalls_clone(logger_conv.this_arg);
6680 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6681 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6682 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6683 for (size_t b = 0; b < ret_var.datalen; b++) {
6684 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6685 *arr_conv_27_ref = ret_var.data[b];
6686 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6688 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6689 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6693 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) {
6694 LDKChannelMonitor this_arg_conv;
6695 this_arg_conv.inner = (void*)(this_arg & (~1));
6696 this_arg_conv.is_owned = false;
6697 unsigned char header_arr[80];
6698 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6699 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6700 unsigned char (*header_ref)[80] = &header_arr;
6701 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6702 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6703 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6704 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6706 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6707 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6708 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6709 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6711 LDKLogger logger_conv = *(LDKLogger*)logger;
6712 if (logger_conv.free == LDKLogger_JCalls_free) {
6713 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6714 LDKLogger_JCalls_clone(logger_conv.this_arg);
6716 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6720 LDKOutPoint this_ptr_conv;
6721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6723 OutPoint_free(this_ptr_conv);
6726 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6727 LDKOutPoint orig_conv;
6728 orig_conv.inner = (void*)(orig & (~1));
6729 orig_conv.is_owned = false;
6730 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6731 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6732 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6733 long ret_ref = (long)ret_var.inner;
6734 if (ret_var.is_owned) {
6740 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6741 LDKOutPoint this_ptr_conv;
6742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6743 this_ptr_conv.is_owned = false;
6744 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6745 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6750 LDKOutPoint this_ptr_conv;
6751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6752 this_ptr_conv.is_owned = false;
6753 LDKThirtyTwoBytes val_ref;
6754 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6755 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6756 OutPoint_set_txid(&this_ptr_conv, val_ref);
6759 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6760 LDKOutPoint this_ptr_conv;
6761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6762 this_ptr_conv.is_owned = false;
6763 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6768 LDKOutPoint this_ptr_conv;
6769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6770 this_ptr_conv.is_owned = false;
6771 OutPoint_set_index(&this_ptr_conv, val);
6774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6775 LDKThirtyTwoBytes txid_arg_ref;
6776 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6777 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6778 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6781 long ret_ref = (long)ret_var.inner;
6782 if (ret_var.is_owned) {
6788 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6789 LDKOutPoint this_arg_conv;
6790 this_arg_conv.inner = (void*)(this_arg & (~1));
6791 this_arg_conv.is_owned = false;
6792 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6793 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6797 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6798 LDKOutPoint obj_conv;
6799 obj_conv.inner = (void*)(obj & (~1));
6800 obj_conv.is_owned = false;
6801 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6802 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6803 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6804 CVec_u8Z_free(arg_var);
6808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6810 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6811 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6812 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6813 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6814 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6815 long ret_ref = (long)ret_var.inner;
6816 if (ret_var.is_owned) {
6819 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6824 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6825 FREE((void*)this_ptr);
6826 SpendableOutputDescriptor_free(this_ptr_conv);
6829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6830 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6831 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6832 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6833 long ret_ref = (long)ret_copy;
6837 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6838 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
6839 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6840 *ret = ChannelKeys_clone(orig_conv);
6844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6845 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6846 FREE((void*)this_ptr);
6847 ChannelKeys_free(this_ptr_conv);
6850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6851 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6852 FREE((void*)this_ptr);
6853 KeysInterface_free(this_ptr_conv);
6856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6857 LDKInMemoryChannelKeys this_ptr_conv;
6858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6860 InMemoryChannelKeys_free(this_ptr_conv);
6863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6864 LDKInMemoryChannelKeys orig_conv;
6865 orig_conv.inner = (void*)(orig & (~1));
6866 orig_conv.is_owned = false;
6867 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6868 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6869 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6870 long ret_ref = (long)ret_var.inner;
6871 if (ret_var.is_owned) {
6877 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6878 LDKInMemoryChannelKeys this_ptr_conv;
6879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6880 this_ptr_conv.is_owned = false;
6881 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6882 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6887 LDKInMemoryChannelKeys this_ptr_conv;
6888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6889 this_ptr_conv.is_owned = false;
6890 LDKSecretKey val_ref;
6891 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6892 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6893 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6896 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6897 LDKInMemoryChannelKeys this_ptr_conv;
6898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6899 this_ptr_conv.is_owned = false;
6900 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6901 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6906 LDKInMemoryChannelKeys this_ptr_conv;
6907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6908 this_ptr_conv.is_owned = false;
6909 LDKSecretKey val_ref;
6910 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6911 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6912 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6915 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6916 LDKInMemoryChannelKeys this_ptr_conv;
6917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6918 this_ptr_conv.is_owned = false;
6919 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6920 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6925 LDKInMemoryChannelKeys this_ptr_conv;
6926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6927 this_ptr_conv.is_owned = false;
6928 LDKSecretKey val_ref;
6929 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6930 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6931 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6934 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6935 LDKInMemoryChannelKeys this_ptr_conv;
6936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6937 this_ptr_conv.is_owned = false;
6938 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6939 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6944 LDKInMemoryChannelKeys this_ptr_conv;
6945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6946 this_ptr_conv.is_owned = false;
6947 LDKSecretKey val_ref;
6948 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6949 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6950 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6953 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6954 LDKInMemoryChannelKeys this_ptr_conv;
6955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6956 this_ptr_conv.is_owned = false;
6957 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6958 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6963 LDKInMemoryChannelKeys this_ptr_conv;
6964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6965 this_ptr_conv.is_owned = false;
6966 LDKSecretKey val_ref;
6967 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6968 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6969 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6972 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6973 LDKInMemoryChannelKeys this_ptr_conv;
6974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6975 this_ptr_conv.is_owned = false;
6976 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6977 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6982 LDKInMemoryChannelKeys this_ptr_conv;
6983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6984 this_ptr_conv.is_owned = false;
6985 LDKThirtyTwoBytes val_ref;
6986 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6987 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6988 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6991 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) {
6992 LDKSecretKey funding_key_ref;
6993 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6994 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6995 LDKSecretKey revocation_base_key_ref;
6996 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6997 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6998 LDKSecretKey payment_key_ref;
6999 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
7000 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
7001 LDKSecretKey delayed_payment_base_key_ref;
7002 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
7003 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
7004 LDKSecretKey htlc_base_key_ref;
7005 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
7006 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
7007 LDKThirtyTwoBytes commitment_seed_ref;
7008 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
7009 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
7010 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
7011 FREE((void*)key_derivation_params);
7012 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);
7013 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7014 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7015 long ret_ref = (long)ret_var.inner;
7016 if (ret_var.is_owned) {
7022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
7023 LDKInMemoryChannelKeys this_arg_conv;
7024 this_arg_conv.inner = (void*)(this_arg & (~1));
7025 this_arg_conv.is_owned = false;
7026 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
7027 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7028 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7029 long ret_ref = (long)ret_var.inner;
7030 if (ret_var.is_owned) {
7036 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
7037 LDKInMemoryChannelKeys this_arg_conv;
7038 this_arg_conv.inner = (void*)(this_arg & (~1));
7039 this_arg_conv.is_owned = false;
7040 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
7044 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
7045 LDKInMemoryChannelKeys this_arg_conv;
7046 this_arg_conv.inner = (void*)(this_arg & (~1));
7047 this_arg_conv.is_owned = false;
7048 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
7052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
7053 LDKInMemoryChannelKeys this_arg_conv;
7054 this_arg_conv.inner = (void*)(this_arg & (~1));
7055 this_arg_conv.is_owned = false;
7056 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
7057 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
7061 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
7062 LDKInMemoryChannelKeys this_ptr_conv;
7063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7064 this_ptr_conv.is_owned = false;
7065 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&this_ptr_conv);
7066 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7067 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7068 CVec_u8Z_free(arg_var);
7072 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
7074 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
7075 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
7076 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
7077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7079 long ret_ref = (long)ret_var.inner;
7080 if (ret_var.is_owned) {
7083 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
7087 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7088 LDKKeysManager this_ptr_conv;
7089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7091 KeysManager_free(this_ptr_conv);
7094 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) {
7095 unsigned char seed_arr[32];
7096 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
7097 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
7098 unsigned char (*seed_ref)[32] = &seed_arr;
7099 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7100 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
7101 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7102 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7103 long ret_ref = (long)ret_var.inner;
7104 if (ret_var.is_owned) {
7110 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) {
7111 LDKKeysManager this_arg_conv;
7112 this_arg_conv.inner = (void*)(this_arg & (~1));
7113 this_arg_conv.is_owned = false;
7114 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
7115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7117 long ret_ref = (long)ret_var.inner;
7118 if (ret_var.is_owned) {
7124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
7125 LDKKeysManager this_arg_conv;
7126 this_arg_conv.inner = (void*)(this_arg & (~1));
7127 this_arg_conv.is_owned = false;
7128 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7129 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
7133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7134 LDKChannelManager this_ptr_conv;
7135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7137 ChannelManager_free(this_ptr_conv);
7140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7141 LDKChannelDetails this_ptr_conv;
7142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7144 ChannelDetails_free(this_ptr_conv);
7147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7148 LDKChannelDetails orig_conv;
7149 orig_conv.inner = (void*)(orig & (~1));
7150 orig_conv.is_owned = false;
7151 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
7152 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7153 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7154 long ret_ref = (long)ret_var.inner;
7155 if (ret_var.is_owned) {
7161 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7162 LDKChannelDetails this_ptr_conv;
7163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7164 this_ptr_conv.is_owned = false;
7165 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7166 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
7170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7171 LDKChannelDetails this_ptr_conv;
7172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7173 this_ptr_conv.is_owned = false;
7174 LDKThirtyTwoBytes val_ref;
7175 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7176 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7177 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7180 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7181 LDKChannelDetails this_ptr_conv;
7182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7183 this_ptr_conv.is_owned = false;
7184 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7185 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
7189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7190 LDKChannelDetails this_ptr_conv;
7191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7192 this_ptr_conv.is_owned = false;
7193 LDKPublicKey val_ref;
7194 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7195 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7196 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7199 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7200 LDKChannelDetails this_ptr_conv;
7201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7202 this_ptr_conv.is_owned = false;
7203 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7204 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7205 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7206 long ret_ref = (long)ret_var.inner;
7207 if (ret_var.is_owned) {
7213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7214 LDKChannelDetails this_ptr_conv;
7215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7216 this_ptr_conv.is_owned = false;
7217 LDKInitFeatures val_conv;
7218 val_conv.inner = (void*)(val & (~1));
7219 val_conv.is_owned = (val & 1) || (val == 0);
7220 // Warning: we may need a move here but can't clone!
7221 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7225 LDKChannelDetails this_ptr_conv;
7226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7227 this_ptr_conv.is_owned = false;
7228 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7233 LDKChannelDetails this_ptr_conv;
7234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7235 this_ptr_conv.is_owned = false;
7236 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7239 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7240 LDKChannelDetails this_ptr_conv;
7241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7242 this_ptr_conv.is_owned = false;
7243 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7248 LDKChannelDetails this_ptr_conv;
7249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7250 this_ptr_conv.is_owned = false;
7251 ChannelDetails_set_user_id(&this_ptr_conv, val);
7254 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7255 LDKChannelDetails this_ptr_conv;
7256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7257 this_ptr_conv.is_owned = false;
7258 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7263 LDKChannelDetails this_ptr_conv;
7264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7265 this_ptr_conv.is_owned = false;
7266 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7269 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7270 LDKChannelDetails this_ptr_conv;
7271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7272 this_ptr_conv.is_owned = false;
7273 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7278 LDKChannelDetails this_ptr_conv;
7279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7280 this_ptr_conv.is_owned = false;
7281 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7284 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
7285 LDKChannelDetails this_ptr_conv;
7286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7287 this_ptr_conv.is_owned = false;
7288 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7293 LDKChannelDetails this_ptr_conv;
7294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7295 this_ptr_conv.is_owned = false;
7296 ChannelDetails_set_is_live(&this_ptr_conv, val);
7299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7300 LDKPaymentSendFailure this_ptr_conv;
7301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7303 PaymentSendFailure_free(this_ptr_conv);
7306 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) {
7307 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7308 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7309 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7310 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7311 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7313 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7314 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7315 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7316 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7318 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7319 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7320 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7321 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7323 LDKLogger logger_conv = *(LDKLogger*)logger;
7324 if (logger_conv.free == LDKLogger_JCalls_free) {
7325 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7326 LDKLogger_JCalls_clone(logger_conv.this_arg);
7328 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7329 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7330 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7331 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7333 LDKUserConfig config_conv;
7334 config_conv.inner = (void*)(config & (~1));
7335 config_conv.is_owned = (config & 1) || (config == 0);
7336 if (config_conv.inner != NULL)
7337 config_conv = UserConfig_clone(&config_conv);
7338 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);
7339 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7340 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7341 long ret_ref = (long)ret_var.inner;
7342 if (ret_var.is_owned) {
7348 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) {
7349 LDKChannelManager this_arg_conv;
7350 this_arg_conv.inner = (void*)(this_arg & (~1));
7351 this_arg_conv.is_owned = false;
7352 LDKPublicKey their_network_key_ref;
7353 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7354 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7355 LDKUserConfig override_config_conv;
7356 override_config_conv.inner = (void*)(override_config & (~1));
7357 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7358 if (override_config_conv.inner != NULL)
7359 override_config_conv = UserConfig_clone(&override_config_conv);
7360 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7361 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7362 return (long)ret_conv;
7365 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7366 LDKChannelManager this_arg_conv;
7367 this_arg_conv.inner = (void*)(this_arg & (~1));
7368 this_arg_conv.is_owned = false;
7369 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7370 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7371 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7372 for (size_t q = 0; q < ret_var.datalen; q++) {
7373 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7374 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7375 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7376 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7377 if (arr_conv_16_var.is_owned) {
7378 arr_conv_16_ref |= 1;
7380 ret_arr_ptr[q] = arr_conv_16_ref;
7382 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7387 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7388 LDKChannelManager this_arg_conv;
7389 this_arg_conv.inner = (void*)(this_arg & (~1));
7390 this_arg_conv.is_owned = false;
7391 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7392 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7393 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7394 for (size_t q = 0; q < ret_var.datalen; q++) {
7395 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7396 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7397 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7398 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7399 if (arr_conv_16_var.is_owned) {
7400 arr_conv_16_ref |= 1;
7402 ret_arr_ptr[q] = arr_conv_16_ref;
7404 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7410 LDKChannelManager this_arg_conv;
7411 this_arg_conv.inner = (void*)(this_arg & (~1));
7412 this_arg_conv.is_owned = false;
7413 unsigned char channel_id_arr[32];
7414 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7415 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7416 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7417 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7418 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7419 return (long)ret_conv;
7422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7423 LDKChannelManager this_arg_conv;
7424 this_arg_conv.inner = (void*)(this_arg & (~1));
7425 this_arg_conv.is_owned = false;
7426 unsigned char channel_id_arr[32];
7427 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7428 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7429 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7430 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7434 LDKChannelManager this_arg_conv;
7435 this_arg_conv.inner = (void*)(this_arg & (~1));
7436 this_arg_conv.is_owned = false;
7437 ChannelManager_force_close_all_channels(&this_arg_conv);
7440 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) {
7441 LDKChannelManager this_arg_conv;
7442 this_arg_conv.inner = (void*)(this_arg & (~1));
7443 this_arg_conv.is_owned = false;
7444 LDKRoute route_conv;
7445 route_conv.inner = (void*)(route & (~1));
7446 route_conv.is_owned = false;
7447 LDKThirtyTwoBytes payment_hash_ref;
7448 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7449 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7450 LDKThirtyTwoBytes payment_secret_ref;
7451 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7452 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7453 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7454 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7455 return (long)ret_conv;
7458 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) {
7459 LDKChannelManager this_arg_conv;
7460 this_arg_conv.inner = (void*)(this_arg & (~1));
7461 this_arg_conv.is_owned = false;
7462 unsigned char temporary_channel_id_arr[32];
7463 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7464 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7465 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7466 LDKOutPoint funding_txo_conv;
7467 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7468 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7469 if (funding_txo_conv.inner != NULL)
7470 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7471 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7474 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) {
7475 LDKChannelManager this_arg_conv;
7476 this_arg_conv.inner = (void*)(this_arg & (~1));
7477 this_arg_conv.is_owned = false;
7478 LDKThreeBytes rgb_ref;
7479 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7480 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7481 LDKThirtyTwoBytes alias_ref;
7482 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7483 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7484 LDKCVec_NetAddressZ addresses_constr;
7485 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7486 if (addresses_constr.datalen > 0)
7487 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7489 addresses_constr.data = NULL;
7490 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7491 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7492 long arr_conv_12 = addresses_vals[m];
7493 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7494 FREE((void*)arr_conv_12);
7495 addresses_constr.data[m] = arr_conv_12_conv;
7497 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7498 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7502 LDKChannelManager this_arg_conv;
7503 this_arg_conv.inner = (void*)(this_arg & (~1));
7504 this_arg_conv.is_owned = false;
7505 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7509 LDKChannelManager this_arg_conv;
7510 this_arg_conv.inner = (void*)(this_arg & (~1));
7511 this_arg_conv.is_owned = false;
7512 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7515 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) {
7516 LDKChannelManager this_arg_conv;
7517 this_arg_conv.inner = (void*)(this_arg & (~1));
7518 this_arg_conv.is_owned = false;
7519 unsigned char payment_hash_arr[32];
7520 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7521 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7522 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7523 LDKThirtyTwoBytes payment_secret_ref;
7524 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7525 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7526 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7530 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) {
7531 LDKChannelManager this_arg_conv;
7532 this_arg_conv.inner = (void*)(this_arg & (~1));
7533 this_arg_conv.is_owned = false;
7534 LDKThirtyTwoBytes payment_preimage_ref;
7535 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7536 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7537 LDKThirtyTwoBytes payment_secret_ref;
7538 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7539 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7540 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7544 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7545 LDKChannelManager this_arg_conv;
7546 this_arg_conv.inner = (void*)(this_arg & (~1));
7547 this_arg_conv.is_owned = false;
7548 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7549 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7553 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) {
7554 LDKChannelManager this_arg_conv;
7555 this_arg_conv.inner = (void*)(this_arg & (~1));
7556 this_arg_conv.is_owned = false;
7557 LDKOutPoint funding_txo_conv;
7558 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7559 funding_txo_conv.is_owned = false;
7560 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7564 LDKChannelManager this_arg_conv;
7565 this_arg_conv.inner = (void*)(this_arg & (~1));
7566 this_arg_conv.is_owned = false;
7567 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7568 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7572 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7573 LDKChannelManager this_arg_conv;
7574 this_arg_conv.inner = (void*)(this_arg & (~1));
7575 this_arg_conv.is_owned = false;
7576 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7577 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7582 LDKChannelManager this_arg_conv;
7583 this_arg_conv.inner = (void*)(this_arg & (~1));
7584 this_arg_conv.is_owned = false;
7585 unsigned char header_arr[80];
7586 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7587 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7588 unsigned char (*header_ref)[80] = &header_arr;
7589 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7590 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7591 if (txdata_constr.datalen > 0)
7592 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7594 txdata_constr.data = NULL;
7595 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7596 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7597 long arr_conv_24 = txdata_vals[y];
7598 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
7599 FREE((void*)arr_conv_24);
7600 txdata_constr.data[y] = arr_conv_24_conv;
7602 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7603 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7607 LDKChannelManager this_arg_conv;
7608 this_arg_conv.inner = (void*)(this_arg & (~1));
7609 this_arg_conv.is_owned = false;
7610 unsigned char header_arr[80];
7611 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7612 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7613 unsigned char (*header_ref)[80] = &header_arr;
7614 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7618 LDKChannelManager this_arg_conv;
7619 this_arg_conv.inner = (void*)(this_arg & (~1));
7620 this_arg_conv.is_owned = false;
7621 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7622 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7626 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
7627 LDKChannelManager this_ptr_conv;
7628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7629 this_ptr_conv.is_owned = false;
7630 LDKCVec_u8Z arg_var = ChannelManager_write(&this_ptr_conv);
7631 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7632 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7633 CVec_u8Z_free(arg_var);
7637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7638 LDKChannelManagerReadArgs this_ptr_conv;
7639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7641 ChannelManagerReadArgs_free(this_ptr_conv);
7644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7645 LDKChannelManagerReadArgs this_ptr_conv;
7646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7647 this_ptr_conv.is_owned = false;
7648 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7652 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7653 LDKChannelManagerReadArgs this_ptr_conv;
7654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7655 this_ptr_conv.is_owned = false;
7656 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7657 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7658 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7659 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7661 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7664 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7665 LDKChannelManagerReadArgs this_ptr_conv;
7666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7667 this_ptr_conv.is_owned = false;
7668 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7673 LDKChannelManagerReadArgs this_ptr_conv;
7674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7675 this_ptr_conv.is_owned = false;
7676 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7677 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7678 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7679 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7681 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7685 LDKChannelManagerReadArgs this_ptr_conv;
7686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7687 this_ptr_conv.is_owned = false;
7688 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7693 LDKChannelManagerReadArgs this_ptr_conv;
7694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7695 this_ptr_conv.is_owned = false;
7696 LDKWatch val_conv = *(LDKWatch*)val;
7697 if (val_conv.free == LDKWatch_JCalls_free) {
7698 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7699 LDKWatch_JCalls_clone(val_conv.this_arg);
7701 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7704 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7705 LDKChannelManagerReadArgs this_ptr_conv;
7706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7707 this_ptr_conv.is_owned = false;
7708 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7713 LDKChannelManagerReadArgs this_ptr_conv;
7714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7715 this_ptr_conv.is_owned = false;
7716 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7717 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7718 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7719 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7721 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7725 LDKChannelManagerReadArgs this_ptr_conv;
7726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7727 this_ptr_conv.is_owned = false;
7728 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7733 LDKChannelManagerReadArgs this_ptr_conv;
7734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7735 this_ptr_conv.is_owned = false;
7736 LDKLogger val_conv = *(LDKLogger*)val;
7737 if (val_conv.free == LDKLogger_JCalls_free) {
7738 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7739 LDKLogger_JCalls_clone(val_conv.this_arg);
7741 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7745 LDKChannelManagerReadArgs this_ptr_conv;
7746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7747 this_ptr_conv.is_owned = false;
7748 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7749 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7750 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7751 long ret_ref = (long)ret_var.inner;
7752 if (ret_var.is_owned) {
7758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7759 LDKChannelManagerReadArgs this_ptr_conv;
7760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7761 this_ptr_conv.is_owned = false;
7762 LDKUserConfig val_conv;
7763 val_conv.inner = (void*)(val & (~1));
7764 val_conv.is_owned = (val & 1) || (val == 0);
7765 if (val_conv.inner != NULL)
7766 val_conv = UserConfig_clone(&val_conv);
7767 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7770 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) {
7771 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7772 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7773 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7774 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7776 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7777 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7778 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7779 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7781 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7782 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7783 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7784 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7786 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7787 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7788 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7789 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7791 LDKLogger logger_conv = *(LDKLogger*)logger;
7792 if (logger_conv.free == LDKLogger_JCalls_free) {
7793 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7794 LDKLogger_JCalls_clone(logger_conv.this_arg);
7796 LDKUserConfig default_config_conv;
7797 default_config_conv.inner = (void*)(default_config & (~1));
7798 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7799 if (default_config_conv.inner != NULL)
7800 default_config_conv = UserConfig_clone(&default_config_conv);
7801 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7802 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7803 if (channel_monitors_constr.datalen > 0)
7804 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7806 channel_monitors_constr.data = NULL;
7807 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7808 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7809 long arr_conv_16 = channel_monitors_vals[q];
7810 LDKChannelMonitor arr_conv_16_conv;
7811 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7812 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7813 channel_monitors_constr.data[q] = arr_conv_16_conv;
7815 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7816 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);
7817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7819 long ret_ref = (long)ret_var.inner;
7820 if (ret_var.is_owned) {
7826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7827 LDKDecodeError this_ptr_conv;
7828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7830 DecodeError_free(this_ptr_conv);
7833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7834 LDKInit this_ptr_conv;
7835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7837 Init_free(this_ptr_conv);
7840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7842 orig_conv.inner = (void*)(orig & (~1));
7843 orig_conv.is_owned = false;
7844 LDKInit ret_var = Init_clone(&orig_conv);
7845 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7846 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7847 long ret_ref = (long)ret_var.inner;
7848 if (ret_var.is_owned) {
7854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7855 LDKErrorMessage this_ptr_conv;
7856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7858 ErrorMessage_free(this_ptr_conv);
7861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7862 LDKErrorMessage orig_conv;
7863 orig_conv.inner = (void*)(orig & (~1));
7864 orig_conv.is_owned = false;
7865 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7866 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7867 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7868 long ret_ref = (long)ret_var.inner;
7869 if (ret_var.is_owned) {
7875 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7876 LDKErrorMessage this_ptr_conv;
7877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7878 this_ptr_conv.is_owned = false;
7879 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7880 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7885 LDKErrorMessage this_ptr_conv;
7886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7887 this_ptr_conv.is_owned = false;
7888 LDKThirtyTwoBytes val_ref;
7889 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7890 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7891 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7894 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7895 LDKErrorMessage this_ptr_conv;
7896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7897 this_ptr_conv.is_owned = false;
7898 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7899 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7900 memcpy(_buf, _str.chars, _str.len);
7902 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7908 LDKErrorMessage this_ptr_conv;
7909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7910 this_ptr_conv.is_owned = false;
7911 LDKCVec_u8Z val_ref;
7912 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7913 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
7914 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
7915 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7918 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7919 LDKThirtyTwoBytes channel_id_arg_ref;
7920 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7921 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7922 LDKCVec_u8Z data_arg_ref;
7923 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7924 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
7925 (*_env)->GetByteArrayRegion(_env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
7926 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7927 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7928 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7929 long ret_ref = (long)ret_var.inner;
7930 if (ret_var.is_owned) {
7936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7937 LDKPing this_ptr_conv;
7938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7940 Ping_free(this_ptr_conv);
7943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7945 orig_conv.inner = (void*)(orig & (~1));
7946 orig_conv.is_owned = false;
7947 LDKPing ret_var = Ping_clone(&orig_conv);
7948 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7949 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7950 long ret_ref = (long)ret_var.inner;
7951 if (ret_var.is_owned) {
7957 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7958 LDKPing this_ptr_conv;
7959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7960 this_ptr_conv.is_owned = false;
7961 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7966 LDKPing this_ptr_conv;
7967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7968 this_ptr_conv.is_owned = false;
7969 Ping_set_ponglen(&this_ptr_conv, val);
7972 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7973 LDKPing this_ptr_conv;
7974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7975 this_ptr_conv.is_owned = false;
7976 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7981 LDKPing this_ptr_conv;
7982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7983 this_ptr_conv.is_owned = false;
7984 Ping_set_byteslen(&this_ptr_conv, val);
7987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7988 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7989 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7990 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7991 long ret_ref = (long)ret_var.inner;
7992 if (ret_var.is_owned) {
7998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7999 LDKPong this_ptr_conv;
8000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8002 Pong_free(this_ptr_conv);
8005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8007 orig_conv.inner = (void*)(orig & (~1));
8008 orig_conv.is_owned = false;
8009 LDKPong ret_var = Pong_clone(&orig_conv);
8010 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8011 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8012 long ret_ref = (long)ret_var.inner;
8013 if (ret_var.is_owned) {
8019 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
8020 LDKPong this_ptr_conv;
8021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8022 this_ptr_conv.is_owned = false;
8023 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
8027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8028 LDKPong this_ptr_conv;
8029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8030 this_ptr_conv.is_owned = false;
8031 Pong_set_byteslen(&this_ptr_conv, val);
8034 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
8035 LDKPong ret_var = Pong_new(byteslen_arg);
8036 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8037 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8038 long ret_ref = (long)ret_var.inner;
8039 if (ret_var.is_owned) {
8045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8046 LDKOpenChannel this_ptr_conv;
8047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8049 OpenChannel_free(this_ptr_conv);
8052 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8053 LDKOpenChannel orig_conv;
8054 orig_conv.inner = (void*)(orig & (~1));
8055 orig_conv.is_owned = false;
8056 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
8057 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8058 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8059 long ret_ref = (long)ret_var.inner;
8060 if (ret_var.is_owned) {
8066 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8067 LDKOpenChannel this_ptr_conv;
8068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8069 this_ptr_conv.is_owned = false;
8070 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8071 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
8075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8076 LDKOpenChannel this_ptr_conv;
8077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8078 this_ptr_conv.is_owned = false;
8079 LDKThirtyTwoBytes val_ref;
8080 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8081 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8082 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
8085 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8086 LDKOpenChannel this_ptr_conv;
8087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8088 this_ptr_conv.is_owned = false;
8089 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8090 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
8094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8095 LDKOpenChannel this_ptr_conv;
8096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8097 this_ptr_conv.is_owned = false;
8098 LDKThirtyTwoBytes val_ref;
8099 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8100 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8101 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8105 LDKOpenChannel this_ptr_conv;
8106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8107 this_ptr_conv.is_owned = false;
8108 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
8112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8113 LDKOpenChannel this_ptr_conv;
8114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8115 this_ptr_conv.is_owned = false;
8116 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
8119 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8120 LDKOpenChannel this_ptr_conv;
8121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8122 this_ptr_conv.is_owned = false;
8123 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
8127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8128 LDKOpenChannel this_ptr_conv;
8129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8130 this_ptr_conv.is_owned = false;
8131 OpenChannel_set_push_msat(&this_ptr_conv, val);
8134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8135 LDKOpenChannel this_ptr_conv;
8136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8137 this_ptr_conv.is_owned = false;
8138 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
8142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8143 LDKOpenChannel this_ptr_conv;
8144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8145 this_ptr_conv.is_owned = false;
8146 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8149 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8150 LDKOpenChannel this_ptr_conv;
8151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8152 this_ptr_conv.is_owned = false;
8153 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8157 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) {
8158 LDKOpenChannel this_ptr_conv;
8159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8160 this_ptr_conv.is_owned = false;
8161 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8165 LDKOpenChannel this_ptr_conv;
8166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8167 this_ptr_conv.is_owned = false;
8168 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8172 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8173 LDKOpenChannel this_ptr_conv;
8174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8175 this_ptr_conv.is_owned = false;
8176 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8180 LDKOpenChannel this_ptr_conv;
8181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8182 this_ptr_conv.is_owned = false;
8183 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8188 LDKOpenChannel this_ptr_conv;
8189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8190 this_ptr_conv.is_owned = false;
8191 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8194 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8195 LDKOpenChannel this_ptr_conv;
8196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8197 this_ptr_conv.is_owned = false;
8198 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8203 LDKOpenChannel this_ptr_conv;
8204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8205 this_ptr_conv.is_owned = false;
8206 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8209 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8210 LDKOpenChannel this_ptr_conv;
8211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8212 this_ptr_conv.is_owned = false;
8213 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8218 LDKOpenChannel this_ptr_conv;
8219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8220 this_ptr_conv.is_owned = false;
8221 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8224 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8225 LDKOpenChannel this_ptr_conv;
8226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8227 this_ptr_conv.is_owned = false;
8228 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8233 LDKOpenChannel this_ptr_conv;
8234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8235 this_ptr_conv.is_owned = false;
8236 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8239 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8240 LDKOpenChannel this_ptr_conv;
8241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8242 this_ptr_conv.is_owned = false;
8243 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8244 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8249 LDKOpenChannel this_ptr_conv;
8250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8251 this_ptr_conv.is_owned = false;
8252 LDKPublicKey val_ref;
8253 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8254 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8255 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8258 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8259 LDKOpenChannel this_ptr_conv;
8260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8261 this_ptr_conv.is_owned = false;
8262 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8263 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8268 LDKOpenChannel this_ptr_conv;
8269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8270 this_ptr_conv.is_owned = false;
8271 LDKPublicKey val_ref;
8272 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8273 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8274 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8277 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8278 LDKOpenChannel this_ptr_conv;
8279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8280 this_ptr_conv.is_owned = false;
8281 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8282 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
8286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8287 LDKOpenChannel this_ptr_conv;
8288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8289 this_ptr_conv.is_owned = false;
8290 LDKPublicKey val_ref;
8291 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8292 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8293 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8296 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8297 LDKOpenChannel this_ptr_conv;
8298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8299 this_ptr_conv.is_owned = false;
8300 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8301 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8306 LDKOpenChannel this_ptr_conv;
8307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8308 this_ptr_conv.is_owned = false;
8309 LDKPublicKey val_ref;
8310 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8311 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8312 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8315 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8316 LDKOpenChannel this_ptr_conv;
8317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8318 this_ptr_conv.is_owned = false;
8319 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8320 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8324 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8325 LDKOpenChannel this_ptr_conv;
8326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8327 this_ptr_conv.is_owned = false;
8328 LDKPublicKey val_ref;
8329 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8330 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8331 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8334 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8335 LDKOpenChannel this_ptr_conv;
8336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8337 this_ptr_conv.is_owned = false;
8338 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8339 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8344 LDKOpenChannel this_ptr_conv;
8345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8346 this_ptr_conv.is_owned = false;
8347 LDKPublicKey val_ref;
8348 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8349 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8350 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8353 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8354 LDKOpenChannel this_ptr_conv;
8355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8356 this_ptr_conv.is_owned = false;
8357 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8362 LDKOpenChannel this_ptr_conv;
8363 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8364 this_ptr_conv.is_owned = false;
8365 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8369 LDKAcceptChannel this_ptr_conv;
8370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8372 AcceptChannel_free(this_ptr_conv);
8375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8376 LDKAcceptChannel orig_conv;
8377 orig_conv.inner = (void*)(orig & (~1));
8378 orig_conv.is_owned = false;
8379 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8380 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8381 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8382 long ret_ref = (long)ret_var.inner;
8383 if (ret_var.is_owned) {
8389 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8390 LDKAcceptChannel this_ptr_conv;
8391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8392 this_ptr_conv.is_owned = false;
8393 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8394 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8399 LDKAcceptChannel this_ptr_conv;
8400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8401 this_ptr_conv.is_owned = false;
8402 LDKThirtyTwoBytes val_ref;
8403 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8404 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8405 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8408 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8409 LDKAcceptChannel this_ptr_conv;
8410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8411 this_ptr_conv.is_owned = false;
8412 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8417 LDKAcceptChannel this_ptr_conv;
8418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8419 this_ptr_conv.is_owned = false;
8420 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8424 LDKAcceptChannel this_ptr_conv;
8425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8426 this_ptr_conv.is_owned = false;
8427 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8431 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) {
8432 LDKAcceptChannel this_ptr_conv;
8433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8434 this_ptr_conv.is_owned = false;
8435 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8439 LDKAcceptChannel this_ptr_conv;
8440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8441 this_ptr_conv.is_owned = false;
8442 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8447 LDKAcceptChannel this_ptr_conv;
8448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8449 this_ptr_conv.is_owned = false;
8450 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8454 LDKAcceptChannel this_ptr_conv;
8455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8456 this_ptr_conv.is_owned = false;
8457 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8462 LDKAcceptChannel this_ptr_conv;
8463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8464 this_ptr_conv.is_owned = false;
8465 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8468 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8469 LDKAcceptChannel this_ptr_conv;
8470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8471 this_ptr_conv.is_owned = false;
8472 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8477 LDKAcceptChannel this_ptr_conv;
8478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8479 this_ptr_conv.is_owned = false;
8480 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8483 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8484 LDKAcceptChannel this_ptr_conv;
8485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8486 this_ptr_conv.is_owned = false;
8487 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8492 LDKAcceptChannel this_ptr_conv;
8493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8494 this_ptr_conv.is_owned = false;
8495 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8498 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8499 LDKAcceptChannel this_ptr_conv;
8500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8501 this_ptr_conv.is_owned = false;
8502 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8507 LDKAcceptChannel this_ptr_conv;
8508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8509 this_ptr_conv.is_owned = false;
8510 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8513 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8514 LDKAcceptChannel this_ptr_conv;
8515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8516 this_ptr_conv.is_owned = false;
8517 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8518 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8523 LDKAcceptChannel this_ptr_conv;
8524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8525 this_ptr_conv.is_owned = false;
8526 LDKPublicKey val_ref;
8527 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8528 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8529 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8532 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8533 LDKAcceptChannel this_ptr_conv;
8534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8535 this_ptr_conv.is_owned = false;
8536 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8537 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8542 LDKAcceptChannel this_ptr_conv;
8543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8544 this_ptr_conv.is_owned = false;
8545 LDKPublicKey val_ref;
8546 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8547 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8548 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8551 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8552 LDKAcceptChannel this_ptr_conv;
8553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8554 this_ptr_conv.is_owned = false;
8555 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8556 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8561 LDKAcceptChannel this_ptr_conv;
8562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8563 this_ptr_conv.is_owned = false;
8564 LDKPublicKey val_ref;
8565 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8566 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8567 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8570 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8571 LDKAcceptChannel this_ptr_conv;
8572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8573 this_ptr_conv.is_owned = false;
8574 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8575 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8580 LDKAcceptChannel this_ptr_conv;
8581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8582 this_ptr_conv.is_owned = false;
8583 LDKPublicKey val_ref;
8584 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8585 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8586 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8589 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8590 LDKAcceptChannel this_ptr_conv;
8591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8592 this_ptr_conv.is_owned = false;
8593 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8594 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8599 LDKAcceptChannel this_ptr_conv;
8600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8601 this_ptr_conv.is_owned = false;
8602 LDKPublicKey val_ref;
8603 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8604 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8605 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8608 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8609 LDKAcceptChannel this_ptr_conv;
8610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8611 this_ptr_conv.is_owned = false;
8612 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8613 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8618 LDKAcceptChannel this_ptr_conv;
8619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8620 this_ptr_conv.is_owned = false;
8621 LDKPublicKey val_ref;
8622 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8623 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8624 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8628 LDKFundingCreated this_ptr_conv;
8629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8631 FundingCreated_free(this_ptr_conv);
8634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8635 LDKFundingCreated orig_conv;
8636 orig_conv.inner = (void*)(orig & (~1));
8637 orig_conv.is_owned = false;
8638 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8639 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8640 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8641 long ret_ref = (long)ret_var.inner;
8642 if (ret_var.is_owned) {
8648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8649 LDKFundingCreated this_ptr_conv;
8650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8651 this_ptr_conv.is_owned = false;
8652 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8653 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8658 LDKFundingCreated this_ptr_conv;
8659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8660 this_ptr_conv.is_owned = false;
8661 LDKThirtyTwoBytes val_ref;
8662 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8663 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8664 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8667 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8668 LDKFundingCreated this_ptr_conv;
8669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8670 this_ptr_conv.is_owned = false;
8671 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8672 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8677 LDKFundingCreated this_ptr_conv;
8678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8679 this_ptr_conv.is_owned = false;
8680 LDKThirtyTwoBytes val_ref;
8681 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8682 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8683 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8686 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8687 LDKFundingCreated this_ptr_conv;
8688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8689 this_ptr_conv.is_owned = false;
8690 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8695 LDKFundingCreated this_ptr_conv;
8696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8697 this_ptr_conv.is_owned = false;
8698 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8701 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8702 LDKFundingCreated this_ptr_conv;
8703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8704 this_ptr_conv.is_owned = false;
8705 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8706 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8711 LDKFundingCreated this_ptr_conv;
8712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8713 this_ptr_conv.is_owned = false;
8714 LDKSignature val_ref;
8715 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8716 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8717 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8720 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) {
8721 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8722 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8723 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8724 LDKThirtyTwoBytes funding_txid_arg_ref;
8725 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8726 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8727 LDKSignature signature_arg_ref;
8728 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8729 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8730 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8731 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8732 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8733 long ret_ref = (long)ret_var.inner;
8734 if (ret_var.is_owned) {
8740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8741 LDKFundingSigned this_ptr_conv;
8742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8743 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8744 FundingSigned_free(this_ptr_conv);
8747 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8748 LDKFundingSigned orig_conv;
8749 orig_conv.inner = (void*)(orig & (~1));
8750 orig_conv.is_owned = false;
8751 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8752 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8753 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8754 long ret_ref = (long)ret_var.inner;
8755 if (ret_var.is_owned) {
8761 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8762 LDKFundingSigned this_ptr_conv;
8763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8764 this_ptr_conv.is_owned = false;
8765 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8766 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8771 LDKFundingSigned this_ptr_conv;
8772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8773 this_ptr_conv.is_owned = false;
8774 LDKThirtyTwoBytes val_ref;
8775 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8776 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8777 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8780 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8781 LDKFundingSigned this_ptr_conv;
8782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8783 this_ptr_conv.is_owned = false;
8784 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8785 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8790 LDKFundingSigned this_ptr_conv;
8791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8792 this_ptr_conv.is_owned = false;
8793 LDKSignature val_ref;
8794 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8795 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8796 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8800 LDKThirtyTwoBytes channel_id_arg_ref;
8801 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8802 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8803 LDKSignature signature_arg_ref;
8804 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8805 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8806 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8807 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8808 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8809 long ret_ref = (long)ret_var.inner;
8810 if (ret_var.is_owned) {
8816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8817 LDKFundingLocked this_ptr_conv;
8818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8820 FundingLocked_free(this_ptr_conv);
8823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8824 LDKFundingLocked orig_conv;
8825 orig_conv.inner = (void*)(orig & (~1));
8826 orig_conv.is_owned = false;
8827 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8828 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8829 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8830 long ret_ref = (long)ret_var.inner;
8831 if (ret_var.is_owned) {
8837 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8838 LDKFundingLocked this_ptr_conv;
8839 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8840 this_ptr_conv.is_owned = false;
8841 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8842 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8847 LDKFundingLocked this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = false;
8850 LDKThirtyTwoBytes val_ref;
8851 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8852 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8853 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8856 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8857 LDKFundingLocked this_ptr_conv;
8858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8859 this_ptr_conv.is_owned = false;
8860 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8861 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8866 LDKFundingLocked this_ptr_conv;
8867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8868 this_ptr_conv.is_owned = false;
8869 LDKPublicKey val_ref;
8870 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8871 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8872 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8876 LDKThirtyTwoBytes channel_id_arg_ref;
8877 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8878 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8879 LDKPublicKey next_per_commitment_point_arg_ref;
8880 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8881 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8882 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8883 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8884 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8885 long ret_ref = (long)ret_var.inner;
8886 if (ret_var.is_owned) {
8892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8893 LDKShutdown this_ptr_conv;
8894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8896 Shutdown_free(this_ptr_conv);
8899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8900 LDKShutdown orig_conv;
8901 orig_conv.inner = (void*)(orig & (~1));
8902 orig_conv.is_owned = false;
8903 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8904 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8905 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8906 long ret_ref = (long)ret_var.inner;
8907 if (ret_var.is_owned) {
8913 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8914 LDKShutdown this_ptr_conv;
8915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8916 this_ptr_conv.is_owned = false;
8917 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8918 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8923 LDKShutdown this_ptr_conv;
8924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8925 this_ptr_conv.is_owned = false;
8926 LDKThirtyTwoBytes val_ref;
8927 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8928 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8929 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8932 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8933 LDKShutdown this_ptr_conv;
8934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8935 this_ptr_conv.is_owned = false;
8936 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8937 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8938 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8943 LDKShutdown this_ptr_conv;
8944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8945 this_ptr_conv.is_owned = false;
8946 LDKCVec_u8Z val_ref;
8947 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8948 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
8949 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
8950 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8954 LDKThirtyTwoBytes channel_id_arg_ref;
8955 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8956 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8957 LDKCVec_u8Z scriptpubkey_arg_ref;
8958 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8959 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
8960 (*_env)->GetByteArrayRegion(_env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
8961 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8962 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8963 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8964 long ret_ref = (long)ret_var.inner;
8965 if (ret_var.is_owned) {
8971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8972 LDKClosingSigned this_ptr_conv;
8973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8974 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8975 ClosingSigned_free(this_ptr_conv);
8978 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8979 LDKClosingSigned orig_conv;
8980 orig_conv.inner = (void*)(orig & (~1));
8981 orig_conv.is_owned = false;
8982 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8983 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8984 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8985 long ret_ref = (long)ret_var.inner;
8986 if (ret_var.is_owned) {
8992 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8993 LDKClosingSigned this_ptr_conv;
8994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8995 this_ptr_conv.is_owned = false;
8996 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8997 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
9001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9002 LDKClosingSigned this_ptr_conv;
9003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9004 this_ptr_conv.is_owned = false;
9005 LDKThirtyTwoBytes val_ref;
9006 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9007 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9008 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
9011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
9012 LDKClosingSigned this_ptr_conv;
9013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9014 this_ptr_conv.is_owned = false;
9015 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
9019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9020 LDKClosingSigned this_ptr_conv;
9021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9022 this_ptr_conv.is_owned = false;
9023 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
9026 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9027 LDKClosingSigned this_ptr_conv;
9028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9029 this_ptr_conv.is_owned = false;
9030 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9031 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
9035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9036 LDKClosingSigned this_ptr_conv;
9037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9038 this_ptr_conv.is_owned = false;
9039 LDKSignature val_ref;
9040 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9041 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9042 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
9045 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) {
9046 LDKThirtyTwoBytes channel_id_arg_ref;
9047 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9048 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9049 LDKSignature signature_arg_ref;
9050 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9051 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9052 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
9053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9055 long ret_ref = (long)ret_var.inner;
9056 if (ret_var.is_owned) {
9062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9063 LDKUpdateAddHTLC this_ptr_conv;
9064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9066 UpdateAddHTLC_free(this_ptr_conv);
9069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9070 LDKUpdateAddHTLC orig_conv;
9071 orig_conv.inner = (void*)(orig & (~1));
9072 orig_conv.is_owned = false;
9073 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
9074 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9075 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9076 long ret_ref = (long)ret_var.inner;
9077 if (ret_var.is_owned) {
9083 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9084 LDKUpdateAddHTLC this_ptr_conv;
9085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9086 this_ptr_conv.is_owned = false;
9087 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9088 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
9092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9093 LDKUpdateAddHTLC this_ptr_conv;
9094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9095 this_ptr_conv.is_owned = false;
9096 LDKThirtyTwoBytes val_ref;
9097 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9098 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9099 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
9102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9103 LDKUpdateAddHTLC this_ptr_conv;
9104 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9105 this_ptr_conv.is_owned = false;
9106 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
9110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9111 LDKUpdateAddHTLC this_ptr_conv;
9112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9113 this_ptr_conv.is_owned = false;
9114 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
9117 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9118 LDKUpdateAddHTLC this_ptr_conv;
9119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9120 this_ptr_conv.is_owned = false;
9121 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
9125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9126 LDKUpdateAddHTLC this_ptr_conv;
9127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9128 this_ptr_conv.is_owned = false;
9129 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
9132 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9133 LDKUpdateAddHTLC this_ptr_conv;
9134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9135 this_ptr_conv.is_owned = false;
9136 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9137 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
9141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9142 LDKUpdateAddHTLC this_ptr_conv;
9143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9144 this_ptr_conv.is_owned = false;
9145 LDKThirtyTwoBytes val_ref;
9146 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9147 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9148 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
9151 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
9152 LDKUpdateAddHTLC this_ptr_conv;
9153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9154 this_ptr_conv.is_owned = false;
9155 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
9159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9160 LDKUpdateAddHTLC this_ptr_conv;
9161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9162 this_ptr_conv.is_owned = false;
9163 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9167 LDKUpdateFulfillHTLC this_ptr_conv;
9168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9169 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9170 UpdateFulfillHTLC_free(this_ptr_conv);
9173 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9174 LDKUpdateFulfillHTLC orig_conv;
9175 orig_conv.inner = (void*)(orig & (~1));
9176 orig_conv.is_owned = false;
9177 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9178 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9179 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9180 long ret_ref = (long)ret_var.inner;
9181 if (ret_var.is_owned) {
9187 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9188 LDKUpdateFulfillHTLC this_ptr_conv;
9189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9190 this_ptr_conv.is_owned = false;
9191 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9192 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
9196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9197 LDKUpdateFulfillHTLC this_ptr_conv;
9198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9199 this_ptr_conv.is_owned = false;
9200 LDKThirtyTwoBytes val_ref;
9201 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9202 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9203 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9207 LDKUpdateFulfillHTLC this_ptr_conv;
9208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9209 this_ptr_conv.is_owned = false;
9210 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9215 LDKUpdateFulfillHTLC this_ptr_conv;
9216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9217 this_ptr_conv.is_owned = false;
9218 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9221 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
9222 LDKUpdateFulfillHTLC this_ptr_conv;
9223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9224 this_ptr_conv.is_owned = false;
9225 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9226 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
9230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9231 LDKUpdateFulfillHTLC this_ptr_conv;
9232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9233 this_ptr_conv.is_owned = false;
9234 LDKThirtyTwoBytes val_ref;
9235 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9236 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9237 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9240 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) {
9241 LDKThirtyTwoBytes channel_id_arg_ref;
9242 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9243 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9244 LDKThirtyTwoBytes payment_preimage_arg_ref;
9245 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
9246 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
9247 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9248 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9249 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9250 long ret_ref = (long)ret_var.inner;
9251 if (ret_var.is_owned) {
9257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9258 LDKUpdateFailHTLC this_ptr_conv;
9259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9261 UpdateFailHTLC_free(this_ptr_conv);
9264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9265 LDKUpdateFailHTLC orig_conv;
9266 orig_conv.inner = (void*)(orig & (~1));
9267 orig_conv.is_owned = false;
9268 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9269 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9270 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9271 long ret_ref = (long)ret_var.inner;
9272 if (ret_var.is_owned) {
9278 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9279 LDKUpdateFailHTLC this_ptr_conv;
9280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9281 this_ptr_conv.is_owned = false;
9282 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9283 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
9287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9288 LDKUpdateFailHTLC this_ptr_conv;
9289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9290 this_ptr_conv.is_owned = false;
9291 LDKThirtyTwoBytes val_ref;
9292 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9293 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9294 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9298 LDKUpdateFailHTLC this_ptr_conv;
9299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9300 this_ptr_conv.is_owned = false;
9301 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9306 LDKUpdateFailHTLC this_ptr_conv;
9307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9308 this_ptr_conv.is_owned = false;
9309 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9313 LDKUpdateFailMalformedHTLC this_ptr_conv;
9314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9316 UpdateFailMalformedHTLC_free(this_ptr_conv);
9319 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9320 LDKUpdateFailMalformedHTLC orig_conv;
9321 orig_conv.inner = (void*)(orig & (~1));
9322 orig_conv.is_owned = false;
9323 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9324 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9325 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9326 long ret_ref = (long)ret_var.inner;
9327 if (ret_var.is_owned) {
9333 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9334 LDKUpdateFailMalformedHTLC this_ptr_conv;
9335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9336 this_ptr_conv.is_owned = false;
9337 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9338 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9343 LDKUpdateFailMalformedHTLC this_ptr_conv;
9344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9345 this_ptr_conv.is_owned = false;
9346 LDKThirtyTwoBytes val_ref;
9347 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9348 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9349 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9353 LDKUpdateFailMalformedHTLC this_ptr_conv;
9354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9355 this_ptr_conv.is_owned = false;
9356 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9361 LDKUpdateFailMalformedHTLC this_ptr_conv;
9362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9363 this_ptr_conv.is_owned = false;
9364 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9367 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
9368 LDKUpdateFailMalformedHTLC this_ptr_conv;
9369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9370 this_ptr_conv.is_owned = false;
9371 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9376 LDKUpdateFailMalformedHTLC this_ptr_conv;
9377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9378 this_ptr_conv.is_owned = false;
9379 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9383 LDKCommitmentSigned this_ptr_conv;
9384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9385 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9386 CommitmentSigned_free(this_ptr_conv);
9389 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9390 LDKCommitmentSigned orig_conv;
9391 orig_conv.inner = (void*)(orig & (~1));
9392 orig_conv.is_owned = false;
9393 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9394 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9395 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9396 long ret_ref = (long)ret_var.inner;
9397 if (ret_var.is_owned) {
9403 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9404 LDKCommitmentSigned this_ptr_conv;
9405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9406 this_ptr_conv.is_owned = false;
9407 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9408 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9413 LDKCommitmentSigned this_ptr_conv;
9414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9415 this_ptr_conv.is_owned = false;
9416 LDKThirtyTwoBytes val_ref;
9417 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9418 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9419 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9422 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9423 LDKCommitmentSigned this_ptr_conv;
9424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9425 this_ptr_conv.is_owned = false;
9426 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9427 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9431 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9432 LDKCommitmentSigned this_ptr_conv;
9433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9434 this_ptr_conv.is_owned = false;
9435 LDKSignature val_ref;
9436 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9437 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9438 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9442 LDKCommitmentSigned this_ptr_conv;
9443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9444 this_ptr_conv.is_owned = false;
9445 LDKCVec_SignatureZ val_constr;
9446 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9447 if (val_constr.datalen > 0)
9448 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9450 val_constr.data = NULL;
9451 for (size_t i = 0; i < val_constr.datalen; i++) {
9452 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9453 LDKSignature arr_conv_8_ref;
9454 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9455 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9456 val_constr.data[i] = arr_conv_8_ref;
9458 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9461 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) {
9462 LDKThirtyTwoBytes channel_id_arg_ref;
9463 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9464 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9465 LDKSignature signature_arg_ref;
9466 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9467 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9468 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9469 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9470 if (htlc_signatures_arg_constr.datalen > 0)
9471 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9473 htlc_signatures_arg_constr.data = NULL;
9474 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9475 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9476 LDKSignature arr_conv_8_ref;
9477 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9478 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9479 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9481 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9482 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9483 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9484 long ret_ref = (long)ret_var.inner;
9485 if (ret_var.is_owned) {
9491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9492 LDKRevokeAndACK this_ptr_conv;
9493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9495 RevokeAndACK_free(this_ptr_conv);
9498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9499 LDKRevokeAndACK orig_conv;
9500 orig_conv.inner = (void*)(orig & (~1));
9501 orig_conv.is_owned = false;
9502 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9505 long ret_ref = (long)ret_var.inner;
9506 if (ret_var.is_owned) {
9512 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9513 LDKRevokeAndACK this_ptr_conv;
9514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9515 this_ptr_conv.is_owned = false;
9516 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9517 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9522 LDKRevokeAndACK this_ptr_conv;
9523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9524 this_ptr_conv.is_owned = false;
9525 LDKThirtyTwoBytes val_ref;
9526 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9527 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9528 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9531 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9532 LDKRevokeAndACK this_ptr_conv;
9533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9534 this_ptr_conv.is_owned = false;
9535 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9536 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9541 LDKRevokeAndACK this_ptr_conv;
9542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9543 this_ptr_conv.is_owned = false;
9544 LDKThirtyTwoBytes val_ref;
9545 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9546 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9547 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9550 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9551 LDKRevokeAndACK this_ptr_conv;
9552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9553 this_ptr_conv.is_owned = false;
9554 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9555 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9560 LDKRevokeAndACK this_ptr_conv;
9561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9562 this_ptr_conv.is_owned = false;
9563 LDKPublicKey val_ref;
9564 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9565 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9566 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9569 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) {
9570 LDKThirtyTwoBytes channel_id_arg_ref;
9571 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9572 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9573 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9574 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9575 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9576 LDKPublicKey next_per_commitment_point_arg_ref;
9577 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9578 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9579 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9582 long ret_ref = (long)ret_var.inner;
9583 if (ret_var.is_owned) {
9589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9590 LDKUpdateFee this_ptr_conv;
9591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9593 UpdateFee_free(this_ptr_conv);
9596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9597 LDKUpdateFee orig_conv;
9598 orig_conv.inner = (void*)(orig & (~1));
9599 orig_conv.is_owned = false;
9600 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9601 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9602 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9603 long ret_ref = (long)ret_var.inner;
9604 if (ret_var.is_owned) {
9610 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9611 LDKUpdateFee this_ptr_conv;
9612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9613 this_ptr_conv.is_owned = false;
9614 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9615 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9620 LDKUpdateFee this_ptr_conv;
9621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9622 this_ptr_conv.is_owned = false;
9623 LDKThirtyTwoBytes val_ref;
9624 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9625 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9626 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9629 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9630 LDKUpdateFee this_ptr_conv;
9631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9632 this_ptr_conv.is_owned = false;
9633 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9638 LDKUpdateFee this_ptr_conv;
9639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9640 this_ptr_conv.is_owned = false;
9641 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9645 LDKThirtyTwoBytes channel_id_arg_ref;
9646 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9647 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9648 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9649 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9650 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9651 long ret_ref = (long)ret_var.inner;
9652 if (ret_var.is_owned) {
9658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9659 LDKDataLossProtect this_ptr_conv;
9660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9662 DataLossProtect_free(this_ptr_conv);
9665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9666 LDKDataLossProtect orig_conv;
9667 orig_conv.inner = (void*)(orig & (~1));
9668 orig_conv.is_owned = false;
9669 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9670 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9671 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9672 long ret_ref = (long)ret_var.inner;
9673 if (ret_var.is_owned) {
9679 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9680 LDKDataLossProtect this_ptr_conv;
9681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9682 this_ptr_conv.is_owned = false;
9683 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9684 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9689 LDKDataLossProtect this_ptr_conv;
9690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9691 this_ptr_conv.is_owned = false;
9692 LDKThirtyTwoBytes val_ref;
9693 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9694 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9695 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9698 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9699 LDKDataLossProtect this_ptr_conv;
9700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9701 this_ptr_conv.is_owned = false;
9702 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9703 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9708 LDKDataLossProtect this_ptr_conv;
9709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9710 this_ptr_conv.is_owned = false;
9711 LDKPublicKey val_ref;
9712 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9713 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9714 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9717 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) {
9718 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9719 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9720 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9721 LDKPublicKey my_current_per_commitment_point_arg_ref;
9722 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9723 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9724 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9725 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9726 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9727 long ret_ref = (long)ret_var.inner;
9728 if (ret_var.is_owned) {
9734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9735 LDKChannelReestablish this_ptr_conv;
9736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9738 ChannelReestablish_free(this_ptr_conv);
9741 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9742 LDKChannelReestablish orig_conv;
9743 orig_conv.inner = (void*)(orig & (~1));
9744 orig_conv.is_owned = false;
9745 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9746 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9747 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9748 long ret_ref = (long)ret_var.inner;
9749 if (ret_var.is_owned) {
9755 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9756 LDKChannelReestablish this_ptr_conv;
9757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9758 this_ptr_conv.is_owned = false;
9759 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9760 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9765 LDKChannelReestablish this_ptr_conv;
9766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9767 this_ptr_conv.is_owned = false;
9768 LDKThirtyTwoBytes val_ref;
9769 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9770 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9771 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9775 LDKChannelReestablish this_ptr_conv;
9776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9777 this_ptr_conv.is_owned = false;
9778 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9783 LDKChannelReestablish this_ptr_conv;
9784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9785 this_ptr_conv.is_owned = false;
9786 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9789 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9790 LDKChannelReestablish this_ptr_conv;
9791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9792 this_ptr_conv.is_owned = false;
9793 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9798 LDKChannelReestablish this_ptr_conv;
9799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9800 this_ptr_conv.is_owned = false;
9801 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9805 LDKAnnouncementSignatures this_ptr_conv;
9806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9808 AnnouncementSignatures_free(this_ptr_conv);
9811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9812 LDKAnnouncementSignatures orig_conv;
9813 orig_conv.inner = (void*)(orig & (~1));
9814 orig_conv.is_owned = false;
9815 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9816 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9817 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9818 long ret_ref = (long)ret_var.inner;
9819 if (ret_var.is_owned) {
9825 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9826 LDKAnnouncementSignatures this_ptr_conv;
9827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9828 this_ptr_conv.is_owned = false;
9829 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9830 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9835 LDKAnnouncementSignatures this_ptr_conv;
9836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9837 this_ptr_conv.is_owned = false;
9838 LDKThirtyTwoBytes val_ref;
9839 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9840 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9841 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9845 LDKAnnouncementSignatures this_ptr_conv;
9846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9847 this_ptr_conv.is_owned = false;
9848 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9853 LDKAnnouncementSignatures this_ptr_conv;
9854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9855 this_ptr_conv.is_owned = false;
9856 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9859 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9860 LDKAnnouncementSignatures this_ptr_conv;
9861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9862 this_ptr_conv.is_owned = false;
9863 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9864 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9869 LDKAnnouncementSignatures this_ptr_conv;
9870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9871 this_ptr_conv.is_owned = false;
9872 LDKSignature val_ref;
9873 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9874 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9875 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9878 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9879 LDKAnnouncementSignatures this_ptr_conv;
9880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9881 this_ptr_conv.is_owned = false;
9882 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9883 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9888 LDKAnnouncementSignatures this_ptr_conv;
9889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9890 this_ptr_conv.is_owned = false;
9891 LDKSignature val_ref;
9892 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9893 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9894 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9897 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) {
9898 LDKThirtyTwoBytes channel_id_arg_ref;
9899 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9900 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9901 LDKSignature node_signature_arg_ref;
9902 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9903 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9904 LDKSignature bitcoin_signature_arg_ref;
9905 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9906 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9907 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9908 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9909 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9910 long ret_ref = (long)ret_var.inner;
9911 if (ret_var.is_owned) {
9917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9918 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9919 FREE((void*)this_ptr);
9920 NetAddress_free(this_ptr_conv);
9923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9924 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9925 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9926 *ret_copy = NetAddress_clone(orig_conv);
9927 long ret_ref = (long)ret_copy;
9931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9932 LDKUnsignedNodeAnnouncement this_ptr_conv;
9933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9935 UnsignedNodeAnnouncement_free(this_ptr_conv);
9938 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9939 LDKUnsignedNodeAnnouncement orig_conv;
9940 orig_conv.inner = (void*)(orig & (~1));
9941 orig_conv.is_owned = false;
9942 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9943 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9944 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9945 long ret_ref = (long)ret_var.inner;
9946 if (ret_var.is_owned) {
9952 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9953 LDKUnsignedNodeAnnouncement this_ptr_conv;
9954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9955 this_ptr_conv.is_owned = false;
9956 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9957 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9958 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9959 long ret_ref = (long)ret_var.inner;
9960 if (ret_var.is_owned) {
9966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9967 LDKUnsignedNodeAnnouncement this_ptr_conv;
9968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9969 this_ptr_conv.is_owned = false;
9970 LDKNodeFeatures val_conv;
9971 val_conv.inner = (void*)(val & (~1));
9972 val_conv.is_owned = (val & 1) || (val == 0);
9973 // Warning: we may need a move here but can't clone!
9974 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9977 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9978 LDKUnsignedNodeAnnouncement this_ptr_conv;
9979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9980 this_ptr_conv.is_owned = false;
9981 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9986 LDKUnsignedNodeAnnouncement this_ptr_conv;
9987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9988 this_ptr_conv.is_owned = false;
9989 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9992 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9993 LDKUnsignedNodeAnnouncement this_ptr_conv;
9994 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9995 this_ptr_conv.is_owned = false;
9996 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9997 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
10001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10002 LDKUnsignedNodeAnnouncement this_ptr_conv;
10003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10004 this_ptr_conv.is_owned = false;
10005 LDKPublicKey val_ref;
10006 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10007 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10008 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
10011 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
10012 LDKUnsignedNodeAnnouncement this_ptr_conv;
10013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10014 this_ptr_conv.is_owned = false;
10015 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
10016 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
10020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10021 LDKUnsignedNodeAnnouncement this_ptr_conv;
10022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10023 this_ptr_conv.is_owned = false;
10024 LDKThreeBytes val_ref;
10025 CHECK((*_env)->GetArrayLength (_env, val) == 3);
10026 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
10027 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
10030 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
10031 LDKUnsignedNodeAnnouncement this_ptr_conv;
10032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10033 this_ptr_conv.is_owned = false;
10034 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10035 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
10039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10040 LDKUnsignedNodeAnnouncement this_ptr_conv;
10041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10042 this_ptr_conv.is_owned = false;
10043 LDKThirtyTwoBytes val_ref;
10044 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10045 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10046 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
10049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10050 LDKUnsignedNodeAnnouncement this_ptr_conv;
10051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10052 this_ptr_conv.is_owned = false;
10053 LDKCVec_NetAddressZ val_constr;
10054 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10055 if (val_constr.datalen > 0)
10056 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10058 val_constr.data = NULL;
10059 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10060 for (size_t m = 0; m < val_constr.datalen; m++) {
10061 long arr_conv_12 = val_vals[m];
10062 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
10063 FREE((void*)arr_conv_12);
10064 val_constr.data[m] = arr_conv_12_conv;
10066 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10067 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
10070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10071 LDKNodeAnnouncement this_ptr_conv;
10072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10074 NodeAnnouncement_free(this_ptr_conv);
10077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10078 LDKNodeAnnouncement orig_conv;
10079 orig_conv.inner = (void*)(orig & (~1));
10080 orig_conv.is_owned = false;
10081 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
10082 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10083 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10084 long ret_ref = (long)ret_var.inner;
10085 if (ret_var.is_owned) {
10091 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10092 LDKNodeAnnouncement this_ptr_conv;
10093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10094 this_ptr_conv.is_owned = false;
10095 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10096 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
10100 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10101 LDKNodeAnnouncement this_ptr_conv;
10102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10103 this_ptr_conv.is_owned = false;
10104 LDKSignature val_ref;
10105 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10106 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10107 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
10110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10111 LDKNodeAnnouncement this_ptr_conv;
10112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10113 this_ptr_conv.is_owned = false;
10114 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
10115 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10116 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10117 long ret_ref = (long)ret_var.inner;
10118 if (ret_var.is_owned) {
10124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10125 LDKNodeAnnouncement this_ptr_conv;
10126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10127 this_ptr_conv.is_owned = false;
10128 LDKUnsignedNodeAnnouncement val_conv;
10129 val_conv.inner = (void*)(val & (~1));
10130 val_conv.is_owned = (val & 1) || (val == 0);
10131 if (val_conv.inner != NULL)
10132 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
10133 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
10136 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10137 LDKSignature signature_arg_ref;
10138 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10139 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10140 LDKUnsignedNodeAnnouncement contents_arg_conv;
10141 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10142 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10143 if (contents_arg_conv.inner != NULL)
10144 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
10145 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
10146 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10147 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10148 long ret_ref = (long)ret_var.inner;
10149 if (ret_var.is_owned) {
10155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10156 LDKUnsignedChannelAnnouncement this_ptr_conv;
10157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10158 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10159 UnsignedChannelAnnouncement_free(this_ptr_conv);
10162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10163 LDKUnsignedChannelAnnouncement orig_conv;
10164 orig_conv.inner = (void*)(orig & (~1));
10165 orig_conv.is_owned = false;
10166 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10167 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10168 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10169 long ret_ref = (long)ret_var.inner;
10170 if (ret_var.is_owned) {
10176 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10177 LDKUnsignedChannelAnnouncement this_ptr_conv;
10178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10179 this_ptr_conv.is_owned = false;
10180 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10181 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10182 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10183 long ret_ref = (long)ret_var.inner;
10184 if (ret_var.is_owned) {
10190 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10191 LDKUnsignedChannelAnnouncement this_ptr_conv;
10192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10193 this_ptr_conv.is_owned = false;
10194 LDKChannelFeatures val_conv;
10195 val_conv.inner = (void*)(val & (~1));
10196 val_conv.is_owned = (val & 1) || (val == 0);
10197 // Warning: we may need a move here but can't clone!
10198 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10201 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10202 LDKUnsignedChannelAnnouncement this_ptr_conv;
10203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10204 this_ptr_conv.is_owned = false;
10205 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10206 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
10210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10211 LDKUnsignedChannelAnnouncement this_ptr_conv;
10212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10213 this_ptr_conv.is_owned = false;
10214 LDKThirtyTwoBytes val_ref;
10215 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10216 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10217 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10221 LDKUnsignedChannelAnnouncement this_ptr_conv;
10222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10223 this_ptr_conv.is_owned = false;
10224 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10229 LDKUnsignedChannelAnnouncement this_ptr_conv;
10230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10231 this_ptr_conv.is_owned = false;
10232 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10235 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10236 LDKUnsignedChannelAnnouncement this_ptr_conv;
10237 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10238 this_ptr_conv.is_owned = false;
10239 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10240 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
10244 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10245 LDKUnsignedChannelAnnouncement this_ptr_conv;
10246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10247 this_ptr_conv.is_owned = false;
10248 LDKPublicKey val_ref;
10249 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10250 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10251 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10254 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10255 LDKUnsignedChannelAnnouncement this_ptr_conv;
10256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10257 this_ptr_conv.is_owned = false;
10258 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10259 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
10263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10264 LDKUnsignedChannelAnnouncement this_ptr_conv;
10265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10266 this_ptr_conv.is_owned = false;
10267 LDKPublicKey val_ref;
10268 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10269 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10270 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10273 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10274 LDKUnsignedChannelAnnouncement this_ptr_conv;
10275 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10276 this_ptr_conv.is_owned = false;
10277 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10278 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
10282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10283 LDKUnsignedChannelAnnouncement this_ptr_conv;
10284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10285 this_ptr_conv.is_owned = false;
10286 LDKPublicKey val_ref;
10287 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10288 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10289 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10292 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10293 LDKUnsignedChannelAnnouncement this_ptr_conv;
10294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10295 this_ptr_conv.is_owned = false;
10296 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10297 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
10301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10302 LDKUnsignedChannelAnnouncement this_ptr_conv;
10303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10304 this_ptr_conv.is_owned = false;
10305 LDKPublicKey val_ref;
10306 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10307 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10308 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10312 LDKChannelAnnouncement this_ptr_conv;
10313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10315 ChannelAnnouncement_free(this_ptr_conv);
10318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10319 LDKChannelAnnouncement orig_conv;
10320 orig_conv.inner = (void*)(orig & (~1));
10321 orig_conv.is_owned = false;
10322 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10323 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10324 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10325 long ret_ref = (long)ret_var.inner;
10326 if (ret_var.is_owned) {
10332 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10333 LDKChannelAnnouncement this_ptr_conv;
10334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10335 this_ptr_conv.is_owned = false;
10336 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10337 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10342 LDKChannelAnnouncement this_ptr_conv;
10343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10344 this_ptr_conv.is_owned = false;
10345 LDKSignature val_ref;
10346 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10347 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10348 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10351 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10352 LDKChannelAnnouncement this_ptr_conv;
10353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10354 this_ptr_conv.is_owned = false;
10355 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10356 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10361 LDKChannelAnnouncement this_ptr_conv;
10362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10363 this_ptr_conv.is_owned = false;
10364 LDKSignature val_ref;
10365 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10366 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10367 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10370 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10371 LDKChannelAnnouncement this_ptr_conv;
10372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10373 this_ptr_conv.is_owned = false;
10374 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10375 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10380 LDKChannelAnnouncement this_ptr_conv;
10381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10382 this_ptr_conv.is_owned = false;
10383 LDKSignature val_ref;
10384 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10385 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10386 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10389 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10390 LDKChannelAnnouncement this_ptr_conv;
10391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10392 this_ptr_conv.is_owned = false;
10393 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10394 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10399 LDKChannelAnnouncement this_ptr_conv;
10400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10401 this_ptr_conv.is_owned = false;
10402 LDKSignature val_ref;
10403 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10404 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10405 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10408 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10409 LDKChannelAnnouncement this_ptr_conv;
10410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10411 this_ptr_conv.is_owned = false;
10412 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10413 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10414 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10415 long ret_ref = (long)ret_var.inner;
10416 if (ret_var.is_owned) {
10422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10423 LDKChannelAnnouncement this_ptr_conv;
10424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10425 this_ptr_conv.is_owned = false;
10426 LDKUnsignedChannelAnnouncement val_conv;
10427 val_conv.inner = (void*)(val & (~1));
10428 val_conv.is_owned = (val & 1) || (val == 0);
10429 if (val_conv.inner != NULL)
10430 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10431 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10434 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) {
10435 LDKSignature node_signature_1_arg_ref;
10436 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10437 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10438 LDKSignature node_signature_2_arg_ref;
10439 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10440 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10441 LDKSignature bitcoin_signature_1_arg_ref;
10442 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10443 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10444 LDKSignature bitcoin_signature_2_arg_ref;
10445 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10446 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10447 LDKUnsignedChannelAnnouncement contents_arg_conv;
10448 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10449 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10450 if (contents_arg_conv.inner != NULL)
10451 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10452 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);
10453 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10454 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10455 long ret_ref = (long)ret_var.inner;
10456 if (ret_var.is_owned) {
10462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10463 LDKUnsignedChannelUpdate this_ptr_conv;
10464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10465 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10466 UnsignedChannelUpdate_free(this_ptr_conv);
10469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10470 LDKUnsignedChannelUpdate orig_conv;
10471 orig_conv.inner = (void*)(orig & (~1));
10472 orig_conv.is_owned = false;
10473 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10474 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10475 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10476 long ret_ref = (long)ret_var.inner;
10477 if (ret_var.is_owned) {
10483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10484 LDKUnsignedChannelUpdate this_ptr_conv;
10485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10486 this_ptr_conv.is_owned = false;
10487 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10488 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10493 LDKUnsignedChannelUpdate this_ptr_conv;
10494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10495 this_ptr_conv.is_owned = false;
10496 LDKThirtyTwoBytes val_ref;
10497 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10498 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10499 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10503 LDKUnsignedChannelUpdate this_ptr_conv;
10504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10505 this_ptr_conv.is_owned = false;
10506 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10511 LDKUnsignedChannelUpdate this_ptr_conv;
10512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10513 this_ptr_conv.is_owned = false;
10514 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10517 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10518 LDKUnsignedChannelUpdate this_ptr_conv;
10519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10520 this_ptr_conv.is_owned = false;
10521 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10526 LDKUnsignedChannelUpdate this_ptr_conv;
10527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10528 this_ptr_conv.is_owned = false;
10529 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10532 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10533 LDKUnsignedChannelUpdate this_ptr_conv;
10534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10535 this_ptr_conv.is_owned = false;
10536 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10541 LDKUnsignedChannelUpdate this_ptr_conv;
10542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10543 this_ptr_conv.is_owned = false;
10544 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10547 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10548 LDKUnsignedChannelUpdate this_ptr_conv;
10549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10550 this_ptr_conv.is_owned = false;
10551 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10556 LDKUnsignedChannelUpdate this_ptr_conv;
10557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10558 this_ptr_conv.is_owned = false;
10559 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10563 LDKUnsignedChannelUpdate this_ptr_conv;
10564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10565 this_ptr_conv.is_owned = false;
10566 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10571 LDKUnsignedChannelUpdate this_ptr_conv;
10572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10573 this_ptr_conv.is_owned = false;
10574 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10577 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10578 LDKUnsignedChannelUpdate this_ptr_conv;
10579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10580 this_ptr_conv.is_owned = false;
10581 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10586 LDKUnsignedChannelUpdate this_ptr_conv;
10587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10588 this_ptr_conv.is_owned = false;
10589 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10592 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10593 LDKUnsignedChannelUpdate this_ptr_conv;
10594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10595 this_ptr_conv.is_owned = false;
10596 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10601 LDKUnsignedChannelUpdate this_ptr_conv;
10602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10603 this_ptr_conv.is_owned = false;
10604 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10608 LDKChannelUpdate this_ptr_conv;
10609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10611 ChannelUpdate_free(this_ptr_conv);
10614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10615 LDKChannelUpdate orig_conv;
10616 orig_conv.inner = (void*)(orig & (~1));
10617 orig_conv.is_owned = false;
10618 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10619 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10620 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10621 long ret_ref = (long)ret_var.inner;
10622 if (ret_var.is_owned) {
10628 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10629 LDKChannelUpdate this_ptr_conv;
10630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10631 this_ptr_conv.is_owned = false;
10632 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10633 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10638 LDKChannelUpdate this_ptr_conv;
10639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10640 this_ptr_conv.is_owned = false;
10641 LDKSignature val_ref;
10642 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10643 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10644 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10648 LDKChannelUpdate this_ptr_conv;
10649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10650 this_ptr_conv.is_owned = false;
10651 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10652 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10653 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10654 long ret_ref = (long)ret_var.inner;
10655 if (ret_var.is_owned) {
10661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10662 LDKChannelUpdate this_ptr_conv;
10663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10664 this_ptr_conv.is_owned = false;
10665 LDKUnsignedChannelUpdate val_conv;
10666 val_conv.inner = (void*)(val & (~1));
10667 val_conv.is_owned = (val & 1) || (val == 0);
10668 if (val_conv.inner != NULL)
10669 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10670 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10674 LDKSignature signature_arg_ref;
10675 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10676 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10677 LDKUnsignedChannelUpdate contents_arg_conv;
10678 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10679 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10680 if (contents_arg_conv.inner != NULL)
10681 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10682 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10685 long ret_ref = (long)ret_var.inner;
10686 if (ret_var.is_owned) {
10692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10693 LDKQueryChannelRange this_ptr_conv;
10694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10696 QueryChannelRange_free(this_ptr_conv);
10699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10700 LDKQueryChannelRange orig_conv;
10701 orig_conv.inner = (void*)(orig & (~1));
10702 orig_conv.is_owned = false;
10703 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10706 long ret_ref = (long)ret_var.inner;
10707 if (ret_var.is_owned) {
10713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10714 LDKQueryChannelRange this_ptr_conv;
10715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10716 this_ptr_conv.is_owned = false;
10717 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10718 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10723 LDKQueryChannelRange this_ptr_conv;
10724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10725 this_ptr_conv.is_owned = false;
10726 LDKThirtyTwoBytes val_ref;
10727 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10728 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10729 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10732 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10733 LDKQueryChannelRange this_ptr_conv;
10734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10735 this_ptr_conv.is_owned = false;
10736 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10741 LDKQueryChannelRange this_ptr_conv;
10742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10743 this_ptr_conv.is_owned = false;
10744 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10747 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10748 LDKQueryChannelRange this_ptr_conv;
10749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10750 this_ptr_conv.is_owned = false;
10751 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10756 LDKQueryChannelRange this_ptr_conv;
10757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10758 this_ptr_conv.is_owned = false;
10759 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10762 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) {
10763 LDKThirtyTwoBytes chain_hash_arg_ref;
10764 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10765 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10766 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10767 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10768 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10769 long ret_ref = (long)ret_var.inner;
10770 if (ret_var.is_owned) {
10776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10777 LDKReplyChannelRange this_ptr_conv;
10778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10780 ReplyChannelRange_free(this_ptr_conv);
10783 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10784 LDKReplyChannelRange orig_conv;
10785 orig_conv.inner = (void*)(orig & (~1));
10786 orig_conv.is_owned = false;
10787 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10788 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10789 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10790 long ret_ref = (long)ret_var.inner;
10791 if (ret_var.is_owned) {
10797 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10798 LDKReplyChannelRange this_ptr_conv;
10799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10800 this_ptr_conv.is_owned = false;
10801 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10802 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10807 LDKReplyChannelRange this_ptr_conv;
10808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10809 this_ptr_conv.is_owned = false;
10810 LDKThirtyTwoBytes val_ref;
10811 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10812 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10813 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10816 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10817 LDKReplyChannelRange this_ptr_conv;
10818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10819 this_ptr_conv.is_owned = false;
10820 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10825 LDKReplyChannelRange this_ptr_conv;
10826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10827 this_ptr_conv.is_owned = false;
10828 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10831 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10832 LDKReplyChannelRange this_ptr_conv;
10833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10834 this_ptr_conv.is_owned = false;
10835 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10840 LDKReplyChannelRange this_ptr_conv;
10841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10842 this_ptr_conv.is_owned = false;
10843 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10846 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10847 LDKReplyChannelRange this_ptr_conv;
10848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10849 this_ptr_conv.is_owned = false;
10850 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10855 LDKReplyChannelRange this_ptr_conv;
10856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10857 this_ptr_conv.is_owned = false;
10858 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10862 LDKReplyChannelRange this_ptr_conv;
10863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10864 this_ptr_conv.is_owned = false;
10865 LDKCVec_u64Z val_constr;
10866 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10867 if (val_constr.datalen > 0)
10868 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10870 val_constr.data = NULL;
10871 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10872 for (size_t g = 0; g < val_constr.datalen; g++) {
10873 long arr_conv_6 = val_vals[g];
10874 val_constr.data[g] = arr_conv_6;
10876 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10877 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10880 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) {
10881 LDKThirtyTwoBytes chain_hash_arg_ref;
10882 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10883 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10884 LDKCVec_u64Z short_channel_ids_arg_constr;
10885 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10886 if (short_channel_ids_arg_constr.datalen > 0)
10887 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10889 short_channel_ids_arg_constr.data = NULL;
10890 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10891 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10892 long arr_conv_6 = short_channel_ids_arg_vals[g];
10893 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10895 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10896 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10899 long ret_ref = (long)ret_var.inner;
10900 if (ret_var.is_owned) {
10906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10907 LDKQueryShortChannelIds this_ptr_conv;
10908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10909 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10910 QueryShortChannelIds_free(this_ptr_conv);
10913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10914 LDKQueryShortChannelIds orig_conv;
10915 orig_conv.inner = (void*)(orig & (~1));
10916 orig_conv.is_owned = false;
10917 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10918 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10919 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10920 long ret_ref = (long)ret_var.inner;
10921 if (ret_var.is_owned) {
10927 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10928 LDKQueryShortChannelIds this_ptr_conv;
10929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10930 this_ptr_conv.is_owned = false;
10931 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10932 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10937 LDKQueryShortChannelIds this_ptr_conv;
10938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10939 this_ptr_conv.is_owned = false;
10940 LDKThirtyTwoBytes val_ref;
10941 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10942 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10943 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10947 LDKQueryShortChannelIds this_ptr_conv;
10948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10949 this_ptr_conv.is_owned = false;
10950 LDKCVec_u64Z val_constr;
10951 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10952 if (val_constr.datalen > 0)
10953 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10955 val_constr.data = NULL;
10956 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10957 for (size_t g = 0; g < val_constr.datalen; g++) {
10958 long arr_conv_6 = val_vals[g];
10959 val_constr.data[g] = arr_conv_6;
10961 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10962 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10965 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10966 LDKThirtyTwoBytes chain_hash_arg_ref;
10967 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10968 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10969 LDKCVec_u64Z short_channel_ids_arg_constr;
10970 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10971 if (short_channel_ids_arg_constr.datalen > 0)
10972 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10974 short_channel_ids_arg_constr.data = NULL;
10975 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10976 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10977 long arr_conv_6 = short_channel_ids_arg_vals[g];
10978 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10980 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10981 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10982 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10983 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10984 long ret_ref = (long)ret_var.inner;
10985 if (ret_var.is_owned) {
10991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10992 LDKReplyShortChannelIdsEnd this_ptr_conv;
10993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10995 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10999 LDKReplyShortChannelIdsEnd orig_conv;
11000 orig_conv.inner = (void*)(orig & (~1));
11001 orig_conv.is_owned = false;
11002 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
11003 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11004 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11005 long ret_ref = (long)ret_var.inner;
11006 if (ret_var.is_owned) {
11012 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11013 LDKReplyShortChannelIdsEnd this_ptr_conv;
11014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11015 this_ptr_conv.is_owned = false;
11016 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11017 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
11021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11022 LDKReplyShortChannelIdsEnd this_ptr_conv;
11023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11024 this_ptr_conv.is_owned = false;
11025 LDKThirtyTwoBytes val_ref;
11026 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11027 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11028 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
11031 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
11032 LDKReplyShortChannelIdsEnd this_ptr_conv;
11033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11034 this_ptr_conv.is_owned = false;
11035 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
11039 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11040 LDKReplyShortChannelIdsEnd this_ptr_conv;
11041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11042 this_ptr_conv.is_owned = false;
11043 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
11046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
11047 LDKThirtyTwoBytes chain_hash_arg_ref;
11048 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
11049 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
11050 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
11051 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11052 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11053 long ret_ref = (long)ret_var.inner;
11054 if (ret_var.is_owned) {
11060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11061 LDKGossipTimestampFilter this_ptr_conv;
11062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11064 GossipTimestampFilter_free(this_ptr_conv);
11067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11068 LDKGossipTimestampFilter orig_conv;
11069 orig_conv.inner = (void*)(orig & (~1));
11070 orig_conv.is_owned = false;
11071 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
11072 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11073 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11074 long ret_ref = (long)ret_var.inner;
11075 if (ret_var.is_owned) {
11081 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11082 LDKGossipTimestampFilter this_ptr_conv;
11083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11084 this_ptr_conv.is_owned = false;
11085 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11086 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
11090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11091 LDKGossipTimestampFilter this_ptr_conv;
11092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11093 this_ptr_conv.is_owned = false;
11094 LDKThirtyTwoBytes val_ref;
11095 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11096 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11097 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
11100 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
11101 LDKGossipTimestampFilter this_ptr_conv;
11102 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11103 this_ptr_conv.is_owned = false;
11104 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
11108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11109 LDKGossipTimestampFilter this_ptr_conv;
11110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11111 this_ptr_conv.is_owned = false;
11112 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
11115 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
11116 LDKGossipTimestampFilter this_ptr_conv;
11117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11118 this_ptr_conv.is_owned = false;
11119 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
11123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11124 LDKGossipTimestampFilter this_ptr_conv;
11125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11126 this_ptr_conv.is_owned = false;
11127 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
11130 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) {
11131 LDKThirtyTwoBytes chain_hash_arg_ref;
11132 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
11133 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
11134 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
11135 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11136 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11137 long ret_ref = (long)ret_var.inner;
11138 if (ret_var.is_owned) {
11144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11145 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
11146 FREE((void*)this_ptr);
11147 ErrorAction_free(this_ptr_conv);
11150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11151 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
11152 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11153 *ret_copy = ErrorAction_clone(orig_conv);
11154 long ret_ref = (long)ret_copy;
11158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11159 LDKLightningError this_ptr_conv;
11160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11161 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11162 LightningError_free(this_ptr_conv);
11165 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
11166 LDKLightningError this_ptr_conv;
11167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11168 this_ptr_conv.is_owned = false;
11169 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11170 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11171 memcpy(_buf, _str.chars, _str.len);
11172 _buf[_str.len] = 0;
11173 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
11178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11179 LDKLightningError this_ptr_conv;
11180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11181 this_ptr_conv.is_owned = false;
11182 LDKCVec_u8Z val_ref;
11183 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
11184 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11185 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
11186 LightningError_set_err(&this_ptr_conv, val_ref);
11189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
11190 LDKLightningError this_ptr_conv;
11191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11192 this_ptr_conv.is_owned = false;
11193 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11194 *ret_copy = LightningError_get_action(&this_ptr_conv);
11195 long ret_ref = (long)ret_copy;
11199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11200 LDKLightningError this_ptr_conv;
11201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11202 this_ptr_conv.is_owned = false;
11203 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11205 LightningError_set_action(&this_ptr_conv, val_conv);
11208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
11209 LDKCVec_u8Z err_arg_ref;
11210 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
11211 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11212 (*_env)->GetByteArrayRegion(_env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
11213 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11214 FREE((void*)action_arg);
11215 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11216 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11217 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11218 long ret_ref = (long)ret_var.inner;
11219 if (ret_var.is_owned) {
11225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11226 LDKCommitmentUpdate this_ptr_conv;
11227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11229 CommitmentUpdate_free(this_ptr_conv);
11232 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11233 LDKCommitmentUpdate orig_conv;
11234 orig_conv.inner = (void*)(orig & (~1));
11235 orig_conv.is_owned = false;
11236 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11237 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11238 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11239 long ret_ref = (long)ret_var.inner;
11240 if (ret_var.is_owned) {
11246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11247 LDKCommitmentUpdate this_ptr_conv;
11248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11249 this_ptr_conv.is_owned = false;
11250 LDKCVec_UpdateAddHTLCZ val_constr;
11251 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11252 if (val_constr.datalen > 0)
11253 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11255 val_constr.data = NULL;
11256 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11257 for (size_t p = 0; p < val_constr.datalen; p++) {
11258 long arr_conv_15 = val_vals[p];
11259 LDKUpdateAddHTLC arr_conv_15_conv;
11260 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11261 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11262 if (arr_conv_15_conv.inner != NULL)
11263 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11264 val_constr.data[p] = arr_conv_15_conv;
11266 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11267 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11271 LDKCommitmentUpdate this_ptr_conv;
11272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11273 this_ptr_conv.is_owned = false;
11274 LDKCVec_UpdateFulfillHTLCZ val_constr;
11275 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11276 if (val_constr.datalen > 0)
11277 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11279 val_constr.data = NULL;
11280 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11281 for (size_t t = 0; t < val_constr.datalen; t++) {
11282 long arr_conv_19 = val_vals[t];
11283 LDKUpdateFulfillHTLC arr_conv_19_conv;
11284 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11285 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11286 if (arr_conv_19_conv.inner != NULL)
11287 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11288 val_constr.data[t] = arr_conv_19_conv;
11290 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11291 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11295 LDKCommitmentUpdate this_ptr_conv;
11296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11297 this_ptr_conv.is_owned = false;
11298 LDKCVec_UpdateFailHTLCZ val_constr;
11299 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11300 if (val_constr.datalen > 0)
11301 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11303 val_constr.data = NULL;
11304 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11305 for (size_t q = 0; q < val_constr.datalen; q++) {
11306 long arr_conv_16 = val_vals[q];
11307 LDKUpdateFailHTLC arr_conv_16_conv;
11308 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11309 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11310 if (arr_conv_16_conv.inner != NULL)
11311 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11312 val_constr.data[q] = arr_conv_16_conv;
11314 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11315 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11318 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11319 LDKCommitmentUpdate this_ptr_conv;
11320 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11321 this_ptr_conv.is_owned = false;
11322 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11323 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11324 if (val_constr.datalen > 0)
11325 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11327 val_constr.data = NULL;
11328 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11329 for (size_t z = 0; z < val_constr.datalen; z++) {
11330 long arr_conv_25 = val_vals[z];
11331 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11332 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11333 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11334 if (arr_conv_25_conv.inner != NULL)
11335 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11336 val_constr.data[z] = arr_conv_25_conv;
11338 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11339 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11343 LDKCommitmentUpdate this_ptr_conv;
11344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11345 this_ptr_conv.is_owned = false;
11346 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11347 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11348 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11349 long ret_ref = (long)ret_var.inner;
11350 if (ret_var.is_owned) {
11356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11357 LDKCommitmentUpdate this_ptr_conv;
11358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11359 this_ptr_conv.is_owned = false;
11360 LDKUpdateFee val_conv;
11361 val_conv.inner = (void*)(val & (~1));
11362 val_conv.is_owned = (val & 1) || (val == 0);
11363 if (val_conv.inner != NULL)
11364 val_conv = UpdateFee_clone(&val_conv);
11365 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11369 LDKCommitmentUpdate this_ptr_conv;
11370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11371 this_ptr_conv.is_owned = false;
11372 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11373 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11374 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11375 long ret_ref = (long)ret_var.inner;
11376 if (ret_var.is_owned) {
11382 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11383 LDKCommitmentUpdate this_ptr_conv;
11384 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11385 this_ptr_conv.is_owned = false;
11386 LDKCommitmentSigned val_conv;
11387 val_conv.inner = (void*)(val & (~1));
11388 val_conv.is_owned = (val & 1) || (val == 0);
11389 if (val_conv.inner != NULL)
11390 val_conv = CommitmentSigned_clone(&val_conv);
11391 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11394 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) {
11395 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11396 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11397 if (update_add_htlcs_arg_constr.datalen > 0)
11398 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11400 update_add_htlcs_arg_constr.data = NULL;
11401 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11402 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11403 long arr_conv_15 = update_add_htlcs_arg_vals[p];
11404 LDKUpdateAddHTLC arr_conv_15_conv;
11405 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11406 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11407 if (arr_conv_15_conv.inner != NULL)
11408 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11409 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11411 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11412 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11413 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11414 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11415 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11417 update_fulfill_htlcs_arg_constr.data = NULL;
11418 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11419 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11420 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11421 LDKUpdateFulfillHTLC arr_conv_19_conv;
11422 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11423 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11424 if (arr_conv_19_conv.inner != NULL)
11425 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11426 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11428 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11429 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11430 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11431 if (update_fail_htlcs_arg_constr.datalen > 0)
11432 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11434 update_fail_htlcs_arg_constr.data = NULL;
11435 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11436 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11437 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11438 LDKUpdateFailHTLC arr_conv_16_conv;
11439 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11440 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11441 if (arr_conv_16_conv.inner != NULL)
11442 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11443 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11445 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11446 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11447 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11448 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11449 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11451 update_fail_malformed_htlcs_arg_constr.data = NULL;
11452 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11453 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11454 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11455 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11456 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11457 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11458 if (arr_conv_25_conv.inner != NULL)
11459 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11460 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11462 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11463 LDKUpdateFee update_fee_arg_conv;
11464 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11465 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11466 if (update_fee_arg_conv.inner != NULL)
11467 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11468 LDKCommitmentSigned commitment_signed_arg_conv;
11469 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11470 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11471 if (commitment_signed_arg_conv.inner != NULL)
11472 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11473 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);
11474 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11475 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11476 long ret_ref = (long)ret_var.inner;
11477 if (ret_var.is_owned) {
11483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11484 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11485 FREE((void*)this_ptr);
11486 HTLCFailChannelUpdate_free(this_ptr_conv);
11489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11490 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11491 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11492 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11493 long ret_ref = (long)ret_copy;
11497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11498 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11499 FREE((void*)this_ptr);
11500 ChannelMessageHandler_free(this_ptr_conv);
11503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11504 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11505 FREE((void*)this_ptr);
11506 RoutingMessageHandler_free(this_ptr_conv);
11509 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11510 LDKAcceptChannel obj_conv;
11511 obj_conv.inner = (void*)(obj & (~1));
11512 obj_conv.is_owned = false;
11513 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11514 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11515 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11516 CVec_u8Z_free(arg_var);
11520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11521 LDKu8slice ser_ref;
11522 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11523 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11524 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11525 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11526 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11527 long ret_ref = (long)ret_var.inner;
11528 if (ret_var.is_owned) {
11531 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11535 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11536 LDKAnnouncementSignatures obj_conv;
11537 obj_conv.inner = (void*)(obj & (~1));
11538 obj_conv.is_owned = false;
11539 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11540 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11541 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11542 CVec_u8Z_free(arg_var);
11546 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11547 LDKu8slice ser_ref;
11548 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11549 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11550 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11551 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11552 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11553 long ret_ref = (long)ret_var.inner;
11554 if (ret_var.is_owned) {
11557 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11561 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
11562 LDKChannelReestablish this_ptr_conv;
11563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11564 this_ptr_conv.is_owned = false;
11565 LDKCVec_u8Z arg_var = ChannelReestablish_write(&this_ptr_conv);
11566 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11567 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11568 CVec_u8Z_free(arg_var);
11572 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11573 LDKu8slice ser_ref;
11574 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11575 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11576 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11577 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11578 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11579 long ret_ref = (long)ret_var.inner;
11580 if (ret_var.is_owned) {
11583 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11587 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11588 LDKClosingSigned obj_conv;
11589 obj_conv.inner = (void*)(obj & (~1));
11590 obj_conv.is_owned = false;
11591 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11592 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11593 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11594 CVec_u8Z_free(arg_var);
11598 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11599 LDKu8slice ser_ref;
11600 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11601 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11602 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11605 long ret_ref = (long)ret_var.inner;
11606 if (ret_var.is_owned) {
11609 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11614 LDKCommitmentSigned obj_conv;
11615 obj_conv.inner = (void*)(obj & (~1));
11616 obj_conv.is_owned = false;
11617 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11618 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11619 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11620 CVec_u8Z_free(arg_var);
11624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11625 LDKu8slice ser_ref;
11626 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11627 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11628 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11629 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11630 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11631 long ret_ref = (long)ret_var.inner;
11632 if (ret_var.is_owned) {
11635 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11639 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11640 LDKFundingCreated obj_conv;
11641 obj_conv.inner = (void*)(obj & (~1));
11642 obj_conv.is_owned = false;
11643 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11644 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11645 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11646 CVec_u8Z_free(arg_var);
11650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11651 LDKu8slice ser_ref;
11652 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11653 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11654 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11655 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11656 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11657 long ret_ref = (long)ret_var.inner;
11658 if (ret_var.is_owned) {
11661 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11665 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11666 LDKFundingSigned obj_conv;
11667 obj_conv.inner = (void*)(obj & (~1));
11668 obj_conv.is_owned = false;
11669 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11670 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11671 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11672 CVec_u8Z_free(arg_var);
11676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11677 LDKu8slice ser_ref;
11678 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11679 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11680 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11681 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11682 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11683 long ret_ref = (long)ret_var.inner;
11684 if (ret_var.is_owned) {
11687 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11691 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11692 LDKFundingLocked obj_conv;
11693 obj_conv.inner = (void*)(obj & (~1));
11694 obj_conv.is_owned = false;
11695 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11696 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11697 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11698 CVec_u8Z_free(arg_var);
11702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11703 LDKu8slice ser_ref;
11704 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11705 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11706 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11707 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11708 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11709 long ret_ref = (long)ret_var.inner;
11710 if (ret_var.is_owned) {
11713 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
11718 LDKInit this_ptr_conv;
11719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11720 this_ptr_conv.is_owned = false;
11721 LDKCVec_u8Z arg_var = Init_write(&this_ptr_conv);
11722 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11723 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11724 CVec_u8Z_free(arg_var);
11728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11729 LDKu8slice ser_ref;
11730 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11731 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11732 LDKInit ret_var = Init_read(ser_ref);
11733 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11734 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11735 long ret_ref = (long)ret_var.inner;
11736 if (ret_var.is_owned) {
11739 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11743 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11744 LDKOpenChannel obj_conv;
11745 obj_conv.inner = (void*)(obj & (~1));
11746 obj_conv.is_owned = false;
11747 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11748 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11749 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11750 CVec_u8Z_free(arg_var);
11754 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11755 LDKu8slice ser_ref;
11756 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11757 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11758 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11761 long ret_ref = (long)ret_var.inner;
11762 if (ret_var.is_owned) {
11765 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11769 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11770 LDKRevokeAndACK obj_conv;
11771 obj_conv.inner = (void*)(obj & (~1));
11772 obj_conv.is_owned = false;
11773 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11774 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11775 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11776 CVec_u8Z_free(arg_var);
11780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11781 LDKu8slice ser_ref;
11782 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11783 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11784 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11787 long ret_ref = (long)ret_var.inner;
11788 if (ret_var.is_owned) {
11791 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11795 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11796 LDKShutdown obj_conv;
11797 obj_conv.inner = (void*)(obj & (~1));
11798 obj_conv.is_owned = false;
11799 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11800 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11801 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11802 CVec_u8Z_free(arg_var);
11806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11807 LDKu8slice ser_ref;
11808 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11809 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11810 LDKShutdown ret_var = Shutdown_read(ser_ref);
11811 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11812 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11813 long ret_ref = (long)ret_var.inner;
11814 if (ret_var.is_owned) {
11817 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11821 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11822 LDKUpdateFailHTLC obj_conv;
11823 obj_conv.inner = (void*)(obj & (~1));
11824 obj_conv.is_owned = false;
11825 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11826 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11827 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11828 CVec_u8Z_free(arg_var);
11832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11833 LDKu8slice ser_ref;
11834 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11835 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11836 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11837 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11838 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11839 long ret_ref = (long)ret_var.inner;
11840 if (ret_var.is_owned) {
11843 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11847 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11848 LDKUpdateFailMalformedHTLC obj_conv;
11849 obj_conv.inner = (void*)(obj & (~1));
11850 obj_conv.is_owned = false;
11851 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11852 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11853 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11854 CVec_u8Z_free(arg_var);
11858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11859 LDKu8slice ser_ref;
11860 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11861 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11862 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11863 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11864 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11865 long ret_ref = (long)ret_var.inner;
11866 if (ret_var.is_owned) {
11869 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11873 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11874 LDKUpdateFee obj_conv;
11875 obj_conv.inner = (void*)(obj & (~1));
11876 obj_conv.is_owned = false;
11877 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11878 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11879 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11880 CVec_u8Z_free(arg_var);
11884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11885 LDKu8slice ser_ref;
11886 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11887 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11888 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11891 long ret_ref = (long)ret_var.inner;
11892 if (ret_var.is_owned) {
11895 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11899 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11900 LDKUpdateFulfillHTLC obj_conv;
11901 obj_conv.inner = (void*)(obj & (~1));
11902 obj_conv.is_owned = false;
11903 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11904 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11905 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11906 CVec_u8Z_free(arg_var);
11910 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11911 LDKu8slice ser_ref;
11912 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11913 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11914 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11915 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11916 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11917 long ret_ref = (long)ret_var.inner;
11918 if (ret_var.is_owned) {
11921 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11925 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11926 LDKUpdateAddHTLC obj_conv;
11927 obj_conv.inner = (void*)(obj & (~1));
11928 obj_conv.is_owned = false;
11929 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11930 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11931 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11932 CVec_u8Z_free(arg_var);
11936 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11937 LDKu8slice ser_ref;
11938 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11939 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11940 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11941 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11942 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11943 long ret_ref = (long)ret_var.inner;
11944 if (ret_var.is_owned) {
11947 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11951 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
11952 LDKPing this_ptr_conv;
11953 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11954 this_ptr_conv.is_owned = false;
11955 LDKCVec_u8Z arg_var = Ping_write(&this_ptr_conv);
11956 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11957 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11958 CVec_u8Z_free(arg_var);
11962 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11963 LDKu8slice ser_ref;
11964 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11965 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11966 LDKPing ret_var = Ping_read(ser_ref);
11967 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11968 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11969 long ret_ref = (long)ret_var.inner;
11970 if (ret_var.is_owned) {
11973 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11977 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
11978 LDKPong this_ptr_conv;
11979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11980 this_ptr_conv.is_owned = false;
11981 LDKCVec_u8Z arg_var = Pong_write(&this_ptr_conv);
11982 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11983 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11984 CVec_u8Z_free(arg_var);
11988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11989 LDKu8slice ser_ref;
11990 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11991 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11992 LDKPong ret_var = Pong_read(ser_ref);
11993 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11994 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11995 long ret_ref = (long)ret_var.inner;
11996 if (ret_var.is_owned) {
11999 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12003 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12004 LDKUnsignedChannelAnnouncement this_ptr_conv;
12005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12006 this_ptr_conv.is_owned = false;
12007 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&this_ptr_conv);
12008 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12009 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12010 CVec_u8Z_free(arg_var);
12014 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12015 LDKu8slice ser_ref;
12016 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12017 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12018 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
12019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12021 long ret_ref = (long)ret_var.inner;
12022 if (ret_var.is_owned) {
12025 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12029 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
12030 LDKChannelAnnouncement obj_conv;
12031 obj_conv.inner = (void*)(obj & (~1));
12032 obj_conv.is_owned = false;
12033 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
12034 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12035 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12036 CVec_u8Z_free(arg_var);
12040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12041 LDKu8slice ser_ref;
12042 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12043 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12044 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
12045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12047 long ret_ref = (long)ret_var.inner;
12048 if (ret_var.is_owned) {
12051 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12055 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12056 LDKUnsignedChannelUpdate this_ptr_conv;
12057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12058 this_ptr_conv.is_owned = false;
12059 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&this_ptr_conv);
12060 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12061 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12062 CVec_u8Z_free(arg_var);
12066 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12067 LDKu8slice ser_ref;
12068 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12069 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12070 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
12071 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12072 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12073 long ret_ref = (long)ret_var.inner;
12074 if (ret_var.is_owned) {
12077 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12081 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
12082 LDKChannelUpdate obj_conv;
12083 obj_conv.inner = (void*)(obj & (~1));
12084 obj_conv.is_owned = false;
12085 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
12086 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12087 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12088 CVec_u8Z_free(arg_var);
12092 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12093 LDKu8slice ser_ref;
12094 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12095 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12096 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
12097 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12098 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12099 long ret_ref = (long)ret_var.inner;
12100 if (ret_var.is_owned) {
12103 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12107 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12108 LDKErrorMessage this_ptr_conv;
12109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12110 this_ptr_conv.is_owned = false;
12111 LDKCVec_u8Z arg_var = ErrorMessage_write(&this_ptr_conv);
12112 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12113 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12114 CVec_u8Z_free(arg_var);
12118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12119 LDKu8slice ser_ref;
12120 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12121 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12122 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
12123 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12124 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12125 long ret_ref = (long)ret_var.inner;
12126 if (ret_var.is_owned) {
12129 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12133 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12134 LDKUnsignedNodeAnnouncement this_ptr_conv;
12135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12136 this_ptr_conv.is_owned = false;
12137 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&this_ptr_conv);
12138 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12139 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12140 CVec_u8Z_free(arg_var);
12144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12145 LDKu8slice ser_ref;
12146 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12147 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12148 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
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) {
12155 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12159 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
12160 LDKNodeAnnouncement obj_conv;
12161 obj_conv.inner = (void*)(obj & (~1));
12162 obj_conv.is_owned = false;
12163 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12164 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12165 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12166 CVec_u8Z_free(arg_var);
12170 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12171 LDKu8slice ser_ref;
12172 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12173 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12174 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12175 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12176 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12177 long ret_ref = (long)ret_var.inner;
12178 if (ret_var.is_owned) {
12181 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12185 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12186 LDKu8slice ser_ref;
12187 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12188 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12189 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
12190 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12191 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12192 long ret_ref = (long)ret_var.inner;
12193 if (ret_var.is_owned) {
12196 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12200 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12201 LDKQueryShortChannelIds this_ptr_conv;
12202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12203 this_ptr_conv.is_owned = false;
12204 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&this_ptr_conv);
12205 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12206 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12207 CVec_u8Z_free(arg_var);
12211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12212 LDKu8slice ser_ref;
12213 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12214 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12215 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
12216 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12217 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12218 long ret_ref = (long)ret_var.inner;
12219 if (ret_var.is_owned) {
12222 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12226 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12227 LDKReplyShortChannelIdsEnd this_ptr_conv;
12228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12229 this_ptr_conv.is_owned = false;
12230 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&this_ptr_conv);
12231 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12232 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12233 CVec_u8Z_free(arg_var);
12237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12238 LDKu8slice ser_ref;
12239 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12240 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12241 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
12242 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12243 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12244 long ret_ref = (long)ret_var.inner;
12245 if (ret_var.is_owned) {
12248 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12252 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12253 LDKQueryChannelRange this_ptr_conv;
12254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12255 this_ptr_conv.is_owned = false;
12256 LDKCVec_u8Z arg_var = QueryChannelRange_write(&this_ptr_conv);
12257 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12258 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12259 CVec_u8Z_free(arg_var);
12263 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12264 LDKu8slice ser_ref;
12265 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12266 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12267 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
12268 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12269 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12270 long ret_ref = (long)ret_var.inner;
12271 if (ret_var.is_owned) {
12274 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12278 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12279 LDKReplyChannelRange this_ptr_conv;
12280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12281 this_ptr_conv.is_owned = false;
12282 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&this_ptr_conv);
12283 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12284 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12285 CVec_u8Z_free(arg_var);
12289 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12290 LDKu8slice ser_ref;
12291 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12292 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12293 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
12294 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12295 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12296 long ret_ref = (long)ret_var.inner;
12297 if (ret_var.is_owned) {
12300 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12304 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
12305 LDKGossipTimestampFilter this_ptr_conv;
12306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12307 this_ptr_conv.is_owned = false;
12308 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&this_ptr_conv);
12309 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12310 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12311 CVec_u8Z_free(arg_var);
12315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12316 LDKMessageHandler this_ptr_conv;
12317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12319 MessageHandler_free(this_ptr_conv);
12322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12323 LDKMessageHandler this_ptr_conv;
12324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12325 this_ptr_conv.is_owned = false;
12326 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12331 LDKMessageHandler this_ptr_conv;
12332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12333 this_ptr_conv.is_owned = false;
12334 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12335 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12336 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12337 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12339 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12343 LDKMessageHandler this_ptr_conv;
12344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12345 this_ptr_conv.is_owned = false;
12346 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12351 LDKMessageHandler this_ptr_conv;
12352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12353 this_ptr_conv.is_owned = false;
12354 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12355 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12356 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12357 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12359 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12363 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12364 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12365 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12366 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12368 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12369 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12370 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12371 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12373 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12376 long ret_ref = (long)ret_var.inner;
12377 if (ret_var.is_owned) {
12383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12384 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
12385 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12386 *ret = SocketDescriptor_clone(orig_conv);
12390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12391 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12392 FREE((void*)this_ptr);
12393 SocketDescriptor_free(this_ptr_conv);
12396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12397 LDKPeerHandleError this_ptr_conv;
12398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12399 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12400 PeerHandleError_free(this_ptr_conv);
12403 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
12404 LDKPeerHandleError this_ptr_conv;
12405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12406 this_ptr_conv.is_owned = false;
12407 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12412 LDKPeerHandleError this_ptr_conv;
12413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12414 this_ptr_conv.is_owned = false;
12415 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12419 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12420 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12421 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12422 long ret_ref = (long)ret_var.inner;
12423 if (ret_var.is_owned) {
12429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12430 LDKPeerManager this_ptr_conv;
12431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12433 PeerManager_free(this_ptr_conv);
12436 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) {
12437 LDKMessageHandler message_handler_conv;
12438 message_handler_conv.inner = (void*)(message_handler & (~1));
12439 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12440 // Warning: we may need a move here but can't clone!
12441 LDKSecretKey our_node_secret_ref;
12442 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12443 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12444 unsigned char ephemeral_random_data_arr[32];
12445 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12446 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12447 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12448 LDKLogger logger_conv = *(LDKLogger*)logger;
12449 if (logger_conv.free == LDKLogger_JCalls_free) {
12450 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12451 LDKLogger_JCalls_clone(logger_conv.this_arg);
12453 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12456 long ret_ref = (long)ret_var.inner;
12457 if (ret_var.is_owned) {
12463 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12464 LDKPeerManager this_arg_conv;
12465 this_arg_conv.inner = (void*)(this_arg & (~1));
12466 this_arg_conv.is_owned = false;
12467 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12468 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
12469 for (size_t i = 0; i < ret_var.datalen; i++) {
12470 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12471 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12472 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12474 CVec_PublicKeyZ_free(ret_var);
12478 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) {
12479 LDKPeerManager this_arg_conv;
12480 this_arg_conv.inner = (void*)(this_arg & (~1));
12481 this_arg_conv.is_owned = false;
12482 LDKPublicKey their_node_id_ref;
12483 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12484 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12485 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12486 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12487 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12488 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12490 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12491 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12492 return (long)ret_conv;
12495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12496 LDKPeerManager this_arg_conv;
12497 this_arg_conv.inner = (void*)(this_arg & (~1));
12498 this_arg_conv.is_owned = false;
12499 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12500 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12501 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12502 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12504 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12505 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12506 return (long)ret_conv;
12509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12510 LDKPeerManager this_arg_conv;
12511 this_arg_conv.inner = (void*)(this_arg & (~1));
12512 this_arg_conv.is_owned = false;
12513 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12514 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12515 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12516 return (long)ret_conv;
12519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12520 LDKPeerManager this_arg_conv;
12521 this_arg_conv.inner = (void*)(this_arg & (~1));
12522 this_arg_conv.is_owned = false;
12523 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12524 LDKu8slice data_ref;
12525 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12526 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12527 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12528 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12529 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12530 return (long)ret_conv;
12533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12534 LDKPeerManager this_arg_conv;
12535 this_arg_conv.inner = (void*)(this_arg & (~1));
12536 this_arg_conv.is_owned = false;
12537 PeerManager_process_events(&this_arg_conv);
12540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12541 LDKPeerManager this_arg_conv;
12542 this_arg_conv.inner = (void*)(this_arg & (~1));
12543 this_arg_conv.is_owned = false;
12544 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12545 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12549 LDKPeerManager this_arg_conv;
12550 this_arg_conv.inner = (void*)(this_arg & (~1));
12551 this_arg_conv.is_owned = false;
12552 PeerManager_timer_tick_occured(&this_arg_conv);
12555 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12556 unsigned char commitment_seed_arr[32];
12557 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12558 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12559 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12560 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12561 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12566 LDKPublicKey per_commitment_point_ref;
12567 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12568 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12569 unsigned char base_secret_arr[32];
12570 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12571 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12572 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12573 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12574 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12575 return (long)ret_conv;
12578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12579 LDKPublicKey per_commitment_point_ref;
12580 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12581 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12582 LDKPublicKey base_point_ref;
12583 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12584 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12585 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12586 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12587 return (long)ret_conv;
12590 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) {
12591 unsigned char per_commitment_secret_arr[32];
12592 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12593 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12594 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12595 unsigned char countersignatory_revocation_base_secret_arr[32];
12596 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12597 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12598 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12599 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12600 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12601 return (long)ret_conv;
12604 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) {
12605 LDKPublicKey per_commitment_point_ref;
12606 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12607 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12608 LDKPublicKey countersignatory_revocation_base_point_ref;
12609 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12610 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12611 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12612 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12613 return (long)ret_conv;
12616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12617 LDKTxCreationKeys this_ptr_conv;
12618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12620 TxCreationKeys_free(this_ptr_conv);
12623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12624 LDKTxCreationKeys orig_conv;
12625 orig_conv.inner = (void*)(orig & (~1));
12626 orig_conv.is_owned = false;
12627 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12628 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12629 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12630 long ret_ref = (long)ret_var.inner;
12631 if (ret_var.is_owned) {
12637 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12638 LDKTxCreationKeys this_ptr_conv;
12639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12640 this_ptr_conv.is_owned = false;
12641 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12642 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12647 LDKTxCreationKeys this_ptr_conv;
12648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12649 this_ptr_conv.is_owned = false;
12650 LDKPublicKey val_ref;
12651 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12652 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12653 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12656 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12657 LDKTxCreationKeys this_ptr_conv;
12658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12659 this_ptr_conv.is_owned = false;
12660 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12661 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12666 LDKTxCreationKeys this_ptr_conv;
12667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12668 this_ptr_conv.is_owned = false;
12669 LDKPublicKey val_ref;
12670 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12671 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12672 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12675 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12676 LDKTxCreationKeys this_ptr_conv;
12677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12678 this_ptr_conv.is_owned = false;
12679 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12680 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12685 LDKTxCreationKeys this_ptr_conv;
12686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12687 this_ptr_conv.is_owned = false;
12688 LDKPublicKey val_ref;
12689 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12690 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12691 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12694 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12695 LDKTxCreationKeys this_ptr_conv;
12696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12697 this_ptr_conv.is_owned = false;
12698 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12699 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12704 LDKTxCreationKeys this_ptr_conv;
12705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12706 this_ptr_conv.is_owned = false;
12707 LDKPublicKey val_ref;
12708 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12709 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12710 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12714 LDKTxCreationKeys this_ptr_conv;
12715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12716 this_ptr_conv.is_owned = false;
12717 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12718 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12723 LDKTxCreationKeys this_ptr_conv;
12724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12725 this_ptr_conv.is_owned = false;
12726 LDKPublicKey val_ref;
12727 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12728 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12729 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12732 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) {
12733 LDKPublicKey per_commitment_point_arg_ref;
12734 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12735 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12736 LDKPublicKey revocation_key_arg_ref;
12737 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12738 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12739 LDKPublicKey broadcaster_htlc_key_arg_ref;
12740 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12741 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12742 LDKPublicKey countersignatory_htlc_key_arg_ref;
12743 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12744 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12745 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12746 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12747 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12748 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);
12749 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12750 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12751 long ret_ref = (long)ret_var.inner;
12752 if (ret_var.is_owned) {
12758 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12759 LDKTxCreationKeys obj_conv;
12760 obj_conv.inner = (void*)(obj & (~1));
12761 obj_conv.is_owned = false;
12762 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12763 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12764 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12765 CVec_u8Z_free(arg_var);
12769 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12770 LDKu8slice ser_ref;
12771 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12772 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12773 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12776 long ret_ref = (long)ret_var.inner;
12777 if (ret_var.is_owned) {
12780 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12785 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12788 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12792 LDKPreCalculatedTxCreationKeys orig_conv;
12793 orig_conv.inner = (void*)(orig & (~1));
12794 orig_conv.is_owned = false;
12795 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_clone(&orig_conv);
12796 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12797 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12798 long ret_ref = (long)ret_var.inner;
12799 if (ret_var.is_owned) {
12805 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12806 LDKTxCreationKeys keys_conv;
12807 keys_conv.inner = (void*)(keys & (~1));
12808 keys_conv.is_owned = (keys & 1) || (keys == 0);
12809 if (keys_conv.inner != NULL)
12810 keys_conv = TxCreationKeys_clone(&keys_conv);
12811 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12812 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12813 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12814 long ret_ref = (long)ret_var.inner;
12815 if (ret_var.is_owned) {
12821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12822 LDKPreCalculatedTxCreationKeys this_arg_conv;
12823 this_arg_conv.inner = (void*)(this_arg & (~1));
12824 this_arg_conv.is_owned = false;
12825 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12826 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12827 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12828 long ret_ref = (long)ret_var.inner;
12829 if (ret_var.is_owned) {
12835 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12836 LDKPreCalculatedTxCreationKeys this_arg_conv;
12837 this_arg_conv.inner = (void*)(this_arg & (~1));
12838 this_arg_conv.is_owned = false;
12839 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12840 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12845 LDKChannelPublicKeys this_ptr_conv;
12846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12848 ChannelPublicKeys_free(this_ptr_conv);
12851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12852 LDKChannelPublicKeys orig_conv;
12853 orig_conv.inner = (void*)(orig & (~1));
12854 orig_conv.is_owned = false;
12855 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12856 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12857 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12858 long ret_ref = (long)ret_var.inner;
12859 if (ret_var.is_owned) {
12865 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12866 LDKChannelPublicKeys this_ptr_conv;
12867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12868 this_ptr_conv.is_owned = false;
12869 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12870 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12875 LDKChannelPublicKeys this_ptr_conv;
12876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12877 this_ptr_conv.is_owned = false;
12878 LDKPublicKey val_ref;
12879 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12880 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12881 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12884 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12885 LDKChannelPublicKeys this_ptr_conv;
12886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12887 this_ptr_conv.is_owned = false;
12888 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12889 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12893 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12894 LDKChannelPublicKeys this_ptr_conv;
12895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12896 this_ptr_conv.is_owned = false;
12897 LDKPublicKey val_ref;
12898 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12899 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12900 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12903 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12904 LDKChannelPublicKeys this_ptr_conv;
12905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12906 this_ptr_conv.is_owned = false;
12907 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12908 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12913 LDKChannelPublicKeys this_ptr_conv;
12914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12915 this_ptr_conv.is_owned = false;
12916 LDKPublicKey val_ref;
12917 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12918 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12919 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12922 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12923 LDKChannelPublicKeys this_ptr_conv;
12924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12925 this_ptr_conv.is_owned = false;
12926 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12927 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12931 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12932 LDKChannelPublicKeys this_ptr_conv;
12933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12934 this_ptr_conv.is_owned = false;
12935 LDKPublicKey val_ref;
12936 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12937 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12938 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12941 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12942 LDKChannelPublicKeys this_ptr_conv;
12943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12944 this_ptr_conv.is_owned = false;
12945 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12946 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12951 LDKChannelPublicKeys this_ptr_conv;
12952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12953 this_ptr_conv.is_owned = false;
12954 LDKPublicKey val_ref;
12955 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12956 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12957 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12960 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) {
12961 LDKPublicKey funding_pubkey_arg_ref;
12962 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12963 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12964 LDKPublicKey revocation_basepoint_arg_ref;
12965 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12966 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12967 LDKPublicKey payment_point_arg_ref;
12968 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12969 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12970 LDKPublicKey delayed_payment_basepoint_arg_ref;
12971 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12972 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12973 LDKPublicKey htlc_basepoint_arg_ref;
12974 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12975 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12976 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);
12977 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12978 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12979 long ret_ref = (long)ret_var.inner;
12980 if (ret_var.is_owned) {
12986 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12987 LDKChannelPublicKeys obj_conv;
12988 obj_conv.inner = (void*)(obj & (~1));
12989 obj_conv.is_owned = false;
12990 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12991 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12992 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12993 CVec_u8Z_free(arg_var);
12997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12998 LDKu8slice ser_ref;
12999 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13000 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13001 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
13002 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13003 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13004 long ret_ref = (long)ret_var.inner;
13005 if (ret_var.is_owned) {
13008 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13012 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) {
13013 LDKPublicKey per_commitment_point_ref;
13014 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
13015 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
13016 LDKPublicKey broadcaster_delayed_payment_base_ref;
13017 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
13018 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
13019 LDKPublicKey broadcaster_htlc_base_ref;
13020 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
13021 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
13022 LDKPublicKey countersignatory_revocation_base_ref;
13023 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
13024 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
13025 LDKPublicKey countersignatory_htlc_base_ref;
13026 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
13027 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
13028 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
13029 *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);
13030 return (long)ret_conv;
13033 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) {
13034 LDKPublicKey revocation_key_ref;
13035 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
13036 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
13037 LDKPublicKey broadcaster_delayed_payment_key_ref;
13038 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
13039 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
13040 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
13041 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13042 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13043 CVec_u8Z_free(arg_var);
13047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13048 LDKHTLCOutputInCommitment this_ptr_conv;
13049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13051 HTLCOutputInCommitment_free(this_ptr_conv);
13054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13055 LDKHTLCOutputInCommitment orig_conv;
13056 orig_conv.inner = (void*)(orig & (~1));
13057 orig_conv.is_owned = false;
13058 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
13059 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13060 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13061 long ret_ref = (long)ret_var.inner;
13062 if (ret_var.is_owned) {
13068 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
13069 LDKHTLCOutputInCommitment this_ptr_conv;
13070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13071 this_ptr_conv.is_owned = false;
13072 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
13076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13077 LDKHTLCOutputInCommitment this_ptr_conv;
13078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13079 this_ptr_conv.is_owned = false;
13080 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
13083 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13084 LDKHTLCOutputInCommitment this_ptr_conv;
13085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13086 this_ptr_conv.is_owned = false;
13087 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
13091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13092 LDKHTLCOutputInCommitment this_ptr_conv;
13093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13094 this_ptr_conv.is_owned = false;
13095 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
13098 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
13099 LDKHTLCOutputInCommitment this_ptr_conv;
13100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13101 this_ptr_conv.is_owned = false;
13102 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
13106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13107 LDKHTLCOutputInCommitment this_ptr_conv;
13108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13109 this_ptr_conv.is_owned = false;
13110 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
13113 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
13114 LDKHTLCOutputInCommitment this_ptr_conv;
13115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13116 this_ptr_conv.is_owned = false;
13117 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
13118 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
13122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13123 LDKHTLCOutputInCommitment this_ptr_conv;
13124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13125 this_ptr_conv.is_owned = false;
13126 LDKThirtyTwoBytes val_ref;
13127 CHECK((*_env)->GetArrayLength (_env, val) == 32);
13128 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
13129 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
13132 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
13133 LDKHTLCOutputInCommitment obj_conv;
13134 obj_conv.inner = (void*)(obj & (~1));
13135 obj_conv.is_owned = false;
13136 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
13137 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13138 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13139 CVec_u8Z_free(arg_var);
13143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13144 LDKu8slice ser_ref;
13145 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13146 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13147 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
13148 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13149 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13150 long ret_ref = (long)ret_var.inner;
13151 if (ret_var.is_owned) {
13154 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13158 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
13159 LDKHTLCOutputInCommitment htlc_conv;
13160 htlc_conv.inner = (void*)(htlc & (~1));
13161 htlc_conv.is_owned = false;
13162 LDKTxCreationKeys keys_conv;
13163 keys_conv.inner = (void*)(keys & (~1));
13164 keys_conv.is_owned = false;
13165 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
13166 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13167 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13168 CVec_u8Z_free(arg_var);
13172 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
13173 LDKPublicKey broadcaster_ref;
13174 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
13175 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
13176 LDKPublicKey countersignatory_ref;
13177 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
13178 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
13179 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13180 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13181 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13182 CVec_u8Z_free(arg_var);
13186 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) {
13187 unsigned char prev_hash_arr[32];
13188 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
13189 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
13190 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13191 LDKHTLCOutputInCommitment htlc_conv;
13192 htlc_conv.inner = (void*)(htlc & (~1));
13193 htlc_conv.is_owned = false;
13194 LDKPublicKey broadcaster_delayed_payment_key_ref;
13195 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
13196 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
13197 LDKPublicKey revocation_key_ref;
13198 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
13199 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
13200 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13201 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13202 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13203 Transaction_free(arg_var);
13207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13208 LDKHolderCommitmentTransaction this_ptr_conv;
13209 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13210 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13211 HolderCommitmentTransaction_free(this_ptr_conv);
13214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13215 LDKHolderCommitmentTransaction orig_conv;
13216 orig_conv.inner = (void*)(orig & (~1));
13217 orig_conv.is_owned = false;
13218 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13219 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13220 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13221 long ret_ref = (long)ret_var.inner;
13222 if (ret_var.is_owned) {
13228 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
13229 LDKHolderCommitmentTransaction this_ptr_conv;
13230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13231 this_ptr_conv.is_owned = false;
13232 LDKTransaction arg_var = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
13233 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13234 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13235 Transaction_free(arg_var);
13239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13240 LDKHolderCommitmentTransaction this_ptr_conv;
13241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13242 this_ptr_conv.is_owned = false;
13243 LDKTransaction val_ref;
13244 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
13245 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
13246 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
13247 val_ref.data_is_owned = true;
13248 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_ref);
13251 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
13252 LDKHolderCommitmentTransaction this_ptr_conv;
13253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13254 this_ptr_conv.is_owned = false;
13255 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13256 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
13260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13261 LDKHolderCommitmentTransaction this_ptr_conv;
13262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13263 this_ptr_conv.is_owned = false;
13264 LDKSignature val_ref;
13265 CHECK((*_env)->GetArrayLength (_env, val) == 64);
13266 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
13267 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
13270 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
13271 LDKHolderCommitmentTransaction this_ptr_conv;
13272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13273 this_ptr_conv.is_owned = false;
13274 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
13278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13279 LDKHolderCommitmentTransaction this_ptr_conv;
13280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13281 this_ptr_conv.is_owned = false;
13282 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
13285 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13286 LDKHolderCommitmentTransaction this_ptr_conv;
13287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13288 this_ptr_conv.is_owned = false;
13289 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
13290 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13291 if (val_constr.datalen > 0)
13292 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13294 val_constr.data = NULL;
13295 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13296 for (size_t q = 0; q < val_constr.datalen; q++) {
13297 long arr_conv_42 = val_vals[q];
13298 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13299 FREE((void*)arr_conv_42);
13300 val_constr.data[q] = arr_conv_42_conv;
13302 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13303 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
13306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jbyteArray unsigned_tx, jbyteArray counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlongArray htlc_data) {
13307 LDKTransaction unsigned_tx_ref;
13308 unsigned_tx_ref.datalen = (*_env)->GetArrayLength (_env, unsigned_tx);
13309 unsigned_tx_ref.data = MALLOC(unsigned_tx_ref.datalen, "LDKTransaction Bytes");
13310 (*_env)->GetByteArrayRegion(_env, unsigned_tx, 0, unsigned_tx_ref.datalen, unsigned_tx_ref.data);
13311 unsigned_tx_ref.data_is_owned = true;
13312 LDKSignature counterparty_sig_ref;
13313 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
13314 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
13315 LDKPublicKey holder_funding_key_ref;
13316 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
13317 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
13318 LDKPublicKey counterparty_funding_key_ref;
13319 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
13320 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
13321 LDKTxCreationKeys keys_conv;
13322 keys_conv.inner = (void*)(keys & (~1));
13323 keys_conv.is_owned = (keys & 1) || (keys == 0);
13324 if (keys_conv.inner != NULL)
13325 keys_conv = TxCreationKeys_clone(&keys_conv);
13326 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
13327 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
13328 if (htlc_data_constr.datalen > 0)
13329 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13331 htlc_data_constr.data = NULL;
13332 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
13333 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
13334 long arr_conv_42 = htlc_data_vals[q];
13335 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13336 FREE((void*)arr_conv_42);
13337 htlc_data_constr.data[q] = arr_conv_42_conv;
13339 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
13340 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_ref, counterparty_sig_ref, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_constr);
13341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13343 long ret_ref = (long)ret_var.inner;
13344 if (ret_var.is_owned) {
13350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13351 LDKHolderCommitmentTransaction this_arg_conv;
13352 this_arg_conv.inner = (void*)(this_arg & (~1));
13353 this_arg_conv.is_owned = false;
13354 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13355 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13356 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13357 long ret_ref = (long)ret_var.inner;
13358 if (ret_var.is_owned) {
13364 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13365 LDKHolderCommitmentTransaction this_arg_conv;
13366 this_arg_conv.inner = (void*)(this_arg & (~1));
13367 this_arg_conv.is_owned = false;
13368 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13369 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1holder_1sig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jbyteArray funding_redeemscript, jlong channel_value_satoshis) {
13374 LDKHolderCommitmentTransaction this_arg_conv;
13375 this_arg_conv.inner = (void*)(this_arg & (~1));
13376 this_arg_conv.is_owned = false;
13377 unsigned char funding_key_arr[32];
13378 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13379 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13380 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13381 LDKu8slice funding_redeemscript_ref;
13382 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13383 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13384 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13385 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_holder_sig(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
13386 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1htlc_1sigs(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_base_key, jshort counterparty_selected_contest_delay) {
13391 LDKHolderCommitmentTransaction this_arg_conv;
13392 this_arg_conv.inner = (void*)(this_arg & (~1));
13393 this_arg_conv.is_owned = false;
13394 unsigned char htlc_base_key_arr[32];
13395 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13396 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13397 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13398 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13399 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13400 return (long)ret_conv;
13403 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
13404 LDKHolderCommitmentTransaction this_ptr_conv;
13405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13406 this_ptr_conv.is_owned = false;
13407 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&this_ptr_conv);
13408 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13409 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13410 CVec_u8Z_free(arg_var);
13414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13415 LDKu8slice ser_ref;
13416 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13417 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13418 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13419 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13420 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13421 long ret_ref = (long)ret_var.inner;
13422 if (ret_var.is_owned) {
13425 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13430 LDKInitFeatures this_ptr_conv;
13431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13433 InitFeatures_free(this_ptr_conv);
13436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13437 LDKNodeFeatures this_ptr_conv;
13438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13440 NodeFeatures_free(this_ptr_conv);
13443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13444 LDKChannelFeatures this_ptr_conv;
13445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13447 ChannelFeatures_free(this_ptr_conv);
13450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13451 LDKRouteHop this_ptr_conv;
13452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13453 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13454 RouteHop_free(this_ptr_conv);
13457 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13458 LDKRouteHop orig_conv;
13459 orig_conv.inner = (void*)(orig & (~1));
13460 orig_conv.is_owned = false;
13461 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13462 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13463 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13464 long ret_ref = (long)ret_var.inner;
13465 if (ret_var.is_owned) {
13471 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13472 LDKRouteHop this_ptr_conv;
13473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13474 this_ptr_conv.is_owned = false;
13475 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13476 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13481 LDKRouteHop this_ptr_conv;
13482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13483 this_ptr_conv.is_owned = false;
13484 LDKPublicKey val_ref;
13485 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13486 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13487 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13491 LDKRouteHop this_ptr_conv;
13492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13493 this_ptr_conv.is_owned = false;
13494 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
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) {
13504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13505 LDKRouteHop this_ptr_conv;
13506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13507 this_ptr_conv.is_owned = false;
13508 LDKNodeFeatures val_conv;
13509 val_conv.inner = (void*)(val & (~1));
13510 val_conv.is_owned = (val & 1) || (val == 0);
13511 // Warning: we may need a move here but can't clone!
13512 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13516 LDKRouteHop this_ptr_conv;
13517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13518 this_ptr_conv.is_owned = false;
13519 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13524 LDKRouteHop this_ptr_conv;
13525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13526 this_ptr_conv.is_owned = false;
13527 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13531 LDKRouteHop this_ptr_conv;
13532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13533 this_ptr_conv.is_owned = false;
13534 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13535 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13536 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13537 long ret_ref = (long)ret_var.inner;
13538 if (ret_var.is_owned) {
13544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13545 LDKRouteHop this_ptr_conv;
13546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13547 this_ptr_conv.is_owned = false;
13548 LDKChannelFeatures val_conv;
13549 val_conv.inner = (void*)(val & (~1));
13550 val_conv.is_owned = (val & 1) || (val == 0);
13551 // Warning: we may need a move here but can't clone!
13552 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13556 LDKRouteHop this_ptr_conv;
13557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13558 this_ptr_conv.is_owned = false;
13559 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13564 LDKRouteHop this_ptr_conv;
13565 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13566 this_ptr_conv.is_owned = false;
13567 RouteHop_set_fee_msat(&this_ptr_conv, val);
13570 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13571 LDKRouteHop this_ptr_conv;
13572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13573 this_ptr_conv.is_owned = false;
13574 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13579 LDKRouteHop this_ptr_conv;
13580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13581 this_ptr_conv.is_owned = false;
13582 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13585 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) {
13586 LDKPublicKey pubkey_arg_ref;
13587 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13588 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13589 LDKNodeFeatures node_features_arg_conv;
13590 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13591 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13592 // Warning: we may need a move here but can't clone!
13593 LDKChannelFeatures channel_features_arg_conv;
13594 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13595 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13596 // Warning: we may need a move here but can't clone!
13597 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);
13598 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13599 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13600 long ret_ref = (long)ret_var.inner;
13601 if (ret_var.is_owned) {
13607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13608 LDKRoute this_ptr_conv;
13609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13611 Route_free(this_ptr_conv);
13614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13615 LDKRoute orig_conv;
13616 orig_conv.inner = (void*)(orig & (~1));
13617 orig_conv.is_owned = false;
13618 LDKRoute ret_var = Route_clone(&orig_conv);
13619 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13620 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13621 long ret_ref = (long)ret_var.inner;
13622 if (ret_var.is_owned) {
13628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13629 LDKRoute this_ptr_conv;
13630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13631 this_ptr_conv.is_owned = false;
13632 LDKCVec_CVec_RouteHopZZ val_constr;
13633 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13634 if (val_constr.datalen > 0)
13635 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13637 val_constr.data = NULL;
13638 for (size_t m = 0; m < val_constr.datalen; m++) {
13639 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13640 LDKCVec_RouteHopZ arr_conv_12_constr;
13641 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13642 if (arr_conv_12_constr.datalen > 0)
13643 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13645 arr_conv_12_constr.data = NULL;
13646 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13647 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13648 long arr_conv_10 = arr_conv_12_vals[k];
13649 LDKRouteHop arr_conv_10_conv;
13650 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13651 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13652 if (arr_conv_10_conv.inner != NULL)
13653 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13654 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13656 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13657 val_constr.data[m] = arr_conv_12_constr;
13659 Route_set_paths(&this_ptr_conv, val_constr);
13662 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13663 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13664 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13665 if (paths_arg_constr.datalen > 0)
13666 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13668 paths_arg_constr.data = NULL;
13669 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13670 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13671 LDKCVec_RouteHopZ arr_conv_12_constr;
13672 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13673 if (arr_conv_12_constr.datalen > 0)
13674 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13676 arr_conv_12_constr.data = NULL;
13677 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13678 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13679 long arr_conv_10 = arr_conv_12_vals[k];
13680 LDKRouteHop arr_conv_10_conv;
13681 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13682 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13683 if (arr_conv_10_conv.inner != NULL)
13684 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13685 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13687 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13688 paths_arg_constr.data[m] = arr_conv_12_constr;
13690 LDKRoute ret_var = Route_new(paths_arg_constr);
13691 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13692 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13693 long ret_ref = (long)ret_var.inner;
13694 if (ret_var.is_owned) {
13700 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
13701 LDKRoute this_ptr_conv;
13702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13703 this_ptr_conv.is_owned = false;
13704 LDKCVec_u8Z arg_var = Route_write(&this_ptr_conv);
13705 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13706 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13707 CVec_u8Z_free(arg_var);
13711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13712 LDKu8slice ser_ref;
13713 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13714 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13715 LDKRoute ret_var = Route_read(ser_ref);
13716 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13717 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13718 long ret_ref = (long)ret_var.inner;
13719 if (ret_var.is_owned) {
13722 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13727 LDKRouteHint this_ptr_conv;
13728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13730 RouteHint_free(this_ptr_conv);
13733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13734 LDKRouteHint orig_conv;
13735 orig_conv.inner = (void*)(orig & (~1));
13736 orig_conv.is_owned = false;
13737 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13738 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13739 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13740 long ret_ref = (long)ret_var.inner;
13741 if (ret_var.is_owned) {
13747 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13748 LDKRouteHint this_ptr_conv;
13749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13750 this_ptr_conv.is_owned = false;
13751 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13752 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13757 LDKRouteHint this_ptr_conv;
13758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13759 this_ptr_conv.is_owned = false;
13760 LDKPublicKey val_ref;
13761 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13762 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13763 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13767 LDKRouteHint this_ptr_conv;
13768 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13769 this_ptr_conv.is_owned = false;
13770 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13775 LDKRouteHint this_ptr_conv;
13776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13777 this_ptr_conv.is_owned = false;
13778 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13782 LDKRouteHint this_ptr_conv;
13783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13784 this_ptr_conv.is_owned = false;
13785 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13786 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13787 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13788 long ret_ref = (long)ret_var.inner;
13789 if (ret_var.is_owned) {
13795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13796 LDKRouteHint this_ptr_conv;
13797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13798 this_ptr_conv.is_owned = false;
13799 LDKRoutingFees val_conv;
13800 val_conv.inner = (void*)(val & (~1));
13801 val_conv.is_owned = (val & 1) || (val == 0);
13802 if (val_conv.inner != NULL)
13803 val_conv = RoutingFees_clone(&val_conv);
13804 RouteHint_set_fees(&this_ptr_conv, val_conv);
13807 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13808 LDKRouteHint this_ptr_conv;
13809 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13810 this_ptr_conv.is_owned = false;
13811 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13816 LDKRouteHint this_ptr_conv;
13817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13818 this_ptr_conv.is_owned = false;
13819 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13823 LDKRouteHint this_ptr_conv;
13824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13825 this_ptr_conv.is_owned = false;
13826 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13831 LDKRouteHint this_ptr_conv;
13832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13833 this_ptr_conv.is_owned = false;
13834 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13837 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) {
13838 LDKPublicKey src_node_id_arg_ref;
13839 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13840 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13841 LDKRoutingFees fees_arg_conv;
13842 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13843 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13844 if (fees_arg_conv.inner != NULL)
13845 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13846 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);
13847 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13848 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13849 long ret_ref = (long)ret_var.inner;
13850 if (ret_var.is_owned) {
13856 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) {
13857 LDKPublicKey our_node_id_ref;
13858 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13859 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13860 LDKNetworkGraph network_conv;
13861 network_conv.inner = (void*)(network & (~1));
13862 network_conv.is_owned = false;
13863 LDKPublicKey target_ref;
13864 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13865 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13866 LDKCVec_ChannelDetailsZ first_hops_constr;
13867 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13868 if (first_hops_constr.datalen > 0)
13869 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13871 first_hops_constr.data = NULL;
13872 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13873 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13874 long arr_conv_16 = first_hops_vals[q];
13875 LDKChannelDetails arr_conv_16_conv;
13876 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13877 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13878 first_hops_constr.data[q] = arr_conv_16_conv;
13880 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13881 LDKCVec_RouteHintZ last_hops_constr;
13882 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13883 if (last_hops_constr.datalen > 0)
13884 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13886 last_hops_constr.data = NULL;
13887 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13888 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13889 long arr_conv_11 = last_hops_vals[l];
13890 LDKRouteHint arr_conv_11_conv;
13891 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13892 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13893 if (arr_conv_11_conv.inner != NULL)
13894 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13895 last_hops_constr.data[l] = arr_conv_11_conv;
13897 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13898 LDKLogger logger_conv = *(LDKLogger*)logger;
13899 if (logger_conv.free == LDKLogger_JCalls_free) {
13900 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13901 LDKLogger_JCalls_clone(logger_conv.this_arg);
13903 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13904 *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);
13905 FREE(first_hops_constr.data);
13906 return (long)ret_conv;
13909 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13910 LDKNetworkGraph this_ptr_conv;
13911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13912 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13913 NetworkGraph_free(this_ptr_conv);
13916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13917 LDKLockedNetworkGraph this_ptr_conv;
13918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13919 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13920 LockedNetworkGraph_free(this_ptr_conv);
13923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13924 LDKNetGraphMsgHandler this_ptr_conv;
13925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13927 NetGraphMsgHandler_free(this_ptr_conv);
13930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13931 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13932 LDKLogger logger_conv = *(LDKLogger*)logger;
13933 if (logger_conv.free == LDKLogger_JCalls_free) {
13934 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13935 LDKLogger_JCalls_clone(logger_conv.this_arg);
13937 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13938 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13939 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13940 long ret_ref = (long)ret_var.inner;
13941 if (ret_var.is_owned) {
13947 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13948 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13949 LDKLogger logger_conv = *(LDKLogger*)logger;
13950 if (logger_conv.free == LDKLogger_JCalls_free) {
13951 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13952 LDKLogger_JCalls_clone(logger_conv.this_arg);
13954 LDKNetworkGraph network_graph_conv;
13955 network_graph_conv.inner = (void*)(network_graph & (~1));
13956 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13957 // Warning: we may need a move here but can't clone!
13958 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13959 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13960 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13961 long ret_ref = (long)ret_var.inner;
13962 if (ret_var.is_owned) {
13968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13969 LDKNetGraphMsgHandler this_arg_conv;
13970 this_arg_conv.inner = (void*)(this_arg & (~1));
13971 this_arg_conv.is_owned = false;
13972 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13975 long ret_ref = (long)ret_var.inner;
13976 if (ret_var.is_owned) {
13982 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13983 LDKLockedNetworkGraph this_arg_conv;
13984 this_arg_conv.inner = (void*)(this_arg & (~1));
13985 this_arg_conv.is_owned = false;
13986 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13987 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13988 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13989 long ret_ref = (long)ret_var.inner;
13990 if (ret_var.is_owned) {
13996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13997 LDKNetGraphMsgHandler this_arg_conv;
13998 this_arg_conv.inner = (void*)(this_arg & (~1));
13999 this_arg_conv.is_owned = false;
14000 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
14001 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
14005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14006 LDKDirectionalChannelInfo this_ptr_conv;
14007 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14008 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14009 DirectionalChannelInfo_free(this_ptr_conv);
14012 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14013 LDKDirectionalChannelInfo this_ptr_conv;
14014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14015 this_ptr_conv.is_owned = false;
14016 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
14020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14021 LDKDirectionalChannelInfo this_ptr_conv;
14022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14023 this_ptr_conv.is_owned = false;
14024 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
14027 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
14028 LDKDirectionalChannelInfo this_ptr_conv;
14029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14030 this_ptr_conv.is_owned = false;
14031 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
14035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
14036 LDKDirectionalChannelInfo this_ptr_conv;
14037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14038 this_ptr_conv.is_owned = false;
14039 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
14042 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
14043 LDKDirectionalChannelInfo this_ptr_conv;
14044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14045 this_ptr_conv.is_owned = false;
14046 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
14050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
14051 LDKDirectionalChannelInfo this_ptr_conv;
14052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14053 this_ptr_conv.is_owned = false;
14054 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
14057 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14058 LDKDirectionalChannelInfo this_ptr_conv;
14059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14060 this_ptr_conv.is_owned = false;
14061 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
14065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14066 LDKDirectionalChannelInfo this_ptr_conv;
14067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14068 this_ptr_conv.is_owned = false;
14069 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
14072 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14073 LDKDirectionalChannelInfo this_ptr_conv;
14074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14075 this_ptr_conv.is_owned = false;
14076 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
14077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14079 long ret_ref = (long)ret_var.inner;
14080 if (ret_var.is_owned) {
14086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14087 LDKDirectionalChannelInfo this_ptr_conv;
14088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14089 this_ptr_conv.is_owned = false;
14090 LDKChannelUpdate val_conv;
14091 val_conv.inner = (void*)(val & (~1));
14092 val_conv.is_owned = (val & 1) || (val == 0);
14093 if (val_conv.inner != NULL)
14094 val_conv = ChannelUpdate_clone(&val_conv);
14095 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
14098 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14099 LDKDirectionalChannelInfo obj_conv;
14100 obj_conv.inner = (void*)(obj & (~1));
14101 obj_conv.is_owned = false;
14102 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
14103 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14104 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14105 CVec_u8Z_free(arg_var);
14109 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14110 LDKu8slice ser_ref;
14111 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14112 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14113 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
14114 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14115 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14116 long ret_ref = (long)ret_var.inner;
14117 if (ret_var.is_owned) {
14120 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14125 LDKChannelInfo this_ptr_conv;
14126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14128 ChannelInfo_free(this_ptr_conv);
14131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14132 LDKChannelInfo this_ptr_conv;
14133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14134 this_ptr_conv.is_owned = false;
14135 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
14136 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14137 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14138 long ret_ref = (long)ret_var.inner;
14139 if (ret_var.is_owned) {
14145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14146 LDKChannelInfo this_ptr_conv;
14147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14148 this_ptr_conv.is_owned = false;
14149 LDKChannelFeatures val_conv;
14150 val_conv.inner = (void*)(val & (~1));
14151 val_conv.is_owned = (val & 1) || (val == 0);
14152 // Warning: we may need a move here but can't clone!
14153 ChannelInfo_set_features(&this_ptr_conv, val_conv);
14156 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14157 LDKChannelInfo this_ptr_conv;
14158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14159 this_ptr_conv.is_owned = false;
14160 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14161 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
14165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14166 LDKChannelInfo this_ptr_conv;
14167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14168 this_ptr_conv.is_owned = false;
14169 LDKPublicKey val_ref;
14170 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14171 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14172 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
14175 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14176 LDKChannelInfo this_ptr_conv;
14177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14178 this_ptr_conv.is_owned = false;
14179 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
14180 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14181 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14182 long ret_ref = (long)ret_var.inner;
14183 if (ret_var.is_owned) {
14189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14190 LDKChannelInfo this_ptr_conv;
14191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14192 this_ptr_conv.is_owned = false;
14193 LDKDirectionalChannelInfo val_conv;
14194 val_conv.inner = (void*)(val & (~1));
14195 val_conv.is_owned = (val & 1) || (val == 0);
14196 // Warning: we may need a move here but can't clone!
14197 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
14200 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14201 LDKChannelInfo this_ptr_conv;
14202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14203 this_ptr_conv.is_owned = false;
14204 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14205 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
14209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14210 LDKChannelInfo this_ptr_conv;
14211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14212 this_ptr_conv.is_owned = false;
14213 LDKPublicKey val_ref;
14214 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14215 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14216 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
14219 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14220 LDKChannelInfo this_ptr_conv;
14221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14222 this_ptr_conv.is_owned = false;
14223 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
14224 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14225 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14226 long ret_ref = (long)ret_var.inner;
14227 if (ret_var.is_owned) {
14233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14234 LDKChannelInfo this_ptr_conv;
14235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14236 this_ptr_conv.is_owned = false;
14237 LDKDirectionalChannelInfo val_conv;
14238 val_conv.inner = (void*)(val & (~1));
14239 val_conv.is_owned = (val & 1) || (val == 0);
14240 // Warning: we may need a move here but can't clone!
14241 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
14244 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14245 LDKChannelInfo this_ptr_conv;
14246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14247 this_ptr_conv.is_owned = false;
14248 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
14249 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14250 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14251 long ret_ref = (long)ret_var.inner;
14252 if (ret_var.is_owned) {
14258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14259 LDKChannelInfo this_ptr_conv;
14260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14261 this_ptr_conv.is_owned = false;
14262 LDKChannelAnnouncement val_conv;
14263 val_conv.inner = (void*)(val & (~1));
14264 val_conv.is_owned = (val & 1) || (val == 0);
14265 if (val_conv.inner != NULL)
14266 val_conv = ChannelAnnouncement_clone(&val_conv);
14267 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
14270 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14271 LDKChannelInfo obj_conv;
14272 obj_conv.inner = (void*)(obj & (~1));
14273 obj_conv.is_owned = false;
14274 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
14275 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14276 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14277 CVec_u8Z_free(arg_var);
14281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14282 LDKu8slice ser_ref;
14283 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14284 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14285 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
14286 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14287 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14288 long ret_ref = (long)ret_var.inner;
14289 if (ret_var.is_owned) {
14292 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14297 LDKRoutingFees this_ptr_conv;
14298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14300 RoutingFees_free(this_ptr_conv);
14303 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14304 LDKRoutingFees orig_conv;
14305 orig_conv.inner = (void*)(orig & (~1));
14306 orig_conv.is_owned = false;
14307 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
14308 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14309 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14310 long ret_ref = (long)ret_var.inner;
14311 if (ret_var.is_owned) {
14317 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14318 LDKRoutingFees this_ptr_conv;
14319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14320 this_ptr_conv.is_owned = false;
14321 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
14325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14326 LDKRoutingFees this_ptr_conv;
14327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14328 this_ptr_conv.is_owned = false;
14329 RoutingFees_set_base_msat(&this_ptr_conv, val);
14332 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
14333 LDKRoutingFees this_ptr_conv;
14334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14335 this_ptr_conv.is_owned = false;
14336 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
14340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14341 LDKRoutingFees this_ptr_conv;
14342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14343 this_ptr_conv.is_owned = false;
14344 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14348 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14349 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14350 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14351 long ret_ref = (long)ret_var.inner;
14352 if (ret_var.is_owned) {
14358 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14359 LDKu8slice ser_ref;
14360 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14361 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14362 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
14363 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14364 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14365 long ret_ref = (long)ret_var.inner;
14366 if (ret_var.is_owned) {
14369 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
14374 LDKRoutingFees this_ptr_conv;
14375 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14376 this_ptr_conv.is_owned = false;
14377 LDKCVec_u8Z arg_var = RoutingFees_write(&this_ptr_conv);
14378 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14379 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14380 CVec_u8Z_free(arg_var);
14384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14385 LDKNodeAnnouncementInfo this_ptr_conv;
14386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14388 NodeAnnouncementInfo_free(this_ptr_conv);
14391 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14392 LDKNodeAnnouncementInfo this_ptr_conv;
14393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14394 this_ptr_conv.is_owned = false;
14395 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14396 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14397 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14398 long ret_ref = (long)ret_var.inner;
14399 if (ret_var.is_owned) {
14405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14406 LDKNodeAnnouncementInfo this_ptr_conv;
14407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14408 this_ptr_conv.is_owned = false;
14409 LDKNodeFeatures val_conv;
14410 val_conv.inner = (void*)(val & (~1));
14411 val_conv.is_owned = (val & 1) || (val == 0);
14412 // Warning: we may need a move here but can't clone!
14413 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14416 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14417 LDKNodeAnnouncementInfo this_ptr_conv;
14418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14419 this_ptr_conv.is_owned = false;
14420 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14425 LDKNodeAnnouncementInfo this_ptr_conv;
14426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14427 this_ptr_conv.is_owned = false;
14428 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14431 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
14432 LDKNodeAnnouncementInfo this_ptr_conv;
14433 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14434 this_ptr_conv.is_owned = false;
14435 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14436 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14441 LDKNodeAnnouncementInfo this_ptr_conv;
14442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14443 this_ptr_conv.is_owned = false;
14444 LDKThreeBytes val_ref;
14445 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14446 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14447 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14450 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14451 LDKNodeAnnouncementInfo this_ptr_conv;
14452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14453 this_ptr_conv.is_owned = false;
14454 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14455 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14460 LDKNodeAnnouncementInfo this_ptr_conv;
14461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14462 this_ptr_conv.is_owned = false;
14463 LDKThirtyTwoBytes val_ref;
14464 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14465 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14466 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14470 LDKNodeAnnouncementInfo this_ptr_conv;
14471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14472 this_ptr_conv.is_owned = false;
14473 LDKCVec_NetAddressZ val_constr;
14474 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14475 if (val_constr.datalen > 0)
14476 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14478 val_constr.data = NULL;
14479 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14480 for (size_t m = 0; m < val_constr.datalen; m++) {
14481 long arr_conv_12 = val_vals[m];
14482 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14483 FREE((void*)arr_conv_12);
14484 val_constr.data[m] = arr_conv_12_conv;
14486 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14487 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14491 LDKNodeAnnouncementInfo this_ptr_conv;
14492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14493 this_ptr_conv.is_owned = false;
14494 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14495 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14496 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14497 long ret_ref = (long)ret_var.inner;
14498 if (ret_var.is_owned) {
14504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14505 LDKNodeAnnouncementInfo this_ptr_conv;
14506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14507 this_ptr_conv.is_owned = false;
14508 LDKNodeAnnouncement val_conv;
14509 val_conv.inner = (void*)(val & (~1));
14510 val_conv.is_owned = (val & 1) || (val == 0);
14511 if (val_conv.inner != NULL)
14512 val_conv = NodeAnnouncement_clone(&val_conv);
14513 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14516 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) {
14517 LDKNodeFeatures features_arg_conv;
14518 features_arg_conv.inner = (void*)(features_arg & (~1));
14519 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14520 // Warning: we may need a move here but can't clone!
14521 LDKThreeBytes rgb_arg_ref;
14522 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14523 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14524 LDKThirtyTwoBytes alias_arg_ref;
14525 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14526 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14527 LDKCVec_NetAddressZ addresses_arg_constr;
14528 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14529 if (addresses_arg_constr.datalen > 0)
14530 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14532 addresses_arg_constr.data = NULL;
14533 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14534 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14535 long arr_conv_12 = addresses_arg_vals[m];
14536 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14537 FREE((void*)arr_conv_12);
14538 addresses_arg_constr.data[m] = arr_conv_12_conv;
14540 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14541 LDKNodeAnnouncement announcement_message_arg_conv;
14542 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14543 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14544 if (announcement_message_arg_conv.inner != NULL)
14545 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14546 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14547 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14548 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14549 long ret_ref = (long)ret_var.inner;
14550 if (ret_var.is_owned) {
14556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
14557 LDKNodeAnnouncementInfo this_ptr_conv;
14558 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14559 this_ptr_conv.is_owned = false;
14560 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&this_ptr_conv);
14561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14563 CVec_u8Z_free(arg_var);
14567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14568 LDKu8slice ser_ref;
14569 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14570 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14571 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_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) {
14578 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14583 LDKNodeInfo this_ptr_conv;
14584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14586 NodeInfo_free(this_ptr_conv);
14589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14590 LDKNodeInfo this_ptr_conv;
14591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14592 this_ptr_conv.is_owned = false;
14593 LDKCVec_u64Z val_constr;
14594 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14595 if (val_constr.datalen > 0)
14596 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14598 val_constr.data = NULL;
14599 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14600 for (size_t g = 0; g < val_constr.datalen; g++) {
14601 long arr_conv_6 = val_vals[g];
14602 val_constr.data[g] = arr_conv_6;
14604 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14605 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14609 LDKNodeInfo this_ptr_conv;
14610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14611 this_ptr_conv.is_owned = false;
14612 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14613 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14614 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14615 long ret_ref = (long)ret_var.inner;
14616 if (ret_var.is_owned) {
14622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14623 LDKNodeInfo this_ptr_conv;
14624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14625 this_ptr_conv.is_owned = false;
14626 LDKRoutingFees val_conv;
14627 val_conv.inner = (void*)(val & (~1));
14628 val_conv.is_owned = (val & 1) || (val == 0);
14629 if (val_conv.inner != NULL)
14630 val_conv = RoutingFees_clone(&val_conv);
14631 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14635 LDKNodeInfo this_ptr_conv;
14636 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14637 this_ptr_conv.is_owned = false;
14638 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14639 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14640 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14641 long ret_ref = (long)ret_var.inner;
14642 if (ret_var.is_owned) {
14648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14649 LDKNodeInfo this_ptr_conv;
14650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14651 this_ptr_conv.is_owned = false;
14652 LDKNodeAnnouncementInfo val_conv;
14653 val_conv.inner = (void*)(val & (~1));
14654 val_conv.is_owned = (val & 1) || (val == 0);
14655 // Warning: we may need a move here but can't clone!
14656 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14659 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) {
14660 LDKCVec_u64Z channels_arg_constr;
14661 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14662 if (channels_arg_constr.datalen > 0)
14663 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14665 channels_arg_constr.data = NULL;
14666 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14667 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14668 long arr_conv_6 = channels_arg_vals[g];
14669 channels_arg_constr.data[g] = arr_conv_6;
14671 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14672 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14673 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14674 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14675 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14676 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14677 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14678 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14679 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14680 // Warning: we may need a move here but can't clone!
14681 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14682 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14683 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14684 long ret_ref = (long)ret_var.inner;
14685 if (ret_var.is_owned) {
14691 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
14692 LDKNodeInfo this_ptr_conv;
14693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14694 this_ptr_conv.is_owned = false;
14695 LDKCVec_u8Z arg_var = NodeInfo_write(&this_ptr_conv);
14696 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14697 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14698 CVec_u8Z_free(arg_var);
14702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14703 LDKu8slice ser_ref;
14704 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14705 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14706 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14707 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14708 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14709 long ret_ref = (long)ret_var.inner;
14710 if (ret_var.is_owned) {
14713 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong this_ptr) {
14718 LDKNetworkGraph this_ptr_conv;
14719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14720 this_ptr_conv.is_owned = false;
14721 LDKCVec_u8Z arg_var = NetworkGraph_write(&this_ptr_conv);
14722 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14723 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14724 CVec_u8Z_free(arg_var);
14728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14729 LDKu8slice ser_ref;
14730 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14731 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14732 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14733 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14734 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14735 long ret_ref = (long)ret_var.inner;
14736 if (ret_var.is_owned) {
14739 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14744 LDKNetworkGraph ret_var = NetworkGraph_new();
14745 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14746 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14747 long ret_ref = (long)ret_var.inner;
14748 if (ret_var.is_owned) {
14754 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) {
14755 LDKNetworkGraph this_arg_conv;
14756 this_arg_conv.inner = (void*)(this_arg & (~1));
14757 this_arg_conv.is_owned = false;
14758 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);