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 } LDKChannelKeys_JCalls;
1855 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1856 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1858 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1859 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1861 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1862 LDKPublicKey arg_ref;
1863 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1864 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1867 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1868 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1870 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1871 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1873 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1874 LDKThirtyTwoBytes arg_ref;
1875 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1876 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1879 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1880 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1882 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1883 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1885 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1886 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1890 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) {
1891 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1893 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1894 LDKTransaction commitment_tx_var = commitment_tx;
1895 jbyteArray commitment_tx_arr = (*_env)->NewByteArray(_env, commitment_tx_var.datalen);
1896 (*_env)->SetByteArrayRegion(_env, commitment_tx_arr, 0, commitment_tx_var.datalen, commitment_tx_var.data);
1897 Transaction_free(commitment_tx_var);
1898 LDKPreCalculatedTxCreationKeys keys_var = *keys;
1899 if (keys->inner != NULL)
1900 keys_var = PreCalculatedTxCreationKeys_clone(keys);
1901 CHECK((((long)keys_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1902 CHECK((((long)&keys_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1903 long keys_ref = (long)keys_var.inner;
1904 if (keys_var.is_owned) {
1907 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1908 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1909 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1910 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1911 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1912 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1913 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1914 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1915 if (arr_conv_24_var.is_owned) {
1916 arr_conv_24_ref |= 1;
1918 htlcs_arr_ptr[y] = arr_conv_24_ref;
1920 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1921 FREE(htlcs_var.data);
1922 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1924 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);
1925 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1929 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1930 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1932 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1933 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1934 if (holder_commitment_tx->inner != NULL)
1935 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1936 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1937 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1938 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner;
1939 if (holder_commitment_tx_var.is_owned) {
1940 holder_commitment_tx_ref |= 1;
1942 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1944 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx_ref);
1945 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1949 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1950 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1952 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1953 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1954 if (holder_commitment_tx->inner != NULL)
1955 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1956 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1957 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1958 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner;
1959 if (holder_commitment_tx_var.is_owned) {
1960 holder_commitment_tx_ref |= 1;
1962 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1964 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx_ref);
1965 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1969 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) {
1970 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1972 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1973 LDKTransaction justice_tx_var = justice_tx;
1974 jbyteArray justice_tx_arr = (*_env)->NewByteArray(_env, justice_tx_var.datalen);
1975 (*_env)->SetByteArrayRegion(_env, justice_tx_arr, 0, justice_tx_var.datalen, justice_tx_var.data);
1976 Transaction_free(justice_tx_var);
1977 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1978 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1979 LDKHTLCOutputInCommitment htlc_var = *htlc;
1980 if (htlc->inner != NULL)
1981 htlc_var = HTLCOutputInCommitment_clone(htlc);
1982 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1983 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1984 long htlc_ref = (long)htlc_var.inner;
1985 if (htlc_var.is_owned) {
1988 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1990 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);
1991 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1995 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) {
1996 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1998 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1999 LDKTransaction htlc_tx_var = htlc_tx;
2000 jbyteArray htlc_tx_arr = (*_env)->NewByteArray(_env, htlc_tx_var.datalen);
2001 (*_env)->SetByteArrayRegion(_env, htlc_tx_arr, 0, htlc_tx_var.datalen, htlc_tx_var.data);
2002 Transaction_free(htlc_tx_var);
2003 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
2004 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
2005 LDKHTLCOutputInCommitment htlc_var = *htlc;
2006 if (htlc->inner != NULL)
2007 htlc_var = HTLCOutputInCommitment_clone(htlc);
2008 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2009 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2010 long htlc_ref = (long)htlc_var.inner;
2011 if (htlc_var.is_owned) {
2014 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2016 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);
2017 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2021 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
2022 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2024 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2025 LDKTransaction closing_tx_var = closing_tx;
2026 jbyteArray closing_tx_arr = (*_env)->NewByteArray(_env, closing_tx_var.datalen);
2027 (*_env)->SetByteArrayRegion(_env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
2028 Transaction_free(closing_tx_var);
2029 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2031 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
2032 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2036 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
2037 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2039 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2040 LDKUnsignedChannelAnnouncement msg_var = *msg;
2041 if (msg->inner != NULL)
2042 msg_var = UnsignedChannelAnnouncement_clone(msg);
2043 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2044 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2045 long msg_ref = (long)msg_var.inner;
2046 if (msg_var.is_owned) {
2049 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2051 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2052 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2056 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
2057 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2059 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2060 LDKChannelPublicKeys channel_points_var = *channel_points;
2061 if (channel_points->inner != NULL)
2062 channel_points_var = ChannelPublicKeys_clone(channel_points);
2063 CHECK((((long)channel_points_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2064 CHECK((((long)&channel_points_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2065 long channel_points_ref = (long)channel_points_var.inner;
2066 if (channel_points_var.is_owned) {
2067 channel_points_ref |= 1;
2069 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2071 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points_ref, counterparty_selected_contest_delay, holder_selected_contest_delay);
2073 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2074 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2075 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2077 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2078 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2082 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2083 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2084 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2085 return (void*) this_arg;
2087 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2088 jclass c = (*env)->GetObjectClass(env, o);
2090 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2091 atomic_init(&calls->refcnt, 1);
2092 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2093 calls->o = (*env)->NewWeakGlobalRef(env, o);
2094 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2095 CHECK(calls->get_per_commitment_point_meth != NULL);
2096 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2097 CHECK(calls->release_commitment_secret_meth != NULL);
2098 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2099 CHECK(calls->key_derivation_params_meth != NULL);
2100 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(I[BJ[J)J");
2101 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2102 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2103 CHECK(calls->sign_holder_commitment_meth != NULL);
2104 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2105 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2106 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "([BJJ[BJ)J");
2107 CHECK(calls->sign_justice_transaction_meth != NULL);
2108 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
2109 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2110 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
2111 CHECK(calls->sign_closing_transaction_meth != NULL);
2112 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2113 CHECK(calls->sign_channel_announcement_meth != NULL);
2114 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2115 CHECK(calls->on_accept_meth != NULL);
2117 LDKChannelPublicKeys pubkeys_conv;
2118 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2119 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2120 if (pubkeys_conv.inner != NULL)
2121 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2123 LDKChannelKeys ret = {
2124 .this_arg = (void*) calls,
2125 .get_per_commitment_point = get_per_commitment_point_jcall,
2126 .release_commitment_secret = release_commitment_secret_jcall,
2127 .key_derivation_params = key_derivation_params_jcall,
2128 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2129 .sign_holder_commitment = sign_holder_commitment_jcall,
2130 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2131 .sign_justice_transaction = sign_justice_transaction_jcall,
2132 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2133 .sign_closing_transaction = sign_closing_transaction_jcall,
2134 .sign_channel_announcement = sign_channel_announcement_jcall,
2135 .on_accept = on_accept_jcall,
2136 .clone = LDKChannelKeys_JCalls_clone,
2137 .free = LDKChannelKeys_JCalls_free,
2138 .pubkeys = pubkeys_conv,
2139 .set_pubkeys = NULL,
2143 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2144 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2145 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
2146 return (long)res_ptr;
2148 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2149 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2153 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2154 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2155 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2156 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2160 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2161 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2162 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2163 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2167 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2168 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2169 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2170 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2171 return (long)ret_ref;
2174 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) {
2175 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2176 LDKTransaction commitment_tx_ref;
2177 commitment_tx_ref.datalen = (*_env)->GetArrayLength (_env, commitment_tx);
2178 commitment_tx_ref.data = MALLOC(commitment_tx_ref.datalen, "LDKTransaction Bytes");
2179 (*_env)->GetByteArrayRegion(_env, commitment_tx, 0, commitment_tx_ref.datalen, commitment_tx_ref.data);
2180 commitment_tx_ref.data_is_owned = true;
2181 LDKPreCalculatedTxCreationKeys keys_conv;
2182 keys_conv.inner = (void*)(keys & (~1));
2183 keys_conv.is_owned = false;
2184 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2185 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2186 if (htlcs_constr.datalen > 0)
2187 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2189 htlcs_constr.data = NULL;
2190 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2191 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2192 long arr_conv_24 = htlcs_vals[y];
2193 LDKHTLCOutputInCommitment arr_conv_24_conv;
2194 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2195 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2196 if (arr_conv_24_conv.inner != NULL)
2197 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2198 htlcs_constr.data[y] = arr_conv_24_conv;
2200 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2201 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2202 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_ref, &keys_conv, htlcs_constr);
2203 return (long)ret_conv;
2206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2207 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2208 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2209 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2210 holder_commitment_tx_conv.is_owned = false;
2211 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2212 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2213 return (long)ret_conv;
2216 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) {
2217 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2218 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2219 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2220 holder_commitment_tx_conv.is_owned = false;
2221 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2222 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2223 return (long)ret_conv;
2226 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) {
2227 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2228 LDKTransaction justice_tx_ref;
2229 justice_tx_ref.datalen = (*_env)->GetArrayLength (_env, justice_tx);
2230 justice_tx_ref.data = MALLOC(justice_tx_ref.datalen, "LDKTransaction Bytes");
2231 (*_env)->GetByteArrayRegion(_env, justice_tx, 0, justice_tx_ref.datalen, justice_tx_ref.data);
2232 justice_tx_ref.data_is_owned = true;
2233 unsigned char per_commitment_key_arr[32];
2234 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2235 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2236 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2237 LDKHTLCOutputInCommitment htlc_conv;
2238 htlc_conv.inner = (void*)(htlc & (~1));
2239 htlc_conv.is_owned = false;
2240 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2241 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_ref, input, amount, per_commitment_key_ref, &htlc_conv);
2242 return (long)ret_conv;
2245 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) {
2246 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2247 LDKTransaction htlc_tx_ref;
2248 htlc_tx_ref.datalen = (*_env)->GetArrayLength (_env, htlc_tx);
2249 htlc_tx_ref.data = MALLOC(htlc_tx_ref.datalen, "LDKTransaction Bytes");
2250 (*_env)->GetByteArrayRegion(_env, htlc_tx, 0, htlc_tx_ref.datalen, htlc_tx_ref.data);
2251 htlc_tx_ref.data_is_owned = true;
2252 LDKPublicKey per_commitment_point_ref;
2253 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2254 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2255 LDKHTLCOutputInCommitment htlc_conv;
2256 htlc_conv.inner = (void*)(htlc & (~1));
2257 htlc_conv.is_owned = false;
2258 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2259 *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);
2260 return (long)ret_conv;
2263 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray closing_tx) {
2264 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2265 LDKTransaction closing_tx_ref;
2266 closing_tx_ref.datalen = (*_env)->GetArrayLength (_env, closing_tx);
2267 closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
2268 (*_env)->GetByteArrayRegion(_env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
2269 closing_tx_ref.data_is_owned = true;
2270 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2271 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
2272 return (long)ret_conv;
2275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2276 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2277 LDKUnsignedChannelAnnouncement msg_conv;
2278 msg_conv.inner = (void*)(msg & (~1));
2279 msg_conv.is_owned = false;
2280 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2281 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2282 return (long)ret_conv;
2285 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) {
2286 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2287 LDKChannelPublicKeys channel_points_conv;
2288 channel_points_conv.inner = (void*)(channel_points & (~1));
2289 channel_points_conv.is_owned = false;
2290 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2293 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2294 if (this_arg->set_pubkeys != NULL)
2295 this_arg->set_pubkeys(this_arg);
2296 return this_arg->pubkeys;
2298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2299 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2300 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2301 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2302 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2303 long ret_ref = (long)ret_var.inner;
2304 if (ret_var.is_owned) {
2310 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2311 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2312 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2313 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2314 for (size_t i = 0; i < vec->datalen; i++) {
2315 CHECK((((long)vec->data[i].inner) & 1) == 0);
2316 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2318 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2322 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2323 ret->datalen = (*env)->GetArrayLength(env, elems);
2324 if (ret->datalen == 0) {
2327 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2328 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2329 for (size_t i = 0; i < ret->datalen; i++) {
2330 jlong arr_elem = java_elems[i];
2331 LDKMonitorEvent arr_elem_conv;
2332 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2333 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2334 if (arr_elem_conv.inner != NULL)
2335 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2336 ret->data[i] = arr_elem_conv;
2338 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2342 typedef struct LDKWatch_JCalls {
2343 atomic_size_t refcnt;
2346 jmethodID watch_channel_meth;
2347 jmethodID update_channel_meth;
2348 jmethodID release_pending_monitor_events_meth;
2350 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2351 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2353 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2354 LDKOutPoint funding_txo_var = funding_txo;
2355 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2356 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2357 long funding_txo_ref = (long)funding_txo_var.inner;
2358 if (funding_txo_var.is_owned) {
2359 funding_txo_ref |= 1;
2361 LDKChannelMonitor monitor_var = monitor;
2362 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2363 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2364 long monitor_ref = (long)monitor_var.inner;
2365 if (monitor_var.is_owned) {
2368 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2370 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2371 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2375 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2376 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2378 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2379 LDKOutPoint funding_txo_var = funding_txo;
2380 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2381 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2382 long funding_txo_ref = (long)funding_txo_var.inner;
2383 if (funding_txo_var.is_owned) {
2384 funding_txo_ref |= 1;
2386 LDKChannelMonitorUpdate update_var = update;
2387 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2388 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2389 long update_ref = (long)update_var.inner;
2390 if (update_var.is_owned) {
2393 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2395 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2396 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2400 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2401 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2403 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2404 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2406 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2407 LDKCVec_MonitorEventZ arg_constr;
2408 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2409 if (arg_constr.datalen > 0)
2410 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2412 arg_constr.data = NULL;
2413 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2414 for (size_t o = 0; o < arg_constr.datalen; o++) {
2415 long arr_conv_14 = arg_vals[o];
2416 LDKMonitorEvent arr_conv_14_conv;
2417 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2418 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2419 if (arr_conv_14_conv.inner != NULL)
2420 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2421 arg_constr.data[o] = arr_conv_14_conv;
2423 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2426 static void LDKWatch_JCalls_free(void* this_arg) {
2427 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2428 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2430 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2431 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2435 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2436 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2437 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2438 return (void*) this_arg;
2440 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2441 jclass c = (*env)->GetObjectClass(env, o);
2443 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2444 atomic_init(&calls->refcnt, 1);
2445 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2446 calls->o = (*env)->NewWeakGlobalRef(env, o);
2447 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2448 CHECK(calls->watch_channel_meth != NULL);
2449 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2450 CHECK(calls->update_channel_meth != NULL);
2451 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2452 CHECK(calls->release_pending_monitor_events_meth != NULL);
2455 .this_arg = (void*) calls,
2456 .watch_channel = watch_channel_jcall,
2457 .update_channel = update_channel_jcall,
2458 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2459 .free = LDKWatch_JCalls_free,
2463 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2464 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2465 *res_ptr = LDKWatch_init(env, _a, o);
2466 return (long)res_ptr;
2468 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2469 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2474 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2475 LDKOutPoint funding_txo_conv;
2476 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2477 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2478 if (funding_txo_conv.inner != NULL)
2479 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2480 LDKChannelMonitor monitor_conv;
2481 monitor_conv.inner = (void*)(monitor & (~1));
2482 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2483 // Warning: we may need a move here but can't clone!
2484 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2485 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2486 return (long)ret_conv;
2489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2490 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2491 LDKOutPoint funding_txo_conv;
2492 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2493 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2494 if (funding_txo_conv.inner != NULL)
2495 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2496 LDKChannelMonitorUpdate update_conv;
2497 update_conv.inner = (void*)(update & (~1));
2498 update_conv.is_owned = (update & 1) || (update == 0);
2499 if (update_conv.inner != NULL)
2500 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2501 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2502 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2503 return (long)ret_conv;
2506 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2507 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2508 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2509 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2510 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2511 for (size_t o = 0; o < ret_var.datalen; o++) {
2512 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2513 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2514 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2515 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2516 if (arr_conv_14_var.is_owned) {
2517 arr_conv_14_ref |= 1;
2519 ret_arr_ptr[o] = arr_conv_14_ref;
2521 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2526 typedef struct LDKFilter_JCalls {
2527 atomic_size_t refcnt;
2530 jmethodID register_tx_meth;
2531 jmethodID register_output_meth;
2533 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2534 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2536 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2537 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2538 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2539 LDKu8slice script_pubkey_var = script_pubkey;
2540 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2541 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2542 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2544 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2546 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2547 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2549 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2550 LDKOutPoint outpoint_var = *outpoint;
2551 if (outpoint->inner != NULL)
2552 outpoint_var = OutPoint_clone(outpoint);
2553 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2554 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2555 long outpoint_ref = (long)outpoint_var.inner;
2556 if (outpoint_var.is_owned) {
2559 LDKu8slice script_pubkey_var = script_pubkey;
2560 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2561 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2562 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2564 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
2566 static void LDKFilter_JCalls_free(void* this_arg) {
2567 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2568 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2570 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2571 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2575 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2576 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2577 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2578 return (void*) this_arg;
2580 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2581 jclass c = (*env)->GetObjectClass(env, o);
2583 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2584 atomic_init(&calls->refcnt, 1);
2585 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2586 calls->o = (*env)->NewWeakGlobalRef(env, o);
2587 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2588 CHECK(calls->register_tx_meth != NULL);
2589 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2590 CHECK(calls->register_output_meth != NULL);
2593 .this_arg = (void*) calls,
2594 .register_tx = register_tx_jcall,
2595 .register_output = register_output_jcall,
2596 .free = LDKFilter_JCalls_free,
2600 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2601 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2602 *res_ptr = LDKFilter_init(env, _a, o);
2603 return (long)res_ptr;
2605 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2606 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2611 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2612 unsigned char txid_arr[32];
2613 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2614 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2615 unsigned char (*txid_ref)[32] = &txid_arr;
2616 LDKu8slice script_pubkey_ref;
2617 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2618 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2619 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2620 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2624 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2625 LDKOutPoint outpoint_conv;
2626 outpoint_conv.inner = (void*)(outpoint & (~1));
2627 outpoint_conv.is_owned = false;
2628 LDKu8slice script_pubkey_ref;
2629 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2630 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2631 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2632 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2635 typedef struct LDKBroadcasterInterface_JCalls {
2636 atomic_size_t refcnt;
2639 jmethodID broadcast_transaction_meth;
2640 } LDKBroadcasterInterface_JCalls;
2641 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2642 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2644 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2645 LDKTransaction tx_var = tx;
2646 jbyteArray tx_arr = (*_env)->NewByteArray(_env, tx_var.datalen);
2647 (*_env)->SetByteArrayRegion(_env, tx_arr, 0, tx_var.datalen, tx_var.data);
2648 Transaction_free(tx_var);
2649 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2651 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_arr);
2653 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2654 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2655 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2657 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2658 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2662 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2663 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2664 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2665 return (void*) this_arg;
2667 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2668 jclass c = (*env)->GetObjectClass(env, o);
2670 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2671 atomic_init(&calls->refcnt, 1);
2672 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2673 calls->o = (*env)->NewWeakGlobalRef(env, o);
2674 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "([B)V");
2675 CHECK(calls->broadcast_transaction_meth != NULL);
2677 LDKBroadcasterInterface ret = {
2678 .this_arg = (void*) calls,
2679 .broadcast_transaction = broadcast_transaction_jcall,
2680 .free = LDKBroadcasterInterface_JCalls_free,
2684 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2685 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2686 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2687 return (long)res_ptr;
2689 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2690 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray tx) {
2695 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2696 LDKTransaction tx_ref;
2697 tx_ref.datalen = (*_env)->GetArrayLength (_env, tx);
2698 tx_ref.data = MALLOC(tx_ref.datalen, "LDKTransaction Bytes");
2699 (*_env)->GetByteArrayRegion(_env, tx, 0, tx_ref.datalen, tx_ref.data);
2700 tx_ref.data_is_owned = true;
2701 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_ref);
2704 typedef struct LDKFeeEstimator_JCalls {
2705 atomic_size_t refcnt;
2708 jmethodID get_est_sat_per_1000_weight_meth;
2709 } LDKFeeEstimator_JCalls;
2710 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2711 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2713 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2714 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2715 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2717 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2719 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2720 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2721 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2723 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2724 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2728 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2729 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2730 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2731 return (void*) this_arg;
2733 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2734 jclass c = (*env)->GetObjectClass(env, o);
2736 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2737 atomic_init(&calls->refcnt, 1);
2738 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2739 calls->o = (*env)->NewWeakGlobalRef(env, o);
2740 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2741 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2743 LDKFeeEstimator ret = {
2744 .this_arg = (void*) calls,
2745 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2746 .free = LDKFeeEstimator_JCalls_free,
2750 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2751 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2752 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2753 return (long)res_ptr;
2755 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2756 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2760 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) {
2761 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2762 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2763 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2767 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2768 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2769 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2772 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2773 ret->datalen = (*env)->GetArrayLength(env, elems);
2774 if (ret->datalen == 0) {
2777 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2778 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2779 for (size_t i = 0; i < ret->datalen; i++) {
2780 jlong arr_elem = java_elems[i];
2781 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2782 FREE((void*)arr_elem);
2783 ret->data[i] = arr_elem_conv;
2785 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2789 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2790 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2791 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2793 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2794 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2795 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2798 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2799 ret->datalen = (*env)->GetArrayLength(env, elems);
2800 if (ret->datalen == 0) {
2803 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2804 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2805 for (size_t i = 0; i < ret->datalen; i++) {
2806 jlong arr_elem = java_elems[i];
2807 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2808 FREE((void*)arr_elem);
2809 ret->data[i] = arr_elem_conv;
2811 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2815 typedef struct LDKKeysInterface_JCalls {
2816 atomic_size_t refcnt;
2819 jmethodID get_node_secret_meth;
2820 jmethodID get_destination_script_meth;
2821 jmethodID get_shutdown_pubkey_meth;
2822 jmethodID get_channel_keys_meth;
2823 jmethodID get_secure_random_bytes_meth;
2824 } LDKKeysInterface_JCalls;
2825 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2826 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2828 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2829 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2831 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2832 LDKSecretKey arg_ref;
2833 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2834 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2837 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2838 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2840 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2841 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2843 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2844 LDKCVec_u8Z arg_ref;
2845 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2846 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
2847 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
2850 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2851 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2853 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2854 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2856 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2857 LDKPublicKey arg_ref;
2858 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2859 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2862 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2863 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2865 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2866 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2868 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2869 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2870 ret_conv = ChannelKeys_clone(ret);
2873 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2874 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2876 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2877 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2879 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2880 LDKThirtyTwoBytes arg_ref;
2881 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2882 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2885 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2886 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2887 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2889 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2890 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2894 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2895 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2896 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2897 return (void*) this_arg;
2899 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2900 jclass c = (*env)->GetObjectClass(env, o);
2902 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2903 atomic_init(&calls->refcnt, 1);
2904 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2905 calls->o = (*env)->NewWeakGlobalRef(env, o);
2906 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2907 CHECK(calls->get_node_secret_meth != NULL);
2908 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2909 CHECK(calls->get_destination_script_meth != NULL);
2910 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2911 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2912 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2913 CHECK(calls->get_channel_keys_meth != NULL);
2914 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2915 CHECK(calls->get_secure_random_bytes_meth != NULL);
2917 LDKKeysInterface ret = {
2918 .this_arg = (void*) calls,
2919 .get_node_secret = get_node_secret_jcall,
2920 .get_destination_script = get_destination_script_jcall,
2921 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2922 .get_channel_keys = get_channel_keys_jcall,
2923 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2924 .free = LDKKeysInterface_JCalls_free,
2928 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2929 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2930 *res_ptr = LDKKeysInterface_init(env, _a, o);
2931 return (long)res_ptr;
2933 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2934 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2939 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2940 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2941 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2945 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2946 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2947 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2948 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2949 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2950 CVec_u8Z_free(arg_var);
2954 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2955 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2956 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2957 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2961 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) {
2962 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2963 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2964 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2968 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2969 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2970 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2971 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2975 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2976 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2977 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2978 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2979 for (size_t i = 0; i < vec->datalen; i++) {
2980 CHECK((((long)vec->data[i].inner) & 1) == 0);
2981 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2983 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2987 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2988 ret->datalen = (*env)->GetArrayLength(env, elems);
2989 if (ret->datalen == 0) {
2992 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2993 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2994 for (size_t i = 0; i < ret->datalen; i++) {
2995 jlong arr_elem = java_elems[i];
2996 LDKChannelDetails arr_elem_conv;
2997 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2998 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2999 if (arr_elem_conv.inner != NULL)
3000 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
3001 ret->data[i] = arr_elem_conv;
3003 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3007 static jclass LDKNetAddress_IPv4_class = NULL;
3008 static jmethodID LDKNetAddress_IPv4_meth = NULL;
3009 static jclass LDKNetAddress_IPv6_class = NULL;
3010 static jmethodID LDKNetAddress_IPv6_meth = NULL;
3011 static jclass LDKNetAddress_OnionV2_class = NULL;
3012 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
3013 static jclass LDKNetAddress_OnionV3_class = NULL;
3014 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
3015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
3016 LDKNetAddress_IPv4_class =
3017 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
3018 CHECK(LDKNetAddress_IPv4_class != NULL);
3019 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
3020 CHECK(LDKNetAddress_IPv4_meth != NULL);
3021 LDKNetAddress_IPv6_class =
3022 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
3023 CHECK(LDKNetAddress_IPv6_class != NULL);
3024 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
3025 CHECK(LDKNetAddress_IPv6_meth != NULL);
3026 LDKNetAddress_OnionV2_class =
3027 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
3028 CHECK(LDKNetAddress_OnionV2_class != NULL);
3029 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
3030 CHECK(LDKNetAddress_OnionV2_meth != NULL);
3031 LDKNetAddress_OnionV3_class =
3032 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
3033 CHECK(LDKNetAddress_OnionV3_class != NULL);
3034 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3035 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3037 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
3038 LDKNetAddress *obj = (LDKNetAddress*)ptr;
3040 case LDKNetAddress_IPv4: {
3041 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
3042 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3043 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3045 case LDKNetAddress_IPv6: {
3046 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
3047 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3048 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3050 case LDKNetAddress_OnionV2: {
3051 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
3052 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3053 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3055 case LDKNetAddress_OnionV3: {
3056 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
3057 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3058 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);
3063 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3064 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
3065 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
3067 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
3068 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
3069 ret->datalen = (*env)->GetArrayLength(env, elems);
3070 if (ret->datalen == 0) {
3073 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
3074 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3075 for (size_t i = 0; i < ret->datalen; i++) {
3076 jlong arr_elem = java_elems[i];
3077 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
3078 FREE((void*)arr_elem);
3079 ret->data[i] = arr_elem_conv;
3081 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3085 typedef struct LDKChannelMessageHandler_JCalls {
3086 atomic_size_t refcnt;
3089 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3090 jmethodID handle_open_channel_meth;
3091 jmethodID handle_accept_channel_meth;
3092 jmethodID handle_funding_created_meth;
3093 jmethodID handle_funding_signed_meth;
3094 jmethodID handle_funding_locked_meth;
3095 jmethodID handle_shutdown_meth;
3096 jmethodID handle_closing_signed_meth;
3097 jmethodID handle_update_add_htlc_meth;
3098 jmethodID handle_update_fulfill_htlc_meth;
3099 jmethodID handle_update_fail_htlc_meth;
3100 jmethodID handle_update_fail_malformed_htlc_meth;
3101 jmethodID handle_commitment_signed_meth;
3102 jmethodID handle_revoke_and_ack_meth;
3103 jmethodID handle_update_fee_meth;
3104 jmethodID handle_announcement_signatures_meth;
3105 jmethodID peer_disconnected_meth;
3106 jmethodID peer_connected_meth;
3107 jmethodID handle_channel_reestablish_meth;
3108 jmethodID handle_error_meth;
3109 } LDKChannelMessageHandler_JCalls;
3110 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
3111 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3113 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3114 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3115 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3116 LDKInitFeatures their_features_var = their_features;
3117 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3118 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3119 long their_features_ref = (long)their_features_var.inner;
3120 if (their_features_var.is_owned) {
3121 their_features_ref |= 1;
3123 LDKOpenChannel msg_var = *msg;
3124 if (msg->inner != NULL)
3125 msg_var = OpenChannel_clone(msg);
3126 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3127 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3128 long msg_ref = (long)msg_var.inner;
3129 if (msg_var.is_owned) {
3132 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3134 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3136 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3137 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3139 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3140 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3141 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3142 LDKInitFeatures their_features_var = their_features;
3143 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3144 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3145 long their_features_ref = (long)their_features_var.inner;
3146 if (their_features_var.is_owned) {
3147 their_features_ref |= 1;
3149 LDKAcceptChannel msg_var = *msg;
3150 if (msg->inner != NULL)
3151 msg_var = AcceptChannel_clone(msg);
3152 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3153 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3154 long msg_ref = (long)msg_var.inner;
3155 if (msg_var.is_owned) {
3158 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3160 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3162 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3163 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3165 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3166 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3167 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3168 LDKFundingCreated msg_var = *msg;
3169 if (msg->inner != NULL)
3170 msg_var = FundingCreated_clone(msg);
3171 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3172 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3173 long msg_ref = (long)msg_var.inner;
3174 if (msg_var.is_owned) {
3177 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3179 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
3181 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3182 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3184 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3185 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3186 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3187 LDKFundingSigned msg_var = *msg;
3188 if (msg->inner != NULL)
3189 msg_var = FundingSigned_clone(msg);
3190 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3191 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3192 long msg_ref = (long)msg_var.inner;
3193 if (msg_var.is_owned) {
3196 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3198 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
3200 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3201 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3203 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3204 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3205 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3206 LDKFundingLocked msg_var = *msg;
3207 if (msg->inner != NULL)
3208 msg_var = FundingLocked_clone(msg);
3209 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3210 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3211 long msg_ref = (long)msg_var.inner;
3212 if (msg_var.is_owned) {
3215 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3217 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
3219 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3220 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3222 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3223 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3224 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3225 LDKShutdown msg_var = *msg;
3226 if (msg->inner != NULL)
3227 msg_var = Shutdown_clone(msg);
3228 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3229 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3230 long msg_ref = (long)msg_var.inner;
3231 if (msg_var.is_owned) {
3234 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3236 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
3238 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3239 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3241 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3242 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3243 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3244 LDKClosingSigned msg_var = *msg;
3245 if (msg->inner != NULL)
3246 msg_var = ClosingSigned_clone(msg);
3247 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3248 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3249 long msg_ref = (long)msg_var.inner;
3250 if (msg_var.is_owned) {
3253 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3255 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
3257 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3258 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3260 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3261 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3262 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3263 LDKUpdateAddHTLC msg_var = *msg;
3264 if (msg->inner != NULL)
3265 msg_var = UpdateAddHTLC_clone(msg);
3266 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3267 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3268 long msg_ref = (long)msg_var.inner;
3269 if (msg_var.is_owned) {
3272 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3274 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
3276 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3277 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3279 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3280 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3281 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3282 LDKUpdateFulfillHTLC msg_var = *msg;
3283 if (msg->inner != NULL)
3284 msg_var = UpdateFulfillHTLC_clone(msg);
3285 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3286 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3287 long msg_ref = (long)msg_var.inner;
3288 if (msg_var.is_owned) {
3291 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3293 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
3295 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3296 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3298 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3299 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3300 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3301 LDKUpdateFailHTLC msg_var = *msg;
3302 if (msg->inner != NULL)
3303 msg_var = UpdateFailHTLC_clone(msg);
3304 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3305 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3306 long msg_ref = (long)msg_var.inner;
3307 if (msg_var.is_owned) {
3310 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3312 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
3314 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3315 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3317 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3318 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3319 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3320 LDKUpdateFailMalformedHTLC msg_var = *msg;
3321 if (msg->inner != NULL)
3322 msg_var = UpdateFailMalformedHTLC_clone(msg);
3323 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3324 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3325 long msg_ref = (long)msg_var.inner;
3326 if (msg_var.is_owned) {
3329 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3331 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
3333 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3334 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3336 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3337 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3338 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3339 LDKCommitmentSigned msg_var = *msg;
3340 if (msg->inner != NULL)
3341 msg_var = CommitmentSigned_clone(msg);
3342 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3343 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3344 long msg_ref = (long)msg_var.inner;
3345 if (msg_var.is_owned) {
3348 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3350 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
3352 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3353 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3355 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3356 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3357 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3358 LDKRevokeAndACK msg_var = *msg;
3359 if (msg->inner != NULL)
3360 msg_var = RevokeAndACK_clone(msg);
3361 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3362 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3363 long msg_ref = (long)msg_var.inner;
3364 if (msg_var.is_owned) {
3367 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3369 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
3371 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3372 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3374 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3375 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3376 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3377 LDKUpdateFee msg_var = *msg;
3378 if (msg->inner != NULL)
3379 msg_var = UpdateFee_clone(msg);
3380 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3381 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3382 long msg_ref = (long)msg_var.inner;
3383 if (msg_var.is_owned) {
3386 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3388 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
3390 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3391 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3393 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3394 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3395 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3396 LDKAnnouncementSignatures msg_var = *msg;
3397 if (msg->inner != NULL)
3398 msg_var = AnnouncementSignatures_clone(msg);
3399 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3400 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3401 long msg_ref = (long)msg_var.inner;
3402 if (msg_var.is_owned) {
3405 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3407 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
3409 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3410 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3412 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3413 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3414 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3415 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3417 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3419 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3420 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3422 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3423 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3424 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3425 LDKInit msg_var = *msg;
3426 if (msg->inner != NULL)
3427 msg_var = Init_clone(msg);
3428 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3429 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3430 long msg_ref = (long)msg_var.inner;
3431 if (msg_var.is_owned) {
3434 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3436 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
3438 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3439 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3441 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3442 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3443 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3444 LDKChannelReestablish msg_var = *msg;
3445 if (msg->inner != NULL)
3446 msg_var = ChannelReestablish_clone(msg);
3447 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3448 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3449 long msg_ref = (long)msg_var.inner;
3450 if (msg_var.is_owned) {
3453 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3455 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
3457 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3458 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3460 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3461 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3462 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3463 LDKErrorMessage msg_var = *msg;
3464 if (msg->inner != NULL)
3465 msg_var = ErrorMessage_clone(msg);
3466 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3467 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3468 long msg_ref = (long)msg_var.inner;
3469 if (msg_var.is_owned) {
3472 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3474 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
3476 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3477 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3478 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3480 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3481 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3485 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3486 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3487 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3488 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3489 return (void*) this_arg;
3491 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3492 jclass c = (*env)->GetObjectClass(env, o);
3494 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3495 atomic_init(&calls->refcnt, 1);
3496 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3497 calls->o = (*env)->NewWeakGlobalRef(env, o);
3498 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3499 CHECK(calls->handle_open_channel_meth != NULL);
3500 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3501 CHECK(calls->handle_accept_channel_meth != NULL);
3502 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3503 CHECK(calls->handle_funding_created_meth != NULL);
3504 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3505 CHECK(calls->handle_funding_signed_meth != NULL);
3506 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3507 CHECK(calls->handle_funding_locked_meth != NULL);
3508 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3509 CHECK(calls->handle_shutdown_meth != NULL);
3510 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3511 CHECK(calls->handle_closing_signed_meth != NULL);
3512 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3513 CHECK(calls->handle_update_add_htlc_meth != NULL);
3514 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3515 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3516 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3517 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3518 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3519 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3520 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3521 CHECK(calls->handle_commitment_signed_meth != NULL);
3522 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3523 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3524 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3525 CHECK(calls->handle_update_fee_meth != NULL);
3526 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3527 CHECK(calls->handle_announcement_signatures_meth != NULL);
3528 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3529 CHECK(calls->peer_disconnected_meth != NULL);
3530 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3531 CHECK(calls->peer_connected_meth != NULL);
3532 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3533 CHECK(calls->handle_channel_reestablish_meth != NULL);
3534 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3535 CHECK(calls->handle_error_meth != NULL);
3537 LDKChannelMessageHandler ret = {
3538 .this_arg = (void*) calls,
3539 .handle_open_channel = handle_open_channel_jcall,
3540 .handle_accept_channel = handle_accept_channel_jcall,
3541 .handle_funding_created = handle_funding_created_jcall,
3542 .handle_funding_signed = handle_funding_signed_jcall,
3543 .handle_funding_locked = handle_funding_locked_jcall,
3544 .handle_shutdown = handle_shutdown_jcall,
3545 .handle_closing_signed = handle_closing_signed_jcall,
3546 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3547 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3548 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3549 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3550 .handle_commitment_signed = handle_commitment_signed_jcall,
3551 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3552 .handle_update_fee = handle_update_fee_jcall,
3553 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3554 .peer_disconnected = peer_disconnected_jcall,
3555 .peer_connected = peer_connected_jcall,
3556 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3557 .handle_error = handle_error_jcall,
3558 .free = LDKChannelMessageHandler_JCalls_free,
3559 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3561 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3564 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3565 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3566 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3567 return (long)res_ptr;
3569 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3570 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3574 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) {
3575 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3576 LDKPublicKey their_node_id_ref;
3577 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3578 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3579 LDKInitFeatures their_features_conv;
3580 their_features_conv.inner = (void*)(their_features & (~1));
3581 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3582 // Warning: we may need a move here but can't clone!
3583 LDKOpenChannel msg_conv;
3584 msg_conv.inner = (void*)(msg & (~1));
3585 msg_conv.is_owned = false;
3586 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3589 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) {
3590 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3591 LDKPublicKey their_node_id_ref;
3592 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3593 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3594 LDKInitFeatures their_features_conv;
3595 their_features_conv.inner = (void*)(their_features & (~1));
3596 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3597 // Warning: we may need a move here but can't clone!
3598 LDKAcceptChannel msg_conv;
3599 msg_conv.inner = (void*)(msg & (~1));
3600 msg_conv.is_owned = false;
3601 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3604 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) {
3605 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3606 LDKPublicKey their_node_id_ref;
3607 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3608 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3609 LDKFundingCreated msg_conv;
3610 msg_conv.inner = (void*)(msg & (~1));
3611 msg_conv.is_owned = false;
3612 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3615 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) {
3616 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3617 LDKPublicKey their_node_id_ref;
3618 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3619 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3620 LDKFundingSigned msg_conv;
3621 msg_conv.inner = (void*)(msg & (~1));
3622 msg_conv.is_owned = false;
3623 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3626 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) {
3627 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3628 LDKPublicKey their_node_id_ref;
3629 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3630 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3631 LDKFundingLocked msg_conv;
3632 msg_conv.inner = (void*)(msg & (~1));
3633 msg_conv.is_owned = false;
3634 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3638 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3639 LDKPublicKey their_node_id_ref;
3640 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3641 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3642 LDKShutdown msg_conv;
3643 msg_conv.inner = (void*)(msg & (~1));
3644 msg_conv.is_owned = false;
3645 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3648 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) {
3649 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3650 LDKPublicKey their_node_id_ref;
3651 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3652 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3653 LDKClosingSigned msg_conv;
3654 msg_conv.inner = (void*)(msg & (~1));
3655 msg_conv.is_owned = false;
3656 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3659 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) {
3660 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3661 LDKPublicKey their_node_id_ref;
3662 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3663 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3664 LDKUpdateAddHTLC msg_conv;
3665 msg_conv.inner = (void*)(msg & (~1));
3666 msg_conv.is_owned = false;
3667 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3670 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) {
3671 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3672 LDKPublicKey their_node_id_ref;
3673 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3674 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3675 LDKUpdateFulfillHTLC msg_conv;
3676 msg_conv.inner = (void*)(msg & (~1));
3677 msg_conv.is_owned = false;
3678 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3681 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) {
3682 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3683 LDKPublicKey their_node_id_ref;
3684 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3685 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3686 LDKUpdateFailHTLC msg_conv;
3687 msg_conv.inner = (void*)(msg & (~1));
3688 msg_conv.is_owned = false;
3689 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3692 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) {
3693 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3694 LDKPublicKey their_node_id_ref;
3695 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3696 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3697 LDKUpdateFailMalformedHTLC msg_conv;
3698 msg_conv.inner = (void*)(msg & (~1));
3699 msg_conv.is_owned = false;
3700 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3703 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) {
3704 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3705 LDKPublicKey their_node_id_ref;
3706 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3707 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3708 LDKCommitmentSigned msg_conv;
3709 msg_conv.inner = (void*)(msg & (~1));
3710 msg_conv.is_owned = false;
3711 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3714 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) {
3715 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3716 LDKPublicKey their_node_id_ref;
3717 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3718 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3719 LDKRevokeAndACK msg_conv;
3720 msg_conv.inner = (void*)(msg & (~1));
3721 msg_conv.is_owned = false;
3722 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3725 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) {
3726 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3727 LDKPublicKey their_node_id_ref;
3728 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3729 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3730 LDKUpdateFee msg_conv;
3731 msg_conv.inner = (void*)(msg & (~1));
3732 msg_conv.is_owned = false;
3733 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3736 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) {
3737 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3738 LDKPublicKey their_node_id_ref;
3739 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3740 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3741 LDKAnnouncementSignatures msg_conv;
3742 msg_conv.inner = (void*)(msg & (~1));
3743 msg_conv.is_owned = false;
3744 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3747 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) {
3748 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3749 LDKPublicKey their_node_id_ref;
3750 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3751 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3752 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3756 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3757 LDKPublicKey their_node_id_ref;
3758 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3759 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3761 msg_conv.inner = (void*)(msg & (~1));
3762 msg_conv.is_owned = false;
3763 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3766 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) {
3767 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3768 LDKPublicKey their_node_id_ref;
3769 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3770 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3771 LDKChannelReestablish msg_conv;
3772 msg_conv.inner = (void*)(msg & (~1));
3773 msg_conv.is_owned = false;
3774 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3778 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3779 LDKPublicKey their_node_id_ref;
3780 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3781 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3782 LDKErrorMessage msg_conv;
3783 msg_conv.inner = (void*)(msg & (~1));
3784 msg_conv.is_owned = false;
3785 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3788 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3789 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3790 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3791 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3792 for (size_t i = 0; i < vec->datalen; i++) {
3793 CHECK((((long)vec->data[i].inner) & 1) == 0);
3794 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3796 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3800 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3801 ret->datalen = (*env)->GetArrayLength(env, elems);
3802 if (ret->datalen == 0) {
3805 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3806 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3807 for (size_t i = 0; i < ret->datalen; i++) {
3808 jlong arr_elem = java_elems[i];
3809 LDKChannelMonitor arr_elem_conv;
3810 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3811 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3812 // Warning: we may need a move here but can't clone!
3813 ret->data[i] = arr_elem_conv;
3815 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3819 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3820 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3821 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3824 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3825 ret->datalen = (*env)->GetArrayLength(env, elems);
3826 if (ret->datalen == 0) {
3829 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3830 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3831 for (size_t i = 0; i < ret->datalen; i++) {
3832 ret->data[i] = java_elems[i];
3834 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3838 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3839 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3840 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3841 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3842 for (size_t i = 0; i < vec->datalen; i++) {
3843 CHECK((((long)vec->data[i].inner) & 1) == 0);
3844 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3846 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3850 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3851 ret->datalen = (*env)->GetArrayLength(env, elems);
3852 if (ret->datalen == 0) {
3855 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3856 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3857 for (size_t i = 0; i < ret->datalen; i++) {
3858 jlong arr_elem = java_elems[i];
3859 LDKUpdateAddHTLC arr_elem_conv;
3860 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3861 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3862 if (arr_elem_conv.inner != NULL)
3863 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3864 ret->data[i] = arr_elem_conv;
3866 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3870 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3871 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3872 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3873 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3874 for (size_t i = 0; i < vec->datalen; i++) {
3875 CHECK((((long)vec->data[i].inner) & 1) == 0);
3876 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3878 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3881 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3882 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3883 ret->datalen = (*env)->GetArrayLength(env, elems);
3884 if (ret->datalen == 0) {
3887 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3888 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3889 for (size_t i = 0; i < ret->datalen; i++) {
3890 jlong arr_elem = java_elems[i];
3891 LDKUpdateFulfillHTLC arr_elem_conv;
3892 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3893 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3894 if (arr_elem_conv.inner != NULL)
3895 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3896 ret->data[i] = arr_elem_conv;
3898 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3902 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3903 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3904 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3905 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3906 for (size_t i = 0; i < vec->datalen; i++) {
3907 CHECK((((long)vec->data[i].inner) & 1) == 0);
3908 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3910 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3914 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3915 ret->datalen = (*env)->GetArrayLength(env, elems);
3916 if (ret->datalen == 0) {
3919 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3920 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3921 for (size_t i = 0; i < ret->datalen; i++) {
3922 jlong arr_elem = java_elems[i];
3923 LDKUpdateFailHTLC arr_elem_conv;
3924 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3925 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3926 if (arr_elem_conv.inner != NULL)
3927 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3928 ret->data[i] = arr_elem_conv;
3930 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3934 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3935 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3936 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3937 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3938 for (size_t i = 0; i < vec->datalen; i++) {
3939 CHECK((((long)vec->data[i].inner) & 1) == 0);
3940 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3942 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3945 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3946 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3947 ret->datalen = (*env)->GetArrayLength(env, elems);
3948 if (ret->datalen == 0) {
3951 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3952 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3953 for (size_t i = 0; i < ret->datalen; i++) {
3954 jlong arr_elem = java_elems[i];
3955 LDKUpdateFailMalformedHTLC arr_elem_conv;
3956 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3957 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3958 if (arr_elem_conv.inner != NULL)
3959 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3960 ret->data[i] = arr_elem_conv;
3962 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3966 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3967 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3969 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3970 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3971 CHECK(val->result_ok);
3972 return *val->contents.result;
3974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3975 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3976 CHECK(!val->result_ok);
3977 LDKLightningError err_var = (*val->contents.err);
3978 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3979 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3980 long err_ref = (long)err_var.inner & ~1;
3983 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3984 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3985 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3988 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3989 ret->datalen = (*env)->GetArrayLength(env, elems);
3990 if (ret->datalen == 0) {
3993 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3994 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3995 for (size_t i = 0; i < ret->datalen; i++) {
3996 jlong arr_elem = java_elems[i];
3997 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3998 FREE((void*)arr_elem);
3999 ret->data[i] = arr_elem_conv;
4001 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4005 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4006 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
4007 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4008 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4009 for (size_t i = 0; i < vec->datalen; i++) {
4010 CHECK((((long)vec->data[i].inner) & 1) == 0);
4011 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4013 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
4017 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
4018 ret->datalen = (*env)->GetArrayLength(env, elems);
4019 if (ret->datalen == 0) {
4022 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
4023 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4024 for (size_t i = 0; i < ret->datalen; i++) {
4025 jlong arr_elem = java_elems[i];
4026 LDKNodeAnnouncement arr_elem_conv;
4027 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4028 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4029 if (arr_elem_conv.inner != NULL)
4030 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
4031 ret->data[i] = arr_elem_conv;
4033 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4037 typedef struct LDKRoutingMessageHandler_JCalls {
4038 atomic_size_t refcnt;
4041 jmethodID handle_node_announcement_meth;
4042 jmethodID handle_channel_announcement_meth;
4043 jmethodID handle_channel_update_meth;
4044 jmethodID handle_htlc_fail_channel_update_meth;
4045 jmethodID get_next_channel_announcements_meth;
4046 jmethodID get_next_node_announcements_meth;
4047 jmethodID should_request_full_sync_meth;
4048 } LDKRoutingMessageHandler_JCalls;
4049 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
4050 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4052 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4053 LDKNodeAnnouncement msg_var = *msg;
4054 if (msg->inner != NULL)
4055 msg_var = NodeAnnouncement_clone(msg);
4056 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4057 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4058 long msg_ref = (long)msg_var.inner;
4059 if (msg_var.is_owned) {
4062 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4064 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg_ref);
4065 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4069 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
4070 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4072 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4073 LDKChannelAnnouncement msg_var = *msg;
4074 if (msg->inner != NULL)
4075 msg_var = ChannelAnnouncement_clone(msg);
4076 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4077 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4078 long msg_ref = (long)msg_var.inner;
4079 if (msg_var.is_owned) {
4082 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4084 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
4085 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4089 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
4090 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4092 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4093 LDKChannelUpdate msg_var = *msg;
4094 if (msg->inner != NULL)
4095 msg_var = ChannelUpdate_clone(msg);
4096 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4097 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4098 long msg_ref = (long)msg_var.inner;
4099 if (msg_var.is_owned) {
4102 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4104 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg_ref);
4105 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4109 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
4110 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4112 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4113 long ret_update = (long)update;
4114 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4116 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4118 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4119 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4121 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4122 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4124 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4125 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4126 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4127 if (arg_constr.datalen > 0)
4128 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4130 arg_constr.data = NULL;
4131 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4132 for (size_t l = 0; l < arg_constr.datalen; l++) {
4133 long arr_conv_63 = arg_vals[l];
4134 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4135 FREE((void*)arr_conv_63);
4136 arg_constr.data[l] = arr_conv_63_conv;
4138 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4141 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4142 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4144 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4145 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
4146 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
4147 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4149 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4150 LDKCVec_NodeAnnouncementZ arg_constr;
4151 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4152 if (arg_constr.datalen > 0)
4153 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4155 arg_constr.data = NULL;
4156 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4157 for (size_t s = 0; s < arg_constr.datalen; s++) {
4158 long arr_conv_18 = arg_vals[s];
4159 LDKNodeAnnouncement arr_conv_18_conv;
4160 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4161 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4162 if (arr_conv_18_conv.inner != NULL)
4163 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4164 arg_constr.data[s] = arr_conv_18_conv;
4166 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4169 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
4170 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4172 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4173 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
4174 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
4175 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4177 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
4179 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4180 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4181 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4183 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4184 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4188 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4189 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4190 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4191 return (void*) this_arg;
4193 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
4194 jclass c = (*env)->GetObjectClass(env, o);
4196 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4197 atomic_init(&calls->refcnt, 1);
4198 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4199 calls->o = (*env)->NewWeakGlobalRef(env, o);
4200 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
4201 CHECK(calls->handle_node_announcement_meth != NULL);
4202 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
4203 CHECK(calls->handle_channel_announcement_meth != NULL);
4204 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
4205 CHECK(calls->handle_channel_update_meth != NULL);
4206 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
4207 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
4208 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
4209 CHECK(calls->get_next_channel_announcements_meth != NULL);
4210 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
4211 CHECK(calls->get_next_node_announcements_meth != NULL);
4212 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
4213 CHECK(calls->should_request_full_sync_meth != NULL);
4215 LDKRoutingMessageHandler ret = {
4216 .this_arg = (void*) calls,
4217 .handle_node_announcement = handle_node_announcement_jcall,
4218 .handle_channel_announcement = handle_channel_announcement_jcall,
4219 .handle_channel_update = handle_channel_update_jcall,
4220 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4221 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4222 .get_next_node_announcements = get_next_node_announcements_jcall,
4223 .should_request_full_sync = should_request_full_sync_jcall,
4224 .free = LDKRoutingMessageHandler_JCalls_free,
4228 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
4229 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4230 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
4231 return (long)res_ptr;
4233 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4234 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
4238 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4239 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4240 LDKNodeAnnouncement msg_conv;
4241 msg_conv.inner = (void*)(msg & (~1));
4242 msg_conv.is_owned = false;
4243 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4244 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4245 return (long)ret_conv;
4248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4249 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4250 LDKChannelAnnouncement msg_conv;
4251 msg_conv.inner = (void*)(msg & (~1));
4252 msg_conv.is_owned = false;
4253 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4254 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4255 return (long)ret_conv;
4258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4259 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4260 LDKChannelUpdate msg_conv;
4261 msg_conv.inner = (void*)(msg & (~1));
4262 msg_conv.is_owned = false;
4263 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4264 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4265 return (long)ret_conv;
4268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
4269 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4270 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4271 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4274 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) {
4275 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4276 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4277 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4278 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4279 for (size_t l = 0; l < ret_var.datalen; l++) {
4280 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4281 *arr_conv_63_ref = ret_var.data[l];
4282 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4284 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4285 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
4289 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) {
4290 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4291 LDKPublicKey starting_point_ref;
4292 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
4293 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
4294 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4295 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4296 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4297 for (size_t s = 0; s < ret_var.datalen; s++) {
4298 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4299 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4300 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4301 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4302 if (arr_conv_18_var.is_owned) {
4303 arr_conv_18_ref |= 1;
4305 ret_arr_ptr[s] = arr_conv_18_ref;
4307 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4312 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4313 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4314 LDKPublicKey node_id_ref;
4315 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4316 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4317 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4321 typedef struct LDKSocketDescriptor_JCalls {
4322 atomic_size_t refcnt;
4325 jmethodID send_data_meth;
4326 jmethodID disconnect_socket_meth;
4328 jmethodID hash_meth;
4329 } LDKSocketDescriptor_JCalls;
4330 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4331 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4333 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4334 LDKu8slice data_var = data;
4335 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4336 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4337 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4339 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4341 void disconnect_socket_jcall(void* this_arg) {
4342 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4344 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4345 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4347 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4349 bool eq_jcall(const void* this_arg, const void *other_arg) {
4350 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4352 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4353 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4355 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4357 uint64_t hash_jcall(const void* this_arg) {
4358 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4360 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4361 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4363 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4365 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4366 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4367 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4369 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4370 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4374 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4375 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4376 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4377 return (void*) this_arg;
4379 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4380 jclass c = (*env)->GetObjectClass(env, o);
4382 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4383 atomic_init(&calls->refcnt, 1);
4384 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4385 calls->o = (*env)->NewWeakGlobalRef(env, o);
4386 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4387 CHECK(calls->send_data_meth != NULL);
4388 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4389 CHECK(calls->disconnect_socket_meth != NULL);
4390 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4391 CHECK(calls->eq_meth != NULL);
4392 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4393 CHECK(calls->hash_meth != NULL);
4395 LDKSocketDescriptor ret = {
4396 .this_arg = (void*) calls,
4397 .send_data = send_data_jcall,
4398 .disconnect_socket = disconnect_socket_jcall,
4401 .clone = LDKSocketDescriptor_JCalls_clone,
4402 .free = LDKSocketDescriptor_JCalls_free,
4406 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4407 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4408 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4409 return (long)res_ptr;
4411 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4412 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4416 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4417 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4418 LDKu8slice data_ref;
4419 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4420 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4421 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4422 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4427 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4428 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4432 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4433 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4437 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4438 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4439 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4441 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4442 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4445 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4446 CHECK(val->result_ok);
4447 LDKCVecTempl_u8 res_var = (*val->contents.result);
4448 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4449 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4453 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4454 CHECK(!val->result_ok);
4455 LDKPeerHandleError err_var = (*val->contents.err);
4456 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4457 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4458 long err_ref = (long)err_var.inner & ~1;
4461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4462 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4464 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4465 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4466 CHECK(val->result_ok);
4467 return *val->contents.result;
4469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4470 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4471 CHECK(!val->result_ok);
4472 LDKPeerHandleError err_var = (*val->contents.err);
4473 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4474 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4475 long err_ref = (long)err_var.inner & ~1;
4478 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4479 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4481 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4482 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4483 CHECK(val->result_ok);
4484 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4485 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4488 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4489 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4490 CHECK(!val->result_ok);
4491 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4494 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4495 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4497 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4498 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4499 CHECK(val->result_ok);
4500 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4501 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4504 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4505 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4506 CHECK(!val->result_ok);
4507 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4510 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4511 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4514 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4515 CHECK(val->result_ok);
4516 LDKTxCreationKeys res_var = (*val->contents.result);
4517 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4518 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4519 long res_ref = (long)res_var.inner & ~1;
4522 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4523 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4524 CHECK(!val->result_ok);
4525 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4528 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4529 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4530 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4533 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4534 ret->datalen = (*env)->GetArrayLength(env, elems);
4535 if (ret->datalen == 0) {
4538 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4539 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4540 for (size_t i = 0; i < ret->datalen; i++) {
4541 jlong arr_elem = java_elems[i];
4542 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4543 FREE((void*)arr_elem);
4544 ret->data[i] = arr_elem_conv;
4546 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4550 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4551 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4552 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4553 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4554 for (size_t i = 0; i < vec->datalen; i++) {
4555 CHECK((((long)vec->data[i].inner) & 1) == 0);
4556 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4558 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4561 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4562 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4563 ret->datalen = (*env)->GetArrayLength(env, elems);
4564 if (ret->datalen == 0) {
4567 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4568 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4569 for (size_t i = 0; i < ret->datalen; i++) {
4570 jlong arr_elem = java_elems[i];
4571 LDKRouteHop arr_elem_conv;
4572 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4573 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4574 if (arr_elem_conv.inner != NULL)
4575 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4576 ret->data[i] = arr_elem_conv;
4578 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4582 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4583 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4584 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4586 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4587 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4589 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4590 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4591 CHECK(val->result_ok);
4592 LDKRoute res_var = (*val->contents.result);
4593 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4594 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4595 long res_ref = (long)res_var.inner & ~1;
4598 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4599 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4600 CHECK(!val->result_ok);
4601 LDKLightningError err_var = (*val->contents.err);
4602 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4603 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4604 long err_ref = (long)err_var.inner & ~1;
4607 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4608 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4609 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4610 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4611 for (size_t i = 0; i < vec->datalen; i++) {
4612 CHECK((((long)vec->data[i].inner) & 1) == 0);
4613 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4615 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4618 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4619 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4620 ret->datalen = (*env)->GetArrayLength(env, elems);
4621 if (ret->datalen == 0) {
4624 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4625 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4626 for (size_t i = 0; i < ret->datalen; i++) {
4627 jlong arr_elem = java_elems[i];
4628 LDKRouteHint arr_elem_conv;
4629 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4630 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4631 if (arr_elem_conv.inner != NULL)
4632 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4633 ret->data[i] = arr_elem_conv;
4635 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4640 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4642 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4646 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4648 C2Tuple_OutPointScriptZ_free(arg_conv);
4651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4652 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4654 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4658 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4660 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4664 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4666 C2Tuple_u64u64Z_free(arg_conv);
4669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4670 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4672 C2Tuple_usizeTransactionZ_free(arg_conv);
4675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4676 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4678 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4682 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4684 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4688 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4690 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4691 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4692 return (long)ret_conv;
4695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4696 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4698 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4702 LDKCVec_SignatureZ arg_constr;
4703 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4704 if (arg_constr.datalen > 0)
4705 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4707 arg_constr.data = NULL;
4708 for (size_t i = 0; i < arg_constr.datalen; i++) {
4709 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4710 LDKSignature arr_conv_8_ref;
4711 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4712 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4713 arg_constr.data[i] = arr_conv_8_ref;
4715 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4716 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4717 return (long)ret_conv;
4720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4721 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4723 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4724 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4725 return (long)ret_conv;
4728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4729 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4731 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4735 LDKCVec_u8Z arg_ref;
4736 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4737 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
4738 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
4739 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4740 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4741 return (long)ret_conv;
4744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4745 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4747 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4748 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4749 return (long)ret_conv;
4752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4753 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4755 CResult_NoneAPIErrorZ_free(arg_conv);
4758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4759 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4761 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4762 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4763 return (long)ret_conv;
4766 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4767 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4769 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4773 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4775 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4776 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4777 return (long)ret_conv;
4780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4781 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4783 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4787 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4789 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4790 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4791 return (long)ret_conv;
4794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4795 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4797 CResult_NonePaymentSendFailureZ_free(arg_conv);
4800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4801 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4803 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4804 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4805 return (long)ret_conv;
4808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4809 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4811 CResult_NonePeerHandleErrorZ_free(arg_conv);
4814 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4815 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4817 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4818 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4819 return (long)ret_conv;
4822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4823 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4825 CResult_PublicKeySecpErrorZ_free(arg_conv);
4828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4829 LDKPublicKey arg_ref;
4830 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4831 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4832 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4833 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4834 return (long)ret_conv;
4837 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4838 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4840 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4841 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4842 return (long)ret_conv;
4845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4846 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4848 CResult_RouteLightningErrorZ_free(arg_conv);
4851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4852 LDKRoute arg_conv = *(LDKRoute*)arg;
4854 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4855 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4856 return (long)ret_conv;
4859 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4860 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4862 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4863 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4864 return (long)ret_conv;
4867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4868 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4870 CResult_SecretKeySecpErrorZ_free(arg_conv);
4873 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4874 LDKSecretKey arg_ref;
4875 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4876 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4877 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4878 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4879 return (long)ret_conv;
4882 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4883 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4885 CResult_SignatureNoneZ_free(arg_conv);
4888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4889 LDKSignature arg_ref;
4890 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4891 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4892 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4893 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4894 return (long)ret_conv;
4897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4898 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4900 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4901 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4902 return (long)ret_conv;
4905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4906 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4908 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4911 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4912 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4914 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4915 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4916 return (long)ret_conv;
4919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4920 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4922 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4923 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4924 return (long)ret_conv;
4927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4928 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4930 CResult_TxOutAccessErrorZ_free(arg_conv);
4933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4934 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4936 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4937 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4938 return (long)ret_conv;
4941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4942 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4944 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4945 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4946 return (long)ret_conv;
4949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4950 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4952 CResult_boolLightningErrorZ_free(arg_conv);
4955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4956 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4957 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4958 return (long)ret_conv;
4961 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4962 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4964 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4965 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4966 return (long)ret_conv;
4969 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4970 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4972 CResult_boolPeerHandleErrorZ_free(arg_conv);
4975 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4976 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4977 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4978 return (long)ret_conv;
4981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4982 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4983 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4984 if (arg_constr.datalen > 0)
4985 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4987 arg_constr.data = NULL;
4988 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4989 for (size_t q = 0; q < arg_constr.datalen; q++) {
4990 long arr_conv_42 = arg_vals[q];
4991 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4992 FREE((void*)arr_conv_42);
4993 arg_constr.data[q] = arr_conv_42_conv;
4995 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4996 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5000 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
5001 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5002 if (arg_constr.datalen > 0)
5003 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
5005 arg_constr.data = NULL;
5006 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5007 for (size_t b = 0; b < arg_constr.datalen; b++) {
5008 long arr_conv_27 = arg_vals[b];
5009 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
5010 FREE((void*)arr_conv_27);
5011 arg_constr.data[b] = arr_conv_27_conv;
5013 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5014 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
5017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5018 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
5019 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5020 if (arg_constr.datalen > 0)
5021 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5023 arg_constr.data = NULL;
5024 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5025 for (size_t y = 0; y < arg_constr.datalen; y++) {
5026 long arr_conv_24 = arg_vals[y];
5027 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5028 FREE((void*)arr_conv_24);
5029 arg_constr.data[y] = arr_conv_24_conv;
5031 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5032 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
5035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5036 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
5037 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5038 if (arg_constr.datalen > 0)
5039 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5041 arg_constr.data = NULL;
5042 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5043 for (size_t l = 0; l < arg_constr.datalen; l++) {
5044 long arr_conv_63 = arg_vals[l];
5045 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5046 FREE((void*)arr_conv_63);
5047 arg_constr.data[l] = arr_conv_63_conv;
5049 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5050 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
5053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5054 LDKCVec_CVec_RouteHopZZ arg_constr;
5055 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5056 if (arg_constr.datalen > 0)
5057 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
5059 arg_constr.data = NULL;
5060 for (size_t m = 0; m < arg_constr.datalen; m++) {
5061 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
5062 LDKCVec_RouteHopZ arr_conv_12_constr;
5063 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
5064 if (arr_conv_12_constr.datalen > 0)
5065 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5067 arr_conv_12_constr.data = NULL;
5068 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
5069 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
5070 long arr_conv_10 = arr_conv_12_vals[k];
5071 LDKRouteHop arr_conv_10_conv;
5072 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5073 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5074 arr_conv_12_constr.data[k] = arr_conv_10_conv;
5076 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
5077 arg_constr.data[m] = arr_conv_12_constr;
5079 CVec_CVec_RouteHopZZ_free(arg_constr);
5082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5083 LDKCVec_ChannelDetailsZ arg_constr;
5084 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5085 if (arg_constr.datalen > 0)
5086 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
5088 arg_constr.data = NULL;
5089 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5090 for (size_t q = 0; q < arg_constr.datalen; q++) {
5091 long arr_conv_16 = arg_vals[q];
5092 LDKChannelDetails arr_conv_16_conv;
5093 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5094 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5095 arg_constr.data[q] = arr_conv_16_conv;
5097 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5098 CVec_ChannelDetailsZ_free(arg_constr);
5101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5102 LDKCVec_ChannelMonitorZ arg_constr;
5103 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5104 if (arg_constr.datalen > 0)
5105 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5107 arg_constr.data = NULL;
5108 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5109 for (size_t q = 0; q < arg_constr.datalen; q++) {
5110 long arr_conv_16 = arg_vals[q];
5111 LDKChannelMonitor arr_conv_16_conv;
5112 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5113 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5114 arg_constr.data[q] = arr_conv_16_conv;
5116 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5117 CVec_ChannelMonitorZ_free(arg_constr);
5120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5121 LDKCVec_EventZ arg_constr;
5122 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5123 if (arg_constr.datalen > 0)
5124 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5126 arg_constr.data = NULL;
5127 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5128 for (size_t h = 0; h < arg_constr.datalen; h++) {
5129 long arr_conv_7 = arg_vals[h];
5130 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5131 FREE((void*)arr_conv_7);
5132 arg_constr.data[h] = arr_conv_7_conv;
5134 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5135 CVec_EventZ_free(arg_constr);
5138 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5139 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
5140 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5141 if (arg_constr.datalen > 0)
5142 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
5144 arg_constr.data = NULL;
5145 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5146 for (size_t y = 0; y < arg_constr.datalen; y++) {
5147 long arr_conv_24 = arg_vals[y];
5148 LDKHTLCOutputInCommitment arr_conv_24_conv;
5149 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
5150 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
5151 arg_constr.data[y] = arr_conv_24_conv;
5153 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5154 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
5157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5158 LDKCVec_MessageSendEventZ arg_constr;
5159 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5160 if (arg_constr.datalen > 0)
5161 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5163 arg_constr.data = NULL;
5164 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5165 for (size_t s = 0; s < arg_constr.datalen; s++) {
5166 long arr_conv_18 = arg_vals[s];
5167 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5168 FREE((void*)arr_conv_18);
5169 arg_constr.data[s] = arr_conv_18_conv;
5171 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5172 CVec_MessageSendEventZ_free(arg_constr);
5175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5176 LDKCVec_MonitorEventZ arg_constr;
5177 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5178 if (arg_constr.datalen > 0)
5179 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5181 arg_constr.data = NULL;
5182 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5183 for (size_t o = 0; o < arg_constr.datalen; o++) {
5184 long arr_conv_14 = arg_vals[o];
5185 LDKMonitorEvent arr_conv_14_conv;
5186 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5187 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5188 arg_constr.data[o] = arr_conv_14_conv;
5190 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5191 CVec_MonitorEventZ_free(arg_constr);
5194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5195 LDKCVec_NetAddressZ arg_constr;
5196 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5197 if (arg_constr.datalen > 0)
5198 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5200 arg_constr.data = NULL;
5201 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5202 for (size_t m = 0; m < arg_constr.datalen; m++) {
5203 long arr_conv_12 = arg_vals[m];
5204 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5205 FREE((void*)arr_conv_12);
5206 arg_constr.data[m] = arr_conv_12_conv;
5208 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5209 CVec_NetAddressZ_free(arg_constr);
5212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5213 LDKCVec_NodeAnnouncementZ arg_constr;
5214 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5215 if (arg_constr.datalen > 0)
5216 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5218 arg_constr.data = NULL;
5219 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5220 for (size_t s = 0; s < arg_constr.datalen; s++) {
5221 long arr_conv_18 = arg_vals[s];
5222 LDKNodeAnnouncement arr_conv_18_conv;
5223 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5224 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5225 arg_constr.data[s] = arr_conv_18_conv;
5227 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5228 CVec_NodeAnnouncementZ_free(arg_constr);
5231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5232 LDKCVec_PublicKeyZ arg_constr;
5233 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5234 if (arg_constr.datalen > 0)
5235 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5237 arg_constr.data = NULL;
5238 for (size_t i = 0; i < arg_constr.datalen; i++) {
5239 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5240 LDKPublicKey arr_conv_8_ref;
5241 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
5242 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
5243 arg_constr.data[i] = arr_conv_8_ref;
5245 CVec_PublicKeyZ_free(arg_constr);
5248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5249 LDKCVec_RouteHintZ arg_constr;
5250 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5251 if (arg_constr.datalen > 0)
5252 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5254 arg_constr.data = NULL;
5255 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5256 for (size_t l = 0; l < arg_constr.datalen; l++) {
5257 long arr_conv_11 = arg_vals[l];
5258 LDKRouteHint arr_conv_11_conv;
5259 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5260 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5261 arg_constr.data[l] = arr_conv_11_conv;
5263 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5264 CVec_RouteHintZ_free(arg_constr);
5267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5268 LDKCVec_RouteHopZ arg_constr;
5269 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5270 if (arg_constr.datalen > 0)
5271 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5273 arg_constr.data = NULL;
5274 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5275 for (size_t k = 0; k < arg_constr.datalen; k++) {
5276 long arr_conv_10 = arg_vals[k];
5277 LDKRouteHop arr_conv_10_conv;
5278 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5279 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5280 arg_constr.data[k] = arr_conv_10_conv;
5282 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5283 CVec_RouteHopZ_free(arg_constr);
5286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5287 LDKCVec_SignatureZ arg_constr;
5288 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5289 if (arg_constr.datalen > 0)
5290 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5292 arg_constr.data = NULL;
5293 for (size_t i = 0; i < arg_constr.datalen; i++) {
5294 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5295 LDKSignature arr_conv_8_ref;
5296 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5297 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5298 arg_constr.data[i] = arr_conv_8_ref;
5300 CVec_SignatureZ_free(arg_constr);
5303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5304 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5305 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5306 if (arg_constr.datalen > 0)
5307 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5309 arg_constr.data = NULL;
5310 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5311 for (size_t b = 0; b < arg_constr.datalen; b++) {
5312 long arr_conv_27 = arg_vals[b];
5313 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5314 FREE((void*)arr_conv_27);
5315 arg_constr.data[b] = arr_conv_27_conv;
5317 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5318 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5322 LDKCVec_TransactionZ arg_constr;
5323 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5324 if (arg_constr.datalen > 0)
5325 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5327 arg_constr.data = NULL;
5328 for (size_t i = 0; i < arg_constr.datalen; i++) {
5329 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5330 LDKTransaction arr_conv_8_ref;
5331 arr_conv_8_ref.datalen = (*_env)->GetArrayLength (_env, arr_conv_8);
5332 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5333 (*_env)->GetByteArrayRegion(_env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5334 arr_conv_8_ref.data_is_owned = true;
5335 arg_constr.data[i] = arr_conv_8_ref;
5337 CVec_TransactionZ_free(arg_constr);
5340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5341 LDKCVec_TxOutZ arg_constr;
5342 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5343 if (arg_constr.datalen > 0)
5344 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5346 arg_constr.data = NULL;
5347 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5348 for (size_t h = 0; h < arg_constr.datalen; h++) {
5349 long arr_conv_7 = arg_vals[h];
5350 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5351 FREE((void*)arr_conv_7);
5352 arg_constr.data[h] = arr_conv_7_conv;
5354 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5355 CVec_TxOutZ_free(arg_constr);
5358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5359 LDKCVec_UpdateAddHTLCZ arg_constr;
5360 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5361 if (arg_constr.datalen > 0)
5362 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5364 arg_constr.data = NULL;
5365 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5366 for (size_t p = 0; p < arg_constr.datalen; p++) {
5367 long arr_conv_15 = arg_vals[p];
5368 LDKUpdateAddHTLC arr_conv_15_conv;
5369 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5370 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5371 arg_constr.data[p] = arr_conv_15_conv;
5373 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5374 CVec_UpdateAddHTLCZ_free(arg_constr);
5377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5378 LDKCVec_UpdateFailHTLCZ arg_constr;
5379 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5380 if (arg_constr.datalen > 0)
5381 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5383 arg_constr.data = NULL;
5384 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5385 for (size_t q = 0; q < arg_constr.datalen; q++) {
5386 long arr_conv_16 = arg_vals[q];
5387 LDKUpdateFailHTLC arr_conv_16_conv;
5388 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5389 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5390 arg_constr.data[q] = arr_conv_16_conv;
5392 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5393 CVec_UpdateFailHTLCZ_free(arg_constr);
5396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5397 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5398 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5399 if (arg_constr.datalen > 0)
5400 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5402 arg_constr.data = NULL;
5403 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5404 for (size_t z = 0; z < arg_constr.datalen; z++) {
5405 long arr_conv_25 = arg_vals[z];
5406 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5407 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5408 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5409 arg_constr.data[z] = arr_conv_25_conv;
5411 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5412 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5416 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5417 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5418 if (arg_constr.datalen > 0)
5419 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5421 arg_constr.data = NULL;
5422 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5423 for (size_t t = 0; t < arg_constr.datalen; t++) {
5424 long arr_conv_19 = arg_vals[t];
5425 LDKUpdateFulfillHTLC arr_conv_19_conv;
5426 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5427 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5428 arg_constr.data[t] = arr_conv_19_conv;
5430 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5431 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5435 LDKCVec_u64Z arg_constr;
5436 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5437 if (arg_constr.datalen > 0)
5438 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5440 arg_constr.data = NULL;
5441 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5442 for (size_t g = 0; g < arg_constr.datalen; g++) {
5443 long arr_conv_6 = arg_vals[g];
5444 arg_constr.data[g] = arr_conv_6;
5446 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5447 CVec_u64Z_free(arg_constr);
5450 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5451 LDKCVec_u8Z arg_ref;
5452 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5453 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
5454 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
5455 CVec_u8Z_free(arg_ref);
5458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jbyteArray _res) {
5459 LDKTransaction _res_ref;
5460 _res_ref.datalen = (*_env)->GetArrayLength (_env, _res);
5461 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5462 (*_env)->GetByteArrayRegion(_env, _res, 0, _res_ref.datalen, _res_ref.data);
5463 _res_ref.data_is_owned = true;
5464 Transaction_free(_res_ref);
5467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5468 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5470 TxOut_free(_res_conv);
5473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5474 LDKTransaction b_ref;
5475 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5476 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5477 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5478 b_ref.data_is_owned = true;
5479 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5480 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5481 return (long)ret_ref;
5484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5485 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5486 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5487 return (long)ret_conv;
5490 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5491 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5492 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5493 return (long)ret_conv;
5496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5498 a_conv.inner = (void*)(a & (~1));
5499 a_conv.is_owned = (a & 1) || (a == 0);
5500 if (a_conv.inner != NULL)
5501 a_conv = OutPoint_clone(&a_conv);
5503 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5504 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5505 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5506 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5507 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5508 return (long)ret_ref;
5511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5512 LDKThirtyTwoBytes a_ref;
5513 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5514 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5515 LDKCVec_TxOutZ b_constr;
5516 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5517 if (b_constr.datalen > 0)
5518 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5520 b_constr.data = NULL;
5521 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5522 for (size_t h = 0; h < b_constr.datalen; h++) {
5523 long arr_conv_7 = b_vals[h];
5524 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5525 FREE((void*)arr_conv_7);
5526 b_constr.data[h] = arr_conv_7_conv;
5528 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5529 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5530 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5531 return (long)ret_ref;
5534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5535 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5536 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5537 return (long)ret_ref;
5540 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5542 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5543 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5544 LDKCVec_SignatureZ b_constr;
5545 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5546 if (b_constr.datalen > 0)
5547 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5549 b_constr.data = NULL;
5550 for (size_t i = 0; i < b_constr.datalen; i++) {
5551 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5552 LDKSignature arr_conv_8_ref;
5553 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5554 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5555 b_constr.data[i] = arr_conv_8_ref;
5557 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5558 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5559 return (long)ret_ref;
5562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5563 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5564 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5565 return (long)ret_conv;
5568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5569 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5570 *ret_conv = CResult_SignatureNoneZ_err();
5571 return (long)ret_conv;
5574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5575 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5576 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5577 return (long)ret_conv;
5580 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5581 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5582 *ret_conv = CResult_NoneAPIErrorZ_ok();
5583 return (long)ret_conv;
5586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5587 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5588 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5589 return (long)ret_conv;
5592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5593 LDKChannelAnnouncement a_conv;
5594 a_conv.inner = (void*)(a & (~1));
5595 a_conv.is_owned = (a & 1) || (a == 0);
5596 if (a_conv.inner != NULL)
5597 a_conv = ChannelAnnouncement_clone(&a_conv);
5598 LDKChannelUpdate b_conv;
5599 b_conv.inner = (void*)(b & (~1));
5600 b_conv.is_owned = (b & 1) || (b == 0);
5601 if (b_conv.inner != NULL)
5602 b_conv = ChannelUpdate_clone(&b_conv);
5603 LDKChannelUpdate c_conv;
5604 c_conv.inner = (void*)(c & (~1));
5605 c_conv.is_owned = (c & 1) || (c == 0);
5606 if (c_conv.inner != NULL)
5607 c_conv = ChannelUpdate_clone(&c_conv);
5608 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5609 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5610 return (long)ret_ref;
5613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5614 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5615 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5616 return (long)ret_conv;
5619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5620 LDKHTLCOutputInCommitment a_conv;
5621 a_conv.inner = (void*)(a & (~1));
5622 a_conv.is_owned = (a & 1) || (a == 0);
5623 if (a_conv.inner != NULL)
5624 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5626 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5627 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5628 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5629 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5630 return (long)ret_ref;
5633 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5634 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5635 FREE((void*)this_ptr);
5636 Event_free(this_ptr_conv);
5639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5640 LDKEvent* orig_conv = (LDKEvent*)orig;
5641 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5642 *ret_copy = Event_clone(orig_conv);
5643 long ret_ref = (long)ret_copy;
5647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5648 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5649 FREE((void*)this_ptr);
5650 MessageSendEvent_free(this_ptr_conv);
5653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5654 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5655 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5656 *ret_copy = MessageSendEvent_clone(orig_conv);
5657 long ret_ref = (long)ret_copy;
5661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5662 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5663 FREE((void*)this_ptr);
5664 MessageSendEventsProvider_free(this_ptr_conv);
5667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5668 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5669 FREE((void*)this_ptr);
5670 EventsProvider_free(this_ptr_conv);
5673 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5674 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5675 FREE((void*)this_ptr);
5676 APIError_free(this_ptr_conv);
5679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5680 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5681 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5682 *ret_copy = APIError_clone(orig_conv);
5683 long ret_ref = (long)ret_copy;
5687 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5688 LDKLevel* orig_conv = (LDKLevel*)orig;
5689 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5693 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5694 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5699 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5700 FREE((void*)this_ptr);
5701 Logger_free(this_ptr_conv);
5704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5705 LDKChannelHandshakeConfig this_ptr_conv;
5706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5708 ChannelHandshakeConfig_free(this_ptr_conv);
5711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5712 LDKChannelHandshakeConfig orig_conv;
5713 orig_conv.inner = (void*)(orig & (~1));
5714 orig_conv.is_owned = false;
5715 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5716 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5717 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5718 long ret_ref = (long)ret_var.inner;
5719 if (ret_var.is_owned) {
5725 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5726 LDKChannelHandshakeConfig this_ptr_conv;
5727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5728 this_ptr_conv.is_owned = false;
5729 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5734 LDKChannelHandshakeConfig this_ptr_conv;
5735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5736 this_ptr_conv.is_owned = false;
5737 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5740 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5741 LDKChannelHandshakeConfig this_ptr_conv;
5742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5743 this_ptr_conv.is_owned = false;
5744 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5749 LDKChannelHandshakeConfig this_ptr_conv;
5750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5751 this_ptr_conv.is_owned = false;
5752 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5756 LDKChannelHandshakeConfig this_ptr_conv;
5757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5758 this_ptr_conv.is_owned = false;
5759 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5764 LDKChannelHandshakeConfig this_ptr_conv;
5765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5766 this_ptr_conv.is_owned = false;
5767 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5770 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) {
5771 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5772 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5773 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5774 long ret_ref = (long)ret_var.inner;
5775 if (ret_var.is_owned) {
5781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5782 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5783 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5784 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5785 long ret_ref = (long)ret_var.inner;
5786 if (ret_var.is_owned) {
5792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5793 LDKChannelHandshakeLimits this_ptr_conv;
5794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5796 ChannelHandshakeLimits_free(this_ptr_conv);
5799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5800 LDKChannelHandshakeLimits orig_conv;
5801 orig_conv.inner = (void*)(orig & (~1));
5802 orig_conv.is_owned = false;
5803 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5804 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5805 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5806 long ret_ref = (long)ret_var.inner;
5807 if (ret_var.is_owned) {
5813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5814 LDKChannelHandshakeLimits this_ptr_conv;
5815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5816 this_ptr_conv.is_owned = false;
5817 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5822 LDKChannelHandshakeLimits this_ptr_conv;
5823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5824 this_ptr_conv.is_owned = false;
5825 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5829 LDKChannelHandshakeLimits this_ptr_conv;
5830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5831 this_ptr_conv.is_owned = false;
5832 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5837 LDKChannelHandshakeLimits this_ptr_conv;
5838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5839 this_ptr_conv.is_owned = false;
5840 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5844 LDKChannelHandshakeLimits this_ptr_conv;
5845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5846 this_ptr_conv.is_owned = false;
5847 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5851 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) {
5852 LDKChannelHandshakeLimits this_ptr_conv;
5853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5854 this_ptr_conv.is_owned = false;
5855 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5859 LDKChannelHandshakeLimits this_ptr_conv;
5860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5861 this_ptr_conv.is_owned = false;
5862 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5867 LDKChannelHandshakeLimits this_ptr_conv;
5868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5869 this_ptr_conv.is_owned = false;
5870 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5873 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5874 LDKChannelHandshakeLimits this_ptr_conv;
5875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5876 this_ptr_conv.is_owned = false;
5877 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5882 LDKChannelHandshakeLimits this_ptr_conv;
5883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5884 this_ptr_conv.is_owned = false;
5885 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5889 LDKChannelHandshakeLimits this_ptr_conv;
5890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5891 this_ptr_conv.is_owned = false;
5892 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5897 LDKChannelHandshakeLimits this_ptr_conv;
5898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5899 this_ptr_conv.is_owned = false;
5900 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5904 LDKChannelHandshakeLimits this_ptr_conv;
5905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5906 this_ptr_conv.is_owned = false;
5907 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5912 LDKChannelHandshakeLimits this_ptr_conv;
5913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5914 this_ptr_conv.is_owned = false;
5915 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5918 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5919 LDKChannelHandshakeLimits this_ptr_conv;
5920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5921 this_ptr_conv.is_owned = false;
5922 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5927 LDKChannelHandshakeLimits this_ptr_conv;
5928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5929 this_ptr_conv.is_owned = false;
5930 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5933 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5934 LDKChannelHandshakeLimits this_ptr_conv;
5935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5936 this_ptr_conv.is_owned = false;
5937 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5942 LDKChannelHandshakeLimits this_ptr_conv;
5943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5944 this_ptr_conv.is_owned = false;
5945 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5948 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5949 LDKChannelHandshakeLimits this_ptr_conv;
5950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5951 this_ptr_conv.is_owned = false;
5952 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5957 LDKChannelHandshakeLimits this_ptr_conv;
5958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5959 this_ptr_conv.is_owned = false;
5960 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5963 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) {
5964 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);
5965 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5966 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5967 long ret_ref = (long)ret_var.inner;
5968 if (ret_var.is_owned) {
5974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5975 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5976 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5977 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5978 long ret_ref = (long)ret_var.inner;
5979 if (ret_var.is_owned) {
5985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5986 LDKChannelConfig this_ptr_conv;
5987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5988 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5989 ChannelConfig_free(this_ptr_conv);
5992 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5993 LDKChannelConfig orig_conv;
5994 orig_conv.inner = (void*)(orig & (~1));
5995 orig_conv.is_owned = false;
5996 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5997 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5998 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5999 long ret_ref = (long)ret_var.inner;
6000 if (ret_var.is_owned) {
6006 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
6007 LDKChannelConfig this_ptr_conv;
6008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6009 this_ptr_conv.is_owned = false;
6010 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
6014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6015 LDKChannelConfig this_ptr_conv;
6016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6017 this_ptr_conv.is_owned = false;
6018 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
6021 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
6022 LDKChannelConfig this_ptr_conv;
6023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6024 this_ptr_conv.is_owned = false;
6025 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
6029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6030 LDKChannelConfig this_ptr_conv;
6031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6032 this_ptr_conv.is_owned = false;
6033 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
6036 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6037 LDKChannelConfig this_ptr_conv;
6038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6039 this_ptr_conv.is_owned = false;
6040 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
6044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6045 LDKChannelConfig this_ptr_conv;
6046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6047 this_ptr_conv.is_owned = false;
6048 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
6051 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) {
6052 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
6053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6055 long ret_ref = (long)ret_var.inner;
6056 if (ret_var.is_owned) {
6062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
6063 LDKChannelConfig ret_var = ChannelConfig_default();
6064 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6065 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6066 long ret_ref = (long)ret_var.inner;
6067 if (ret_var.is_owned) {
6073 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
6074 LDKChannelConfig obj_conv;
6075 obj_conv.inner = (void*)(obj & (~1));
6076 obj_conv.is_owned = false;
6077 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
6078 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6079 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6080 CVec_u8Z_free(arg_var);
6084 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6086 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6087 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6088 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
6089 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6090 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6091 long ret_ref = (long)ret_var.inner;
6092 if (ret_var.is_owned) {
6095 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6100 LDKUserConfig this_ptr_conv;
6101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6103 UserConfig_free(this_ptr_conv);
6106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6107 LDKUserConfig orig_conv;
6108 orig_conv.inner = (void*)(orig & (~1));
6109 orig_conv.is_owned = false;
6110 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6111 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6112 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6113 long ret_ref = (long)ret_var.inner;
6114 if (ret_var.is_owned) {
6120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6121 LDKUserConfig this_ptr_conv;
6122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6123 this_ptr_conv.is_owned = false;
6124 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6125 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6126 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6127 long ret_ref = (long)ret_var.inner;
6128 if (ret_var.is_owned) {
6134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6135 LDKUserConfig this_ptr_conv;
6136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6137 this_ptr_conv.is_owned = false;
6138 LDKChannelHandshakeConfig val_conv;
6139 val_conv.inner = (void*)(val & (~1));
6140 val_conv.is_owned = (val & 1) || (val == 0);
6141 if (val_conv.inner != NULL)
6142 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6143 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(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 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&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_1peer_1channel_1config_1limits(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 LDKChannelHandshakeLimits 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 = ChannelHandshakeLimits_clone(&val_conv);
6169 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(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 LDKChannelConfig ret_var = UserConfig_get_channel_options(&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_1channel_1options(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 LDKChannelConfig 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 = ChannelConfig_clone(&val_conv);
6195 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6198 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) {
6199 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6200 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6201 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6202 if (own_channel_config_arg_conv.inner != NULL)
6203 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6204 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6205 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6206 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6207 if (peer_channel_config_limits_arg_conv.inner != NULL)
6208 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6209 LDKChannelConfig channel_options_arg_conv;
6210 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6211 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6212 if (channel_options_arg_conv.inner != NULL)
6213 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6214 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6215 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6216 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6217 long ret_ref = (long)ret_var.inner;
6218 if (ret_var.is_owned) {
6224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
6225 LDKUserConfig ret_var = UserConfig_default();
6226 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6227 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6228 long ret_ref = (long)ret_var.inner;
6229 if (ret_var.is_owned) {
6235 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6236 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6237 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
6241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6242 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6243 FREE((void*)this_ptr);
6244 Access_free(this_ptr_conv);
6247 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6248 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6249 FREE((void*)this_ptr);
6250 Watch_free(this_ptr_conv);
6253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6254 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6255 FREE((void*)this_ptr);
6256 Filter_free(this_ptr_conv);
6259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6260 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6261 FREE((void*)this_ptr);
6262 BroadcasterInterface_free(this_ptr_conv);
6265 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6266 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6267 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6272 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6273 FREE((void*)this_ptr);
6274 FeeEstimator_free(this_ptr_conv);
6277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6278 LDKChainMonitor this_ptr_conv;
6279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6280 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6281 ChainMonitor_free(this_ptr_conv);
6284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6285 LDKChainMonitor this_arg_conv;
6286 this_arg_conv.inner = (void*)(this_arg & (~1));
6287 this_arg_conv.is_owned = false;
6288 unsigned char header_arr[80];
6289 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6290 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6291 unsigned char (*header_ref)[80] = &header_arr;
6292 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6293 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6294 if (txdata_constr.datalen > 0)
6295 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6297 txdata_constr.data = NULL;
6298 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6299 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6300 long arr_conv_24 = txdata_vals[y];
6301 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6302 FREE((void*)arr_conv_24);
6303 txdata_constr.data[y] = arr_conv_24_conv;
6305 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6306 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6310 LDKChainMonitor this_arg_conv;
6311 this_arg_conv.inner = (void*)(this_arg & (~1));
6312 this_arg_conv.is_owned = false;
6313 unsigned char header_arr[80];
6314 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6315 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6316 unsigned char (*header_ref)[80] = &header_arr;
6317 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6321 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6322 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6323 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6324 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6325 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6327 LDKLogger logger_conv = *(LDKLogger*)logger;
6328 if (logger_conv.free == LDKLogger_JCalls_free) {
6329 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6330 LDKLogger_JCalls_clone(logger_conv.this_arg);
6332 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6333 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6334 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6335 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6337 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6338 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6339 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6340 long ret_ref = (long)ret_var.inner;
6341 if (ret_var.is_owned) {
6347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6348 LDKChainMonitor this_arg_conv;
6349 this_arg_conv.inner = (void*)(this_arg & (~1));
6350 this_arg_conv.is_owned = false;
6351 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6352 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6357 LDKChainMonitor this_arg_conv;
6358 this_arg_conv.inner = (void*)(this_arg & (~1));
6359 this_arg_conv.is_owned = false;
6360 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6361 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6366 LDKChannelMonitorUpdate this_ptr_conv;
6367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6369 ChannelMonitorUpdate_free(this_ptr_conv);
6372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6373 LDKChannelMonitorUpdate orig_conv;
6374 orig_conv.inner = (void*)(orig & (~1));
6375 orig_conv.is_owned = false;
6376 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6377 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6378 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6379 long ret_ref = (long)ret_var.inner;
6380 if (ret_var.is_owned) {
6386 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6387 LDKChannelMonitorUpdate this_ptr_conv;
6388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6389 this_ptr_conv.is_owned = false;
6390 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6395 LDKChannelMonitorUpdate this_ptr_conv;
6396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6397 this_ptr_conv.is_owned = false;
6398 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6401 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6402 LDKChannelMonitorUpdate obj_conv;
6403 obj_conv.inner = (void*)(obj & (~1));
6404 obj_conv.is_owned = false;
6405 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6406 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6407 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6408 CVec_u8Z_free(arg_var);
6412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6414 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6415 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6416 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6417 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6418 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6419 long ret_ref = (long)ret_var.inner;
6420 if (ret_var.is_owned) {
6423 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6427 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6428 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6429 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6434 LDKMonitorUpdateError this_ptr_conv;
6435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6437 MonitorUpdateError_free(this_ptr_conv);
6440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6441 LDKMonitorEvent this_ptr_conv;
6442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6444 MonitorEvent_free(this_ptr_conv);
6447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6448 LDKMonitorEvent orig_conv;
6449 orig_conv.inner = (void*)(orig & (~1));
6450 orig_conv.is_owned = false;
6451 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6452 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6453 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6454 long ret_ref = (long)ret_var.inner;
6455 if (ret_var.is_owned) {
6461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6462 LDKHTLCUpdate this_ptr_conv;
6463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6464 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6465 HTLCUpdate_free(this_ptr_conv);
6468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6469 LDKHTLCUpdate orig_conv;
6470 orig_conv.inner = (void*)(orig & (~1));
6471 orig_conv.is_owned = false;
6472 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6473 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6474 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6475 long ret_ref = (long)ret_var.inner;
6476 if (ret_var.is_owned) {
6482 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6483 LDKHTLCUpdate obj_conv;
6484 obj_conv.inner = (void*)(obj & (~1));
6485 obj_conv.is_owned = false;
6486 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6487 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6488 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6489 CVec_u8Z_free(arg_var);
6493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6495 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6496 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6497 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6498 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6499 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6500 long ret_ref = (long)ret_var.inner;
6501 if (ret_var.is_owned) {
6504 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6509 LDKChannelMonitor this_ptr_conv;
6510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6512 ChannelMonitor_free(this_ptr_conv);
6515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6516 LDKChannelMonitor this_arg_conv;
6517 this_arg_conv.inner = (void*)(this_arg & (~1));
6518 this_arg_conv.is_owned = false;
6519 LDKChannelMonitorUpdate updates_conv;
6520 updates_conv.inner = (void*)(updates & (~1));
6521 updates_conv.is_owned = (updates & 1) || (updates == 0);
6522 if (updates_conv.inner != NULL)
6523 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6524 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6525 LDKLogger* logger_conv = (LDKLogger*)logger;
6526 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6527 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6528 return (long)ret_conv;
6531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6532 LDKChannelMonitor this_arg_conv;
6533 this_arg_conv.inner = (void*)(this_arg & (~1));
6534 this_arg_conv.is_owned = false;
6535 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6540 LDKChannelMonitor this_arg_conv;
6541 this_arg_conv.inner = (void*)(this_arg & (~1));
6542 this_arg_conv.is_owned = false;
6543 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6544 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6545 return (long)ret_ref;
6548 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6549 LDKChannelMonitor this_arg_conv;
6550 this_arg_conv.inner = (void*)(this_arg & (~1));
6551 this_arg_conv.is_owned = false;
6552 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6553 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6554 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6555 for (size_t o = 0; o < ret_var.datalen; o++) {
6556 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6557 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6558 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6559 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6560 if (arr_conv_14_var.is_owned) {
6561 arr_conv_14_ref |= 1;
6563 ret_arr_ptr[o] = arr_conv_14_ref;
6565 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6570 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6571 LDKChannelMonitor this_arg_conv;
6572 this_arg_conv.inner = (void*)(this_arg & (~1));
6573 this_arg_conv.is_owned = false;
6574 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6575 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6576 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6577 for (size_t h = 0; h < ret_var.datalen; h++) {
6578 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6579 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6580 long arr_conv_7_ref = (long)arr_conv_7_copy;
6581 ret_arr_ptr[h] = arr_conv_7_ref;
6583 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6584 CVec_EventZ_free(ret_var);
6588 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6589 LDKChannelMonitor this_arg_conv;
6590 this_arg_conv.inner = (void*)(this_arg & (~1));
6591 this_arg_conv.is_owned = false;
6592 LDKLogger* logger_conv = (LDKLogger*)logger;
6593 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6594 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
6595 for (size_t i = 0; i < ret_var.datalen; i++) {
6596 LDKTransaction arr_conv_8_var = ret_var.data[i];
6597 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, arr_conv_8_var.datalen);
6598 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
6599 Transaction_free(arr_conv_8_var);
6600 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
6602 CVec_TransactionZ_free(ret_var);
6606 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) {
6607 LDKChannelMonitor this_arg_conv;
6608 this_arg_conv.inner = (void*)(this_arg & (~1));
6609 this_arg_conv.is_owned = false;
6610 unsigned char header_arr[80];
6611 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6612 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6613 unsigned char (*header_ref)[80] = &header_arr;
6614 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6615 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6616 if (txdata_constr.datalen > 0)
6617 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6619 txdata_constr.data = NULL;
6620 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6621 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6622 long arr_conv_24 = txdata_vals[y];
6623 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6624 FREE((void*)arr_conv_24);
6625 txdata_constr.data[y] = arr_conv_24_conv;
6627 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6628 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6629 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6630 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6631 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6633 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6634 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6635 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6636 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6638 LDKLogger logger_conv = *(LDKLogger*)logger;
6639 if (logger_conv.free == LDKLogger_JCalls_free) {
6640 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6641 LDKLogger_JCalls_clone(logger_conv.this_arg);
6643 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6644 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6645 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6646 for (size_t b = 0; b < ret_var.datalen; b++) {
6647 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6648 *arr_conv_27_ref = ret_var.data[b];
6649 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6651 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6652 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6656 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) {
6657 LDKChannelMonitor this_arg_conv;
6658 this_arg_conv.inner = (void*)(this_arg & (~1));
6659 this_arg_conv.is_owned = false;
6660 unsigned char header_arr[80];
6661 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6662 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6663 unsigned char (*header_ref)[80] = &header_arr;
6664 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6665 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6666 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6667 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6669 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6670 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6671 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6672 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6674 LDKLogger logger_conv = *(LDKLogger*)logger;
6675 if (logger_conv.free == LDKLogger_JCalls_free) {
6676 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6677 LDKLogger_JCalls_clone(logger_conv.this_arg);
6679 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6683 LDKOutPoint this_ptr_conv;
6684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6686 OutPoint_free(this_ptr_conv);
6689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6690 LDKOutPoint orig_conv;
6691 orig_conv.inner = (void*)(orig & (~1));
6692 orig_conv.is_owned = false;
6693 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6694 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6695 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6696 long ret_ref = (long)ret_var.inner;
6697 if (ret_var.is_owned) {
6703 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6704 LDKOutPoint this_ptr_conv;
6705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6706 this_ptr_conv.is_owned = false;
6707 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6708 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6713 LDKOutPoint this_ptr_conv;
6714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6715 this_ptr_conv.is_owned = false;
6716 LDKThirtyTwoBytes val_ref;
6717 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6718 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6719 OutPoint_set_txid(&this_ptr_conv, val_ref);
6722 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6723 LDKOutPoint this_ptr_conv;
6724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6725 this_ptr_conv.is_owned = false;
6726 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6731 LDKOutPoint this_ptr_conv;
6732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6733 this_ptr_conv.is_owned = false;
6734 OutPoint_set_index(&this_ptr_conv, val);
6737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6738 LDKThirtyTwoBytes txid_arg_ref;
6739 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6740 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6741 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6744 long ret_ref = (long)ret_var.inner;
6745 if (ret_var.is_owned) {
6751 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6752 LDKOutPoint this_arg_conv;
6753 this_arg_conv.inner = (void*)(this_arg & (~1));
6754 this_arg_conv.is_owned = false;
6755 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6756 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6760 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6761 LDKOutPoint obj_conv;
6762 obj_conv.inner = (void*)(obj & (~1));
6763 obj_conv.is_owned = false;
6764 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6765 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6766 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6767 CVec_u8Z_free(arg_var);
6771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6773 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6774 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6775 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6776 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6777 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6778 long ret_ref = (long)ret_var.inner;
6779 if (ret_var.is_owned) {
6782 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6787 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6788 FREE((void*)this_ptr);
6789 SpendableOutputDescriptor_free(this_ptr_conv);
6792 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6793 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6794 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6795 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6796 long ret_ref = (long)ret_copy;
6800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6801 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
6802 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6803 *ret = ChannelKeys_clone(orig_conv);
6807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6808 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6809 FREE((void*)this_ptr);
6810 ChannelKeys_free(this_ptr_conv);
6813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6814 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6815 FREE((void*)this_ptr);
6816 KeysInterface_free(this_ptr_conv);
6819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6820 LDKInMemoryChannelKeys this_ptr_conv;
6821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6823 InMemoryChannelKeys_free(this_ptr_conv);
6826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6827 LDKInMemoryChannelKeys orig_conv;
6828 orig_conv.inner = (void*)(orig & (~1));
6829 orig_conv.is_owned = false;
6830 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6831 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6832 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6833 long ret_ref = (long)ret_var.inner;
6834 if (ret_var.is_owned) {
6840 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6841 LDKInMemoryChannelKeys this_ptr_conv;
6842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6843 this_ptr_conv.is_owned = false;
6844 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6845 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6850 LDKInMemoryChannelKeys this_ptr_conv;
6851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6852 this_ptr_conv.is_owned = false;
6853 LDKSecretKey val_ref;
6854 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6855 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6856 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6859 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6860 LDKInMemoryChannelKeys this_ptr_conv;
6861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6862 this_ptr_conv.is_owned = false;
6863 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6864 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6869 LDKInMemoryChannelKeys this_ptr_conv;
6870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6871 this_ptr_conv.is_owned = false;
6872 LDKSecretKey val_ref;
6873 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6874 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6875 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6878 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6879 LDKInMemoryChannelKeys this_ptr_conv;
6880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6881 this_ptr_conv.is_owned = false;
6882 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6883 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6888 LDKInMemoryChannelKeys this_ptr_conv;
6889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6890 this_ptr_conv.is_owned = false;
6891 LDKSecretKey val_ref;
6892 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6893 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6894 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6897 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6898 LDKInMemoryChannelKeys this_ptr_conv;
6899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6900 this_ptr_conv.is_owned = false;
6901 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6902 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6907 LDKInMemoryChannelKeys this_ptr_conv;
6908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6909 this_ptr_conv.is_owned = false;
6910 LDKSecretKey val_ref;
6911 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6912 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6913 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6916 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6917 LDKInMemoryChannelKeys this_ptr_conv;
6918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6919 this_ptr_conv.is_owned = false;
6920 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6921 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6926 LDKInMemoryChannelKeys this_ptr_conv;
6927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6928 this_ptr_conv.is_owned = false;
6929 LDKSecretKey val_ref;
6930 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6931 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6932 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6935 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6936 LDKInMemoryChannelKeys this_ptr_conv;
6937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6938 this_ptr_conv.is_owned = false;
6939 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6940 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6945 LDKInMemoryChannelKeys this_ptr_conv;
6946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6947 this_ptr_conv.is_owned = false;
6948 LDKThirtyTwoBytes val_ref;
6949 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6950 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6951 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6954 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) {
6955 LDKSecretKey funding_key_ref;
6956 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6957 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6958 LDKSecretKey revocation_base_key_ref;
6959 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6960 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6961 LDKSecretKey payment_key_ref;
6962 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6963 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6964 LDKSecretKey delayed_payment_base_key_ref;
6965 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6966 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6967 LDKSecretKey htlc_base_key_ref;
6968 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6969 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6970 LDKThirtyTwoBytes commitment_seed_ref;
6971 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6972 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6973 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6974 FREE((void*)key_derivation_params);
6975 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);
6976 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6977 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6978 long ret_ref = (long)ret_var.inner;
6979 if (ret_var.is_owned) {
6985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6986 LDKInMemoryChannelKeys this_arg_conv;
6987 this_arg_conv.inner = (void*)(this_arg & (~1));
6988 this_arg_conv.is_owned = false;
6989 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6990 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6991 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6992 long ret_ref = (long)ret_var.inner;
6993 if (ret_var.is_owned) {
6999 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
7000 LDKInMemoryChannelKeys this_arg_conv;
7001 this_arg_conv.inner = (void*)(this_arg & (~1));
7002 this_arg_conv.is_owned = false;
7003 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
7007 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
7008 LDKInMemoryChannelKeys this_arg_conv;
7009 this_arg_conv.inner = (void*)(this_arg & (~1));
7010 this_arg_conv.is_owned = false;
7011 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
7015 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
7016 LDKInMemoryChannelKeys this_arg_conv;
7017 this_arg_conv.inner = (void*)(this_arg & (~1));
7018 this_arg_conv.is_owned = false;
7019 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
7020 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
7024 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
7025 LDKInMemoryChannelKeys obj_conv;
7026 obj_conv.inner = (void*)(obj & (~1));
7027 obj_conv.is_owned = false;
7028 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
7029 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7030 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7031 CVec_u8Z_free(arg_var);
7035 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
7037 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
7038 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
7039 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
7040 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7041 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7042 long ret_ref = (long)ret_var.inner;
7043 if (ret_var.is_owned) {
7046 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
7050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7051 LDKKeysManager this_ptr_conv;
7052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7054 KeysManager_free(this_ptr_conv);
7057 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) {
7058 unsigned char seed_arr[32];
7059 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
7060 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
7061 unsigned char (*seed_ref)[32] = &seed_arr;
7062 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7063 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
7064 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7065 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7066 long ret_ref = (long)ret_var.inner;
7067 if (ret_var.is_owned) {
7073 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) {
7074 LDKKeysManager this_arg_conv;
7075 this_arg_conv.inner = (void*)(this_arg & (~1));
7076 this_arg_conv.is_owned = false;
7077 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
7078 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7079 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7080 long ret_ref = (long)ret_var.inner;
7081 if (ret_var.is_owned) {
7087 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
7088 LDKKeysManager this_arg_conv;
7089 this_arg_conv.inner = (void*)(this_arg & (~1));
7090 this_arg_conv.is_owned = false;
7091 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7092 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
7096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7097 LDKChannelManager this_ptr_conv;
7098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7100 ChannelManager_free(this_ptr_conv);
7103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7104 LDKChannelDetails this_ptr_conv;
7105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7107 ChannelDetails_free(this_ptr_conv);
7110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7111 LDKChannelDetails orig_conv;
7112 orig_conv.inner = (void*)(orig & (~1));
7113 orig_conv.is_owned = false;
7114 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
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 jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7125 LDKChannelDetails this_ptr_conv;
7126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7127 this_ptr_conv.is_owned = false;
7128 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7129 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
7133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7134 LDKChannelDetails this_ptr_conv;
7135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7136 this_ptr_conv.is_owned = false;
7137 LDKThirtyTwoBytes val_ref;
7138 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7139 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7140 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7143 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7144 LDKChannelDetails this_ptr_conv;
7145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7146 this_ptr_conv.is_owned = false;
7147 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7148 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
7152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7153 LDKChannelDetails this_ptr_conv;
7154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7155 this_ptr_conv.is_owned = false;
7156 LDKPublicKey val_ref;
7157 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7158 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7159 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7163 LDKChannelDetails this_ptr_conv;
7164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7165 this_ptr_conv.is_owned = false;
7166 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7167 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7168 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7169 long ret_ref = (long)ret_var.inner;
7170 if (ret_var.is_owned) {
7176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7177 LDKChannelDetails this_ptr_conv;
7178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7179 this_ptr_conv.is_owned = false;
7180 LDKInitFeatures val_conv;
7181 val_conv.inner = (void*)(val & (~1));
7182 val_conv.is_owned = (val & 1) || (val == 0);
7183 // Warning: we may need a move here but can't clone!
7184 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7187 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7188 LDKChannelDetails this_ptr_conv;
7189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7190 this_ptr_conv.is_owned = false;
7191 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7196 LDKChannelDetails this_ptr_conv;
7197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7198 this_ptr_conv.is_owned = false;
7199 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7203 LDKChannelDetails this_ptr_conv;
7204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7205 this_ptr_conv.is_owned = false;
7206 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7211 LDKChannelDetails this_ptr_conv;
7212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7213 this_ptr_conv.is_owned = false;
7214 ChannelDetails_set_user_id(&this_ptr_conv, val);
7217 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7218 LDKChannelDetails this_ptr_conv;
7219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7220 this_ptr_conv.is_owned = false;
7221 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7225 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7226 LDKChannelDetails this_ptr_conv;
7227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7228 this_ptr_conv.is_owned = false;
7229 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7232 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7233 LDKChannelDetails this_ptr_conv;
7234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7235 this_ptr_conv.is_owned = false;
7236 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7241 LDKChannelDetails this_ptr_conv;
7242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7243 this_ptr_conv.is_owned = false;
7244 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7247 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
7248 LDKChannelDetails this_ptr_conv;
7249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7250 this_ptr_conv.is_owned = false;
7251 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7256 LDKChannelDetails this_ptr_conv;
7257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7258 this_ptr_conv.is_owned = false;
7259 ChannelDetails_set_is_live(&this_ptr_conv, val);
7262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7263 LDKPaymentSendFailure this_ptr_conv;
7264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7266 PaymentSendFailure_free(this_ptr_conv);
7269 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) {
7270 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7271 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7272 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7273 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7274 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7276 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7277 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7278 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7279 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7281 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7282 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7283 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7284 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7286 LDKLogger logger_conv = *(LDKLogger*)logger;
7287 if (logger_conv.free == LDKLogger_JCalls_free) {
7288 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7289 LDKLogger_JCalls_clone(logger_conv.this_arg);
7291 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7292 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7293 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7294 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7296 LDKUserConfig config_conv;
7297 config_conv.inner = (void*)(config & (~1));
7298 config_conv.is_owned = (config & 1) || (config == 0);
7299 if (config_conv.inner != NULL)
7300 config_conv = UserConfig_clone(&config_conv);
7301 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);
7302 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7303 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7304 long ret_ref = (long)ret_var.inner;
7305 if (ret_var.is_owned) {
7311 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) {
7312 LDKChannelManager this_arg_conv;
7313 this_arg_conv.inner = (void*)(this_arg & (~1));
7314 this_arg_conv.is_owned = false;
7315 LDKPublicKey their_network_key_ref;
7316 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7317 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7318 LDKUserConfig override_config_conv;
7319 override_config_conv.inner = (void*)(override_config & (~1));
7320 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7321 if (override_config_conv.inner != NULL)
7322 override_config_conv = UserConfig_clone(&override_config_conv);
7323 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7324 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7325 return (long)ret_conv;
7328 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7329 LDKChannelManager this_arg_conv;
7330 this_arg_conv.inner = (void*)(this_arg & (~1));
7331 this_arg_conv.is_owned = false;
7332 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7333 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7334 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7335 for (size_t q = 0; q < ret_var.datalen; q++) {
7336 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7337 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7338 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7339 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7340 if (arr_conv_16_var.is_owned) {
7341 arr_conv_16_ref |= 1;
7343 ret_arr_ptr[q] = arr_conv_16_ref;
7345 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7350 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7351 LDKChannelManager this_arg_conv;
7352 this_arg_conv.inner = (void*)(this_arg & (~1));
7353 this_arg_conv.is_owned = false;
7354 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7355 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7356 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7357 for (size_t q = 0; q < ret_var.datalen; q++) {
7358 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7359 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7360 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7361 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7362 if (arr_conv_16_var.is_owned) {
7363 arr_conv_16_ref |= 1;
7365 ret_arr_ptr[q] = arr_conv_16_ref;
7367 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7373 LDKChannelManager this_arg_conv;
7374 this_arg_conv.inner = (void*)(this_arg & (~1));
7375 this_arg_conv.is_owned = false;
7376 unsigned char channel_id_arr[32];
7377 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7378 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7379 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7380 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7381 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7382 return (long)ret_conv;
7385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7386 LDKChannelManager this_arg_conv;
7387 this_arg_conv.inner = (void*)(this_arg & (~1));
7388 this_arg_conv.is_owned = false;
7389 unsigned char channel_id_arr[32];
7390 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7391 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7392 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7393 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7397 LDKChannelManager this_arg_conv;
7398 this_arg_conv.inner = (void*)(this_arg & (~1));
7399 this_arg_conv.is_owned = false;
7400 ChannelManager_force_close_all_channels(&this_arg_conv);
7403 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) {
7404 LDKChannelManager this_arg_conv;
7405 this_arg_conv.inner = (void*)(this_arg & (~1));
7406 this_arg_conv.is_owned = false;
7407 LDKRoute route_conv;
7408 route_conv.inner = (void*)(route & (~1));
7409 route_conv.is_owned = false;
7410 LDKThirtyTwoBytes payment_hash_ref;
7411 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7412 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7413 LDKThirtyTwoBytes payment_secret_ref;
7414 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7415 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7416 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7417 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7418 return (long)ret_conv;
7421 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) {
7422 LDKChannelManager this_arg_conv;
7423 this_arg_conv.inner = (void*)(this_arg & (~1));
7424 this_arg_conv.is_owned = false;
7425 unsigned char temporary_channel_id_arr[32];
7426 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7427 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7428 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7429 LDKOutPoint funding_txo_conv;
7430 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7431 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7432 if (funding_txo_conv.inner != NULL)
7433 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7434 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7437 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) {
7438 LDKChannelManager this_arg_conv;
7439 this_arg_conv.inner = (void*)(this_arg & (~1));
7440 this_arg_conv.is_owned = false;
7441 LDKThreeBytes rgb_ref;
7442 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7443 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7444 LDKThirtyTwoBytes alias_ref;
7445 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7446 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7447 LDKCVec_NetAddressZ addresses_constr;
7448 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7449 if (addresses_constr.datalen > 0)
7450 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7452 addresses_constr.data = NULL;
7453 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7454 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7455 long arr_conv_12 = addresses_vals[m];
7456 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7457 FREE((void*)arr_conv_12);
7458 addresses_constr.data[m] = arr_conv_12_conv;
7460 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7461 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7465 LDKChannelManager this_arg_conv;
7466 this_arg_conv.inner = (void*)(this_arg & (~1));
7467 this_arg_conv.is_owned = false;
7468 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7472 LDKChannelManager this_arg_conv;
7473 this_arg_conv.inner = (void*)(this_arg & (~1));
7474 this_arg_conv.is_owned = false;
7475 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7478 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) {
7479 LDKChannelManager this_arg_conv;
7480 this_arg_conv.inner = (void*)(this_arg & (~1));
7481 this_arg_conv.is_owned = false;
7482 unsigned char payment_hash_arr[32];
7483 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7484 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7485 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7486 LDKThirtyTwoBytes payment_secret_ref;
7487 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7488 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7489 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7493 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) {
7494 LDKChannelManager this_arg_conv;
7495 this_arg_conv.inner = (void*)(this_arg & (~1));
7496 this_arg_conv.is_owned = false;
7497 LDKThirtyTwoBytes payment_preimage_ref;
7498 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7499 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7500 LDKThirtyTwoBytes payment_secret_ref;
7501 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7502 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7503 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7507 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7508 LDKChannelManager this_arg_conv;
7509 this_arg_conv.inner = (void*)(this_arg & (~1));
7510 this_arg_conv.is_owned = false;
7511 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7512 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7516 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) {
7517 LDKChannelManager this_arg_conv;
7518 this_arg_conv.inner = (void*)(this_arg & (~1));
7519 this_arg_conv.is_owned = false;
7520 LDKOutPoint funding_txo_conv;
7521 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7522 funding_txo_conv.is_owned = false;
7523 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7527 LDKChannelManager this_arg_conv;
7528 this_arg_conv.inner = (void*)(this_arg & (~1));
7529 this_arg_conv.is_owned = false;
7530 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7531 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7536 LDKChannelManager this_arg_conv;
7537 this_arg_conv.inner = (void*)(this_arg & (~1));
7538 this_arg_conv.is_owned = false;
7539 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7540 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7545 LDKChannelManager this_arg_conv;
7546 this_arg_conv.inner = (void*)(this_arg & (~1));
7547 this_arg_conv.is_owned = false;
7548 unsigned char header_arr[80];
7549 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7550 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7551 unsigned char (*header_ref)[80] = &header_arr;
7552 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7553 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7554 if (txdata_constr.datalen > 0)
7555 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7557 txdata_constr.data = NULL;
7558 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7559 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7560 long arr_conv_24 = txdata_vals[y];
7561 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
7562 FREE((void*)arr_conv_24);
7563 txdata_constr.data[y] = arr_conv_24_conv;
7565 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7566 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7570 LDKChannelManager this_arg_conv;
7571 this_arg_conv.inner = (void*)(this_arg & (~1));
7572 this_arg_conv.is_owned = false;
7573 unsigned char header_arr[80];
7574 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7575 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7576 unsigned char (*header_ref)[80] = &header_arr;
7577 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7580 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7581 LDKChannelManager this_arg_conv;
7582 this_arg_conv.inner = (void*)(this_arg & (~1));
7583 this_arg_conv.is_owned = false;
7584 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7585 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7590 LDKChannelManagerReadArgs this_ptr_conv;
7591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7593 ChannelManagerReadArgs_free(this_ptr_conv);
7596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7597 LDKChannelManagerReadArgs this_ptr_conv;
7598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7599 this_ptr_conv.is_owned = false;
7600 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7605 LDKChannelManagerReadArgs this_ptr_conv;
7606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7607 this_ptr_conv.is_owned = false;
7608 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7609 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7610 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7611 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7613 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7617 LDKChannelManagerReadArgs this_ptr_conv;
7618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7619 this_ptr_conv.is_owned = false;
7620 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7624 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7625 LDKChannelManagerReadArgs this_ptr_conv;
7626 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7627 this_ptr_conv.is_owned = false;
7628 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7629 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7630 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7631 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7633 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7637 LDKChannelManagerReadArgs this_ptr_conv;
7638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7639 this_ptr_conv.is_owned = false;
7640 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7645 LDKChannelManagerReadArgs this_ptr_conv;
7646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7647 this_ptr_conv.is_owned = false;
7648 LDKWatch val_conv = *(LDKWatch*)val;
7649 if (val_conv.free == LDKWatch_JCalls_free) {
7650 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7651 LDKWatch_JCalls_clone(val_conv.this_arg);
7653 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7657 LDKChannelManagerReadArgs this_ptr_conv;
7658 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7659 this_ptr_conv.is_owned = false;
7660 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7665 LDKChannelManagerReadArgs this_ptr_conv;
7666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7667 this_ptr_conv.is_owned = false;
7668 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7669 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7670 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7671 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7673 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7677 LDKChannelManagerReadArgs this_ptr_conv;
7678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7679 this_ptr_conv.is_owned = false;
7680 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7685 LDKChannelManagerReadArgs this_ptr_conv;
7686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7687 this_ptr_conv.is_owned = false;
7688 LDKLogger val_conv = *(LDKLogger*)val;
7689 if (val_conv.free == LDKLogger_JCalls_free) {
7690 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7691 LDKLogger_JCalls_clone(val_conv.this_arg);
7693 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7696 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7697 LDKChannelManagerReadArgs this_ptr_conv;
7698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7699 this_ptr_conv.is_owned = false;
7700 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7703 long ret_ref = (long)ret_var.inner;
7704 if (ret_var.is_owned) {
7710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7711 LDKChannelManagerReadArgs this_ptr_conv;
7712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7713 this_ptr_conv.is_owned = false;
7714 LDKUserConfig val_conv;
7715 val_conv.inner = (void*)(val & (~1));
7716 val_conv.is_owned = (val & 1) || (val == 0);
7717 if (val_conv.inner != NULL)
7718 val_conv = UserConfig_clone(&val_conv);
7719 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7722 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) {
7723 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7724 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7725 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7726 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7728 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7729 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7730 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7731 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7733 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7734 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7735 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7736 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7738 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7739 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7740 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7741 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7743 LDKLogger logger_conv = *(LDKLogger*)logger;
7744 if (logger_conv.free == LDKLogger_JCalls_free) {
7745 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7746 LDKLogger_JCalls_clone(logger_conv.this_arg);
7748 LDKUserConfig default_config_conv;
7749 default_config_conv.inner = (void*)(default_config & (~1));
7750 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7751 if (default_config_conv.inner != NULL)
7752 default_config_conv = UserConfig_clone(&default_config_conv);
7753 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7754 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7755 if (channel_monitors_constr.datalen > 0)
7756 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7758 channel_monitors_constr.data = NULL;
7759 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7760 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7761 long arr_conv_16 = channel_monitors_vals[q];
7762 LDKChannelMonitor arr_conv_16_conv;
7763 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7764 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7765 channel_monitors_constr.data[q] = arr_conv_16_conv;
7767 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7768 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);
7769 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7770 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7771 long ret_ref = (long)ret_var.inner;
7772 if (ret_var.is_owned) {
7778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7779 LDKDecodeError this_ptr_conv;
7780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7782 DecodeError_free(this_ptr_conv);
7785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7786 LDKInit this_ptr_conv;
7787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7789 Init_free(this_ptr_conv);
7792 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7794 orig_conv.inner = (void*)(orig & (~1));
7795 orig_conv.is_owned = false;
7796 LDKInit ret_var = Init_clone(&orig_conv);
7797 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7798 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7799 long ret_ref = (long)ret_var.inner;
7800 if (ret_var.is_owned) {
7806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7807 LDKErrorMessage this_ptr_conv;
7808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7809 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7810 ErrorMessage_free(this_ptr_conv);
7813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7814 LDKErrorMessage orig_conv;
7815 orig_conv.inner = (void*)(orig & (~1));
7816 orig_conv.is_owned = false;
7817 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7818 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7819 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7820 long ret_ref = (long)ret_var.inner;
7821 if (ret_var.is_owned) {
7827 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7828 LDKErrorMessage this_ptr_conv;
7829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7830 this_ptr_conv.is_owned = false;
7831 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7832 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7837 LDKErrorMessage this_ptr_conv;
7838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7839 this_ptr_conv.is_owned = false;
7840 LDKThirtyTwoBytes val_ref;
7841 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7842 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7843 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7846 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7847 LDKErrorMessage this_ptr_conv;
7848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7849 this_ptr_conv.is_owned = false;
7850 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7851 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7852 memcpy(_buf, _str.chars, _str.len);
7854 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7860 LDKErrorMessage this_ptr_conv;
7861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7862 this_ptr_conv.is_owned = false;
7863 LDKCVec_u8Z val_ref;
7864 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7865 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
7866 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
7867 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7871 LDKThirtyTwoBytes channel_id_arg_ref;
7872 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7873 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7874 LDKCVec_u8Z data_arg_ref;
7875 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7876 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
7877 (*_env)->GetByteArrayRegion(_env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
7878 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7879 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7880 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7881 long ret_ref = (long)ret_var.inner;
7882 if (ret_var.is_owned) {
7888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7889 LDKPing this_ptr_conv;
7890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7892 Ping_free(this_ptr_conv);
7895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7897 orig_conv.inner = (void*)(orig & (~1));
7898 orig_conv.is_owned = false;
7899 LDKPing ret_var = Ping_clone(&orig_conv);
7900 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7901 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7902 long ret_ref = (long)ret_var.inner;
7903 if (ret_var.is_owned) {
7909 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7910 LDKPing this_ptr_conv;
7911 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7912 this_ptr_conv.is_owned = false;
7913 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7918 LDKPing this_ptr_conv;
7919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7920 this_ptr_conv.is_owned = false;
7921 Ping_set_ponglen(&this_ptr_conv, val);
7924 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7925 LDKPing this_ptr_conv;
7926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7927 this_ptr_conv.is_owned = false;
7928 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7933 LDKPing this_ptr_conv;
7934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7935 this_ptr_conv.is_owned = false;
7936 Ping_set_byteslen(&this_ptr_conv, val);
7939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7940 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7941 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7942 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7943 long ret_ref = (long)ret_var.inner;
7944 if (ret_var.is_owned) {
7950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7951 LDKPong this_ptr_conv;
7952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7954 Pong_free(this_ptr_conv);
7957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7959 orig_conv.inner = (void*)(orig & (~1));
7960 orig_conv.is_owned = false;
7961 LDKPong ret_var = Pong_clone(&orig_conv);
7962 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7963 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7964 long ret_ref = (long)ret_var.inner;
7965 if (ret_var.is_owned) {
7971 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7972 LDKPong this_ptr_conv;
7973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7974 this_ptr_conv.is_owned = false;
7975 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7980 LDKPong this_ptr_conv;
7981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7982 this_ptr_conv.is_owned = false;
7983 Pong_set_byteslen(&this_ptr_conv, val);
7986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7987 LDKPong ret_var = Pong_new(byteslen_arg);
7988 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7989 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7990 long ret_ref = (long)ret_var.inner;
7991 if (ret_var.is_owned) {
7997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7998 LDKOpenChannel this_ptr_conv;
7999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8001 OpenChannel_free(this_ptr_conv);
8004 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8005 LDKOpenChannel orig_conv;
8006 orig_conv.inner = (void*)(orig & (~1));
8007 orig_conv.is_owned = false;
8008 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
8009 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8010 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8011 long ret_ref = (long)ret_var.inner;
8012 if (ret_var.is_owned) {
8018 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8019 LDKOpenChannel this_ptr_conv;
8020 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8021 this_ptr_conv.is_owned = false;
8022 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8023 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
8027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8028 LDKOpenChannel this_ptr_conv;
8029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8030 this_ptr_conv.is_owned = false;
8031 LDKThirtyTwoBytes val_ref;
8032 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8033 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8034 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
8037 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8038 LDKOpenChannel this_ptr_conv;
8039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8040 this_ptr_conv.is_owned = false;
8041 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8042 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
8046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8047 LDKOpenChannel this_ptr_conv;
8048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8049 this_ptr_conv.is_owned = false;
8050 LDKThirtyTwoBytes val_ref;
8051 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8052 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8053 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8057 LDKOpenChannel this_ptr_conv;
8058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8059 this_ptr_conv.is_owned = false;
8060 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
8064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8065 LDKOpenChannel this_ptr_conv;
8066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8067 this_ptr_conv.is_owned = false;
8068 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
8071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8072 LDKOpenChannel this_ptr_conv;
8073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8074 this_ptr_conv.is_owned = false;
8075 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
8079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8080 LDKOpenChannel this_ptr_conv;
8081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8082 this_ptr_conv.is_owned = false;
8083 OpenChannel_set_push_msat(&this_ptr_conv, val);
8086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8087 LDKOpenChannel this_ptr_conv;
8088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8089 this_ptr_conv.is_owned = false;
8090 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
8094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8095 LDKOpenChannel this_ptr_conv;
8096 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8097 this_ptr_conv.is_owned = false;
8098 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8101 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8102 LDKOpenChannel this_ptr_conv;
8103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8104 this_ptr_conv.is_owned = false;
8105 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8109 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) {
8110 LDKOpenChannel this_ptr_conv;
8111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8112 this_ptr_conv.is_owned = false;
8113 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8117 LDKOpenChannel this_ptr_conv;
8118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8119 this_ptr_conv.is_owned = false;
8120 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8125 LDKOpenChannel this_ptr_conv;
8126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8127 this_ptr_conv.is_owned = false;
8128 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8132 LDKOpenChannel this_ptr_conv;
8133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8134 this_ptr_conv.is_owned = false;
8135 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8140 LDKOpenChannel this_ptr_conv;
8141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8142 this_ptr_conv.is_owned = false;
8143 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8146 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8147 LDKOpenChannel this_ptr_conv;
8148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8149 this_ptr_conv.is_owned = false;
8150 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8155 LDKOpenChannel this_ptr_conv;
8156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8157 this_ptr_conv.is_owned = false;
8158 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8161 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8162 LDKOpenChannel this_ptr_conv;
8163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8164 this_ptr_conv.is_owned = false;
8165 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8170 LDKOpenChannel this_ptr_conv;
8171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8172 this_ptr_conv.is_owned = false;
8173 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8176 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8177 LDKOpenChannel this_ptr_conv;
8178 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8179 this_ptr_conv.is_owned = false;
8180 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8185 LDKOpenChannel this_ptr_conv;
8186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8187 this_ptr_conv.is_owned = false;
8188 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8191 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8192 LDKOpenChannel this_ptr_conv;
8193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8194 this_ptr_conv.is_owned = false;
8195 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8196 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8201 LDKOpenChannel this_ptr_conv;
8202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8203 this_ptr_conv.is_owned = false;
8204 LDKPublicKey val_ref;
8205 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8206 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8207 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8210 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8211 LDKOpenChannel this_ptr_conv;
8212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8213 this_ptr_conv.is_owned = false;
8214 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8215 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8220 LDKOpenChannel this_ptr_conv;
8221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8222 this_ptr_conv.is_owned = false;
8223 LDKPublicKey val_ref;
8224 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8225 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8226 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8229 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8230 LDKOpenChannel this_ptr_conv;
8231 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8232 this_ptr_conv.is_owned = false;
8233 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8234 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
8238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8239 LDKOpenChannel this_ptr_conv;
8240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8241 this_ptr_conv.is_owned = false;
8242 LDKPublicKey val_ref;
8243 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8244 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8245 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8249 LDKOpenChannel this_ptr_conv;
8250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8251 this_ptr_conv.is_owned = false;
8252 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8253 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8258 LDKOpenChannel this_ptr_conv;
8259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8260 this_ptr_conv.is_owned = false;
8261 LDKPublicKey val_ref;
8262 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8263 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8264 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8267 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8268 LDKOpenChannel this_ptr_conv;
8269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8270 this_ptr_conv.is_owned = false;
8271 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8272 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8277 LDKOpenChannel this_ptr_conv;
8278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8279 this_ptr_conv.is_owned = false;
8280 LDKPublicKey val_ref;
8281 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8282 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8283 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8286 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8287 LDKOpenChannel this_ptr_conv;
8288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8289 this_ptr_conv.is_owned = false;
8290 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8291 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8296 LDKOpenChannel this_ptr_conv;
8297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8298 this_ptr_conv.is_owned = false;
8299 LDKPublicKey val_ref;
8300 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8301 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8302 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8305 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8306 LDKOpenChannel this_ptr_conv;
8307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8308 this_ptr_conv.is_owned = false;
8309 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8314 LDKOpenChannel this_ptr_conv;
8315 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8316 this_ptr_conv.is_owned = false;
8317 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8321 LDKAcceptChannel this_ptr_conv;
8322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8324 AcceptChannel_free(this_ptr_conv);
8327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8328 LDKAcceptChannel orig_conv;
8329 orig_conv.inner = (void*)(orig & (~1));
8330 orig_conv.is_owned = false;
8331 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8332 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8333 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8334 long ret_ref = (long)ret_var.inner;
8335 if (ret_var.is_owned) {
8341 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8342 LDKAcceptChannel this_ptr_conv;
8343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8344 this_ptr_conv.is_owned = false;
8345 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8346 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8351 LDKAcceptChannel this_ptr_conv;
8352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8353 this_ptr_conv.is_owned = false;
8354 LDKThirtyTwoBytes val_ref;
8355 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8356 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8357 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8361 LDKAcceptChannel this_ptr_conv;
8362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8363 this_ptr_conv.is_owned = false;
8364 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8369 LDKAcceptChannel this_ptr_conv;
8370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8371 this_ptr_conv.is_owned = false;
8372 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8376 LDKAcceptChannel this_ptr_conv;
8377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8378 this_ptr_conv.is_owned = false;
8379 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8383 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) {
8384 LDKAcceptChannel this_ptr_conv;
8385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8386 this_ptr_conv.is_owned = false;
8387 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8391 LDKAcceptChannel this_ptr_conv;
8392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8393 this_ptr_conv.is_owned = false;
8394 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8399 LDKAcceptChannel this_ptr_conv;
8400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8401 this_ptr_conv.is_owned = false;
8402 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8405 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8406 LDKAcceptChannel this_ptr_conv;
8407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8408 this_ptr_conv.is_owned = false;
8409 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8414 LDKAcceptChannel this_ptr_conv;
8415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8416 this_ptr_conv.is_owned = false;
8417 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8420 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8421 LDKAcceptChannel this_ptr_conv;
8422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8423 this_ptr_conv.is_owned = false;
8424 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8429 LDKAcceptChannel this_ptr_conv;
8430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8431 this_ptr_conv.is_owned = false;
8432 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8435 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8436 LDKAcceptChannel this_ptr_conv;
8437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8438 this_ptr_conv.is_owned = false;
8439 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8444 LDKAcceptChannel this_ptr_conv;
8445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8446 this_ptr_conv.is_owned = false;
8447 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8450 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8451 LDKAcceptChannel this_ptr_conv;
8452 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8453 this_ptr_conv.is_owned = false;
8454 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8459 LDKAcceptChannel this_ptr_conv;
8460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8461 this_ptr_conv.is_owned = false;
8462 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8465 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8466 LDKAcceptChannel this_ptr_conv;
8467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8468 this_ptr_conv.is_owned = false;
8469 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8470 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8474 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8475 LDKAcceptChannel this_ptr_conv;
8476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8477 this_ptr_conv.is_owned = false;
8478 LDKPublicKey val_ref;
8479 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8480 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8481 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8484 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8485 LDKAcceptChannel this_ptr_conv;
8486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8487 this_ptr_conv.is_owned = false;
8488 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8489 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8493 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8494 LDKAcceptChannel this_ptr_conv;
8495 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8496 this_ptr_conv.is_owned = false;
8497 LDKPublicKey val_ref;
8498 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8499 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8500 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8503 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8504 LDKAcceptChannel this_ptr_conv;
8505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8506 this_ptr_conv.is_owned = false;
8507 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8508 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8513 LDKAcceptChannel this_ptr_conv;
8514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8515 this_ptr_conv.is_owned = false;
8516 LDKPublicKey val_ref;
8517 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8518 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8519 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8522 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8523 LDKAcceptChannel this_ptr_conv;
8524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8525 this_ptr_conv.is_owned = false;
8526 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8527 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8532 LDKAcceptChannel this_ptr_conv;
8533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8534 this_ptr_conv.is_owned = false;
8535 LDKPublicKey val_ref;
8536 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8537 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8538 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8541 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8542 LDKAcceptChannel this_ptr_conv;
8543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8544 this_ptr_conv.is_owned = false;
8545 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8546 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8551 LDKAcceptChannel this_ptr_conv;
8552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8553 this_ptr_conv.is_owned = false;
8554 LDKPublicKey val_ref;
8555 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8556 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8557 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8560 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8561 LDKAcceptChannel this_ptr_conv;
8562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8563 this_ptr_conv.is_owned = false;
8564 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8565 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8569 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8570 LDKAcceptChannel this_ptr_conv;
8571 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8572 this_ptr_conv.is_owned = false;
8573 LDKPublicKey val_ref;
8574 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8575 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8576 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8580 LDKFundingCreated this_ptr_conv;
8581 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8582 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8583 FundingCreated_free(this_ptr_conv);
8586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8587 LDKFundingCreated orig_conv;
8588 orig_conv.inner = (void*)(orig & (~1));
8589 orig_conv.is_owned = false;
8590 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8593 long ret_ref = (long)ret_var.inner;
8594 if (ret_var.is_owned) {
8600 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8601 LDKFundingCreated this_ptr_conv;
8602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8603 this_ptr_conv.is_owned = false;
8604 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8605 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8609 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8610 LDKFundingCreated this_ptr_conv;
8611 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8612 this_ptr_conv.is_owned = false;
8613 LDKThirtyTwoBytes val_ref;
8614 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8615 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8616 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8620 LDKFundingCreated this_ptr_conv;
8621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8622 this_ptr_conv.is_owned = false;
8623 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8624 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8629 LDKFundingCreated this_ptr_conv;
8630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8631 this_ptr_conv.is_owned = false;
8632 LDKThirtyTwoBytes val_ref;
8633 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8634 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8635 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8638 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8639 LDKFundingCreated this_ptr_conv;
8640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8641 this_ptr_conv.is_owned = false;
8642 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8647 LDKFundingCreated this_ptr_conv;
8648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8649 this_ptr_conv.is_owned = false;
8650 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8653 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8654 LDKFundingCreated this_ptr_conv;
8655 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8656 this_ptr_conv.is_owned = false;
8657 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8658 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8663 LDKFundingCreated this_ptr_conv;
8664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8665 this_ptr_conv.is_owned = false;
8666 LDKSignature val_ref;
8667 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8668 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8669 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8672 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) {
8673 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8674 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8675 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8676 LDKThirtyTwoBytes funding_txid_arg_ref;
8677 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8678 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8679 LDKSignature signature_arg_ref;
8680 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8681 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8682 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8685 long ret_ref = (long)ret_var.inner;
8686 if (ret_var.is_owned) {
8692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8693 LDKFundingSigned this_ptr_conv;
8694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8696 FundingSigned_free(this_ptr_conv);
8699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8700 LDKFundingSigned orig_conv;
8701 orig_conv.inner = (void*)(orig & (~1));
8702 orig_conv.is_owned = false;
8703 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8706 long ret_ref = (long)ret_var.inner;
8707 if (ret_var.is_owned) {
8713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8714 LDKFundingSigned this_ptr_conv;
8715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8716 this_ptr_conv.is_owned = false;
8717 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8718 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8723 LDKFundingSigned this_ptr_conv;
8724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8725 this_ptr_conv.is_owned = false;
8726 LDKThirtyTwoBytes val_ref;
8727 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8728 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8729 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8732 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8733 LDKFundingSigned this_ptr_conv;
8734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8735 this_ptr_conv.is_owned = false;
8736 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8737 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8742 LDKFundingSigned this_ptr_conv;
8743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8744 this_ptr_conv.is_owned = false;
8745 LDKSignature val_ref;
8746 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8747 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8748 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8751 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8752 LDKThirtyTwoBytes channel_id_arg_ref;
8753 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8754 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8755 LDKSignature signature_arg_ref;
8756 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8757 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8758 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8761 long ret_ref = (long)ret_var.inner;
8762 if (ret_var.is_owned) {
8768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8769 LDKFundingLocked this_ptr_conv;
8770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8771 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8772 FundingLocked_free(this_ptr_conv);
8775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8776 LDKFundingLocked orig_conv;
8777 orig_conv.inner = (void*)(orig & (~1));
8778 orig_conv.is_owned = false;
8779 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8780 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8781 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8782 long ret_ref = (long)ret_var.inner;
8783 if (ret_var.is_owned) {
8789 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8790 LDKFundingLocked this_ptr_conv;
8791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8792 this_ptr_conv.is_owned = false;
8793 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8794 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8799 LDKFundingLocked this_ptr_conv;
8800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8801 this_ptr_conv.is_owned = false;
8802 LDKThirtyTwoBytes val_ref;
8803 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8804 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8805 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8808 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8809 LDKFundingLocked this_ptr_conv;
8810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8811 this_ptr_conv.is_owned = false;
8812 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8813 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8818 LDKFundingLocked this_ptr_conv;
8819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8820 this_ptr_conv.is_owned = false;
8821 LDKPublicKey val_ref;
8822 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8823 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8824 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8828 LDKThirtyTwoBytes channel_id_arg_ref;
8829 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8830 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8831 LDKPublicKey next_per_commitment_point_arg_ref;
8832 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8833 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8834 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8835 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8836 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8837 long ret_ref = (long)ret_var.inner;
8838 if (ret_var.is_owned) {
8844 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8845 LDKShutdown this_ptr_conv;
8846 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8847 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8848 Shutdown_free(this_ptr_conv);
8851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8852 LDKShutdown orig_conv;
8853 orig_conv.inner = (void*)(orig & (~1));
8854 orig_conv.is_owned = false;
8855 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8856 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8857 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8858 long ret_ref = (long)ret_var.inner;
8859 if (ret_var.is_owned) {
8865 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8866 LDKShutdown this_ptr_conv;
8867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8868 this_ptr_conv.is_owned = false;
8869 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8870 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8874 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8875 LDKShutdown this_ptr_conv;
8876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8877 this_ptr_conv.is_owned = false;
8878 LDKThirtyTwoBytes val_ref;
8879 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8880 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8881 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8884 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8885 LDKShutdown this_ptr_conv;
8886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8887 this_ptr_conv.is_owned = false;
8888 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8889 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8890 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8895 LDKShutdown this_ptr_conv;
8896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8897 this_ptr_conv.is_owned = false;
8898 LDKCVec_u8Z val_ref;
8899 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8900 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
8901 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
8902 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8906 LDKThirtyTwoBytes channel_id_arg_ref;
8907 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8908 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8909 LDKCVec_u8Z scriptpubkey_arg_ref;
8910 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8911 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
8912 (*_env)->GetByteArrayRegion(_env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
8913 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8914 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8915 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8916 long ret_ref = (long)ret_var.inner;
8917 if (ret_var.is_owned) {
8923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8924 LDKClosingSigned this_ptr_conv;
8925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8927 ClosingSigned_free(this_ptr_conv);
8930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8931 LDKClosingSigned orig_conv;
8932 orig_conv.inner = (void*)(orig & (~1));
8933 orig_conv.is_owned = false;
8934 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8937 long ret_ref = (long)ret_var.inner;
8938 if (ret_var.is_owned) {
8944 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8945 LDKClosingSigned this_ptr_conv;
8946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8947 this_ptr_conv.is_owned = false;
8948 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8949 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8954 LDKClosingSigned this_ptr_conv;
8955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8956 this_ptr_conv.is_owned = false;
8957 LDKThirtyTwoBytes val_ref;
8958 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8959 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8960 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8964 LDKClosingSigned this_ptr_conv;
8965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8966 this_ptr_conv.is_owned = false;
8967 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8972 LDKClosingSigned this_ptr_conv;
8973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8974 this_ptr_conv.is_owned = false;
8975 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8978 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8979 LDKClosingSigned this_ptr_conv;
8980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8981 this_ptr_conv.is_owned = false;
8982 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8983 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8988 LDKClosingSigned this_ptr_conv;
8989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8990 this_ptr_conv.is_owned = false;
8991 LDKSignature val_ref;
8992 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8993 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8994 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8997 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) {
8998 LDKThirtyTwoBytes channel_id_arg_ref;
8999 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9000 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9001 LDKSignature signature_arg_ref;
9002 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9003 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9004 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
9005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9007 long ret_ref = (long)ret_var.inner;
9008 if (ret_var.is_owned) {
9014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9015 LDKUpdateAddHTLC this_ptr_conv;
9016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9018 UpdateAddHTLC_free(this_ptr_conv);
9021 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9022 LDKUpdateAddHTLC orig_conv;
9023 orig_conv.inner = (void*)(orig & (~1));
9024 orig_conv.is_owned = false;
9025 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
9026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9028 long ret_ref = (long)ret_var.inner;
9029 if (ret_var.is_owned) {
9035 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9036 LDKUpdateAddHTLC this_ptr_conv;
9037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9038 this_ptr_conv.is_owned = false;
9039 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9040 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
9044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9045 LDKUpdateAddHTLC this_ptr_conv;
9046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9047 this_ptr_conv.is_owned = false;
9048 LDKThirtyTwoBytes val_ref;
9049 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9050 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9051 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
9054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9055 LDKUpdateAddHTLC this_ptr_conv;
9056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9057 this_ptr_conv.is_owned = false;
9058 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
9062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9063 LDKUpdateAddHTLC this_ptr_conv;
9064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9065 this_ptr_conv.is_owned = false;
9066 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
9069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9070 LDKUpdateAddHTLC this_ptr_conv;
9071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9072 this_ptr_conv.is_owned = false;
9073 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
9077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9078 LDKUpdateAddHTLC this_ptr_conv;
9079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9080 this_ptr_conv.is_owned = false;
9081 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
9084 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9085 LDKUpdateAddHTLC this_ptr_conv;
9086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9087 this_ptr_conv.is_owned = false;
9088 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9089 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
9093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9094 LDKUpdateAddHTLC this_ptr_conv;
9095 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9096 this_ptr_conv.is_owned = false;
9097 LDKThirtyTwoBytes val_ref;
9098 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9099 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9100 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
9103 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
9104 LDKUpdateAddHTLC this_ptr_conv;
9105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9106 this_ptr_conv.is_owned = false;
9107 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
9111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9112 LDKUpdateAddHTLC this_ptr_conv;
9113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9114 this_ptr_conv.is_owned = false;
9115 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9118 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9119 LDKUpdateFulfillHTLC this_ptr_conv;
9120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9122 UpdateFulfillHTLC_free(this_ptr_conv);
9125 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9126 LDKUpdateFulfillHTLC orig_conv;
9127 orig_conv.inner = (void*)(orig & (~1));
9128 orig_conv.is_owned = false;
9129 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9130 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9131 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9132 long ret_ref = (long)ret_var.inner;
9133 if (ret_var.is_owned) {
9139 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9140 LDKUpdateFulfillHTLC this_ptr_conv;
9141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9142 this_ptr_conv.is_owned = false;
9143 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9144 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
9148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9149 LDKUpdateFulfillHTLC this_ptr_conv;
9150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9151 this_ptr_conv.is_owned = false;
9152 LDKThirtyTwoBytes val_ref;
9153 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9154 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9155 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9158 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9159 LDKUpdateFulfillHTLC this_ptr_conv;
9160 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9161 this_ptr_conv.is_owned = false;
9162 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9167 LDKUpdateFulfillHTLC this_ptr_conv;
9168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9169 this_ptr_conv.is_owned = false;
9170 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9173 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
9174 LDKUpdateFulfillHTLC this_ptr_conv;
9175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9176 this_ptr_conv.is_owned = false;
9177 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9178 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
9182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9183 LDKUpdateFulfillHTLC this_ptr_conv;
9184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9185 this_ptr_conv.is_owned = false;
9186 LDKThirtyTwoBytes val_ref;
9187 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9188 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9189 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9192 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) {
9193 LDKThirtyTwoBytes channel_id_arg_ref;
9194 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9195 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9196 LDKThirtyTwoBytes payment_preimage_arg_ref;
9197 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
9198 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
9199 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9200 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9201 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9202 long ret_ref = (long)ret_var.inner;
9203 if (ret_var.is_owned) {
9209 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9210 LDKUpdateFailHTLC this_ptr_conv;
9211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9213 UpdateFailHTLC_free(this_ptr_conv);
9216 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9217 LDKUpdateFailHTLC orig_conv;
9218 orig_conv.inner = (void*)(orig & (~1));
9219 orig_conv.is_owned = false;
9220 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9221 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9222 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9223 long ret_ref = (long)ret_var.inner;
9224 if (ret_var.is_owned) {
9230 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9231 LDKUpdateFailHTLC this_ptr_conv;
9232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9233 this_ptr_conv.is_owned = false;
9234 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9235 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
9239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9240 LDKUpdateFailHTLC this_ptr_conv;
9241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9242 this_ptr_conv.is_owned = false;
9243 LDKThirtyTwoBytes val_ref;
9244 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9245 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9246 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9250 LDKUpdateFailHTLC this_ptr_conv;
9251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9252 this_ptr_conv.is_owned = false;
9253 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9258 LDKUpdateFailHTLC this_ptr_conv;
9259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9260 this_ptr_conv.is_owned = false;
9261 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9265 LDKUpdateFailMalformedHTLC this_ptr_conv;
9266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9268 UpdateFailMalformedHTLC_free(this_ptr_conv);
9271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9272 LDKUpdateFailMalformedHTLC orig_conv;
9273 orig_conv.inner = (void*)(orig & (~1));
9274 orig_conv.is_owned = false;
9275 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9276 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9277 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9278 long ret_ref = (long)ret_var.inner;
9279 if (ret_var.is_owned) {
9285 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9286 LDKUpdateFailMalformedHTLC this_ptr_conv;
9287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9288 this_ptr_conv.is_owned = false;
9289 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9290 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9295 LDKUpdateFailMalformedHTLC this_ptr_conv;
9296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9297 this_ptr_conv.is_owned = false;
9298 LDKThirtyTwoBytes val_ref;
9299 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9300 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9301 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9305 LDKUpdateFailMalformedHTLC this_ptr_conv;
9306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9307 this_ptr_conv.is_owned = false;
9308 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9313 LDKUpdateFailMalformedHTLC this_ptr_conv;
9314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9315 this_ptr_conv.is_owned = false;
9316 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9319 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
9320 LDKUpdateFailMalformedHTLC this_ptr_conv;
9321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9322 this_ptr_conv.is_owned = false;
9323 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9327 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9328 LDKUpdateFailMalformedHTLC this_ptr_conv;
9329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9330 this_ptr_conv.is_owned = false;
9331 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9335 LDKCommitmentSigned this_ptr_conv;
9336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9337 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9338 CommitmentSigned_free(this_ptr_conv);
9341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9342 LDKCommitmentSigned orig_conv;
9343 orig_conv.inner = (void*)(orig & (~1));
9344 orig_conv.is_owned = false;
9345 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9346 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9347 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9348 long ret_ref = (long)ret_var.inner;
9349 if (ret_var.is_owned) {
9355 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9356 LDKCommitmentSigned this_ptr_conv;
9357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9358 this_ptr_conv.is_owned = false;
9359 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9360 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9365 LDKCommitmentSigned this_ptr_conv;
9366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9367 this_ptr_conv.is_owned = false;
9368 LDKThirtyTwoBytes val_ref;
9369 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9370 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9371 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9374 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9375 LDKCommitmentSigned this_ptr_conv;
9376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9377 this_ptr_conv.is_owned = false;
9378 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9379 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9384 LDKCommitmentSigned this_ptr_conv;
9385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9386 this_ptr_conv.is_owned = false;
9387 LDKSignature val_ref;
9388 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9389 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9390 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9394 LDKCommitmentSigned this_ptr_conv;
9395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9396 this_ptr_conv.is_owned = false;
9397 LDKCVec_SignatureZ val_constr;
9398 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9399 if (val_constr.datalen > 0)
9400 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9402 val_constr.data = NULL;
9403 for (size_t i = 0; i < val_constr.datalen; i++) {
9404 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9405 LDKSignature arr_conv_8_ref;
9406 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9407 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9408 val_constr.data[i] = arr_conv_8_ref;
9410 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9413 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) {
9414 LDKThirtyTwoBytes channel_id_arg_ref;
9415 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9416 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9417 LDKSignature signature_arg_ref;
9418 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9419 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9420 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9421 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9422 if (htlc_signatures_arg_constr.datalen > 0)
9423 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9425 htlc_signatures_arg_constr.data = NULL;
9426 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9427 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9428 LDKSignature arr_conv_8_ref;
9429 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9430 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9431 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9433 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9434 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9435 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9436 long ret_ref = (long)ret_var.inner;
9437 if (ret_var.is_owned) {
9443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9444 LDKRevokeAndACK this_ptr_conv;
9445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9447 RevokeAndACK_free(this_ptr_conv);
9450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9451 LDKRevokeAndACK orig_conv;
9452 orig_conv.inner = (void*)(orig & (~1));
9453 orig_conv.is_owned = false;
9454 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9455 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9456 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9457 long ret_ref = (long)ret_var.inner;
9458 if (ret_var.is_owned) {
9464 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9465 LDKRevokeAndACK this_ptr_conv;
9466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9467 this_ptr_conv.is_owned = false;
9468 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9469 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9474 LDKRevokeAndACK this_ptr_conv;
9475 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9476 this_ptr_conv.is_owned = false;
9477 LDKThirtyTwoBytes val_ref;
9478 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9479 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9480 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9484 LDKRevokeAndACK this_ptr_conv;
9485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9486 this_ptr_conv.is_owned = false;
9487 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9488 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9493 LDKRevokeAndACK this_ptr_conv;
9494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9495 this_ptr_conv.is_owned = false;
9496 LDKThirtyTwoBytes val_ref;
9497 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9498 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9499 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9502 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9503 LDKRevokeAndACK this_ptr_conv;
9504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9505 this_ptr_conv.is_owned = false;
9506 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9507 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9512 LDKRevokeAndACK this_ptr_conv;
9513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9514 this_ptr_conv.is_owned = false;
9515 LDKPublicKey val_ref;
9516 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9517 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9518 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9521 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) {
9522 LDKThirtyTwoBytes channel_id_arg_ref;
9523 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9524 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9525 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9526 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9527 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9528 LDKPublicKey next_per_commitment_point_arg_ref;
9529 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9530 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9531 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9532 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9533 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9534 long ret_ref = (long)ret_var.inner;
9535 if (ret_var.is_owned) {
9541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9542 LDKUpdateFee this_ptr_conv;
9543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9545 UpdateFee_free(this_ptr_conv);
9548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9549 LDKUpdateFee orig_conv;
9550 orig_conv.inner = (void*)(orig & (~1));
9551 orig_conv.is_owned = false;
9552 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9553 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9554 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9555 long ret_ref = (long)ret_var.inner;
9556 if (ret_var.is_owned) {
9562 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9563 LDKUpdateFee this_ptr_conv;
9564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9565 this_ptr_conv.is_owned = false;
9566 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9567 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9572 LDKUpdateFee this_ptr_conv;
9573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9574 this_ptr_conv.is_owned = false;
9575 LDKThirtyTwoBytes val_ref;
9576 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9577 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9578 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9581 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9582 LDKUpdateFee this_ptr_conv;
9583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9584 this_ptr_conv.is_owned = false;
9585 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9590 LDKUpdateFee this_ptr_conv;
9591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9592 this_ptr_conv.is_owned = false;
9593 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9596 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9597 LDKThirtyTwoBytes channel_id_arg_ref;
9598 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9599 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9600 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
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 void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9611 LDKDataLossProtect this_ptr_conv;
9612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9614 DataLossProtect_free(this_ptr_conv);
9617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9618 LDKDataLossProtect orig_conv;
9619 orig_conv.inner = (void*)(orig & (~1));
9620 orig_conv.is_owned = false;
9621 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9622 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9623 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9624 long ret_ref = (long)ret_var.inner;
9625 if (ret_var.is_owned) {
9631 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9632 LDKDataLossProtect this_ptr_conv;
9633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9634 this_ptr_conv.is_owned = false;
9635 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9636 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9641 LDKDataLossProtect this_ptr_conv;
9642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9643 this_ptr_conv.is_owned = false;
9644 LDKThirtyTwoBytes val_ref;
9645 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9646 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9647 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9650 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9651 LDKDataLossProtect this_ptr_conv;
9652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9653 this_ptr_conv.is_owned = false;
9654 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9655 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9660 LDKDataLossProtect this_ptr_conv;
9661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9662 this_ptr_conv.is_owned = false;
9663 LDKPublicKey val_ref;
9664 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9665 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9666 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9669 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) {
9670 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9671 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9672 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9673 LDKPublicKey my_current_per_commitment_point_arg_ref;
9674 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9675 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9676 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9677 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9678 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9679 long ret_ref = (long)ret_var.inner;
9680 if (ret_var.is_owned) {
9686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9687 LDKChannelReestablish this_ptr_conv;
9688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9690 ChannelReestablish_free(this_ptr_conv);
9693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9694 LDKChannelReestablish orig_conv;
9695 orig_conv.inner = (void*)(orig & (~1));
9696 orig_conv.is_owned = false;
9697 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9698 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9699 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9700 long ret_ref = (long)ret_var.inner;
9701 if (ret_var.is_owned) {
9707 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9708 LDKChannelReestablish this_ptr_conv;
9709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9710 this_ptr_conv.is_owned = false;
9711 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9712 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9717 LDKChannelReestablish this_ptr_conv;
9718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9719 this_ptr_conv.is_owned = false;
9720 LDKThirtyTwoBytes val_ref;
9721 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9722 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9723 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9726 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9727 LDKChannelReestablish this_ptr_conv;
9728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9729 this_ptr_conv.is_owned = false;
9730 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9735 LDKChannelReestablish this_ptr_conv;
9736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9737 this_ptr_conv.is_owned = false;
9738 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9741 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9742 LDKChannelReestablish this_ptr_conv;
9743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9744 this_ptr_conv.is_owned = false;
9745 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9750 LDKChannelReestablish this_ptr_conv;
9751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9752 this_ptr_conv.is_owned = false;
9753 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9757 LDKAnnouncementSignatures this_ptr_conv;
9758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9760 AnnouncementSignatures_free(this_ptr_conv);
9763 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9764 LDKAnnouncementSignatures orig_conv;
9765 orig_conv.inner = (void*)(orig & (~1));
9766 orig_conv.is_owned = false;
9767 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9768 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9769 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9770 long ret_ref = (long)ret_var.inner;
9771 if (ret_var.is_owned) {
9777 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9778 LDKAnnouncementSignatures this_ptr_conv;
9779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9780 this_ptr_conv.is_owned = false;
9781 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9782 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9787 LDKAnnouncementSignatures this_ptr_conv;
9788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9789 this_ptr_conv.is_owned = false;
9790 LDKThirtyTwoBytes val_ref;
9791 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9792 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9793 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9797 LDKAnnouncementSignatures this_ptr_conv;
9798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9799 this_ptr_conv.is_owned = false;
9800 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9805 LDKAnnouncementSignatures this_ptr_conv;
9806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9807 this_ptr_conv.is_owned = false;
9808 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9811 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9812 LDKAnnouncementSignatures this_ptr_conv;
9813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9814 this_ptr_conv.is_owned = false;
9815 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9816 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9821 LDKAnnouncementSignatures this_ptr_conv;
9822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9823 this_ptr_conv.is_owned = false;
9824 LDKSignature val_ref;
9825 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9826 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9827 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9830 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9831 LDKAnnouncementSignatures this_ptr_conv;
9832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9833 this_ptr_conv.is_owned = false;
9834 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9835 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9840 LDKAnnouncementSignatures this_ptr_conv;
9841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9842 this_ptr_conv.is_owned = false;
9843 LDKSignature val_ref;
9844 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9845 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9846 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9849 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) {
9850 LDKThirtyTwoBytes channel_id_arg_ref;
9851 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9852 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9853 LDKSignature node_signature_arg_ref;
9854 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9855 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9856 LDKSignature bitcoin_signature_arg_ref;
9857 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9858 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9859 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9860 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9861 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9862 long ret_ref = (long)ret_var.inner;
9863 if (ret_var.is_owned) {
9869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9870 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9871 FREE((void*)this_ptr);
9872 NetAddress_free(this_ptr_conv);
9875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9876 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9877 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9878 *ret_copy = NetAddress_clone(orig_conv);
9879 long ret_ref = (long)ret_copy;
9883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9884 LDKUnsignedNodeAnnouncement this_ptr_conv;
9885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9887 UnsignedNodeAnnouncement_free(this_ptr_conv);
9890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9891 LDKUnsignedNodeAnnouncement orig_conv;
9892 orig_conv.inner = (void*)(orig & (~1));
9893 orig_conv.is_owned = false;
9894 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9895 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9896 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9897 long ret_ref = (long)ret_var.inner;
9898 if (ret_var.is_owned) {
9904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9905 LDKUnsignedNodeAnnouncement this_ptr_conv;
9906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9907 this_ptr_conv.is_owned = false;
9908 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9911 long ret_ref = (long)ret_var.inner;
9912 if (ret_var.is_owned) {
9918 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9919 LDKUnsignedNodeAnnouncement this_ptr_conv;
9920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9921 this_ptr_conv.is_owned = false;
9922 LDKNodeFeatures val_conv;
9923 val_conv.inner = (void*)(val & (~1));
9924 val_conv.is_owned = (val & 1) || (val == 0);
9925 // Warning: we may need a move here but can't clone!
9926 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9929 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9930 LDKUnsignedNodeAnnouncement this_ptr_conv;
9931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9932 this_ptr_conv.is_owned = false;
9933 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9938 LDKUnsignedNodeAnnouncement this_ptr_conv;
9939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9940 this_ptr_conv.is_owned = false;
9941 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9944 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9945 LDKUnsignedNodeAnnouncement this_ptr_conv;
9946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9947 this_ptr_conv.is_owned = false;
9948 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9949 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9954 LDKUnsignedNodeAnnouncement this_ptr_conv;
9955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9956 this_ptr_conv.is_owned = false;
9957 LDKPublicKey val_ref;
9958 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9959 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9960 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9963 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9964 LDKUnsignedNodeAnnouncement this_ptr_conv;
9965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9966 this_ptr_conv.is_owned = false;
9967 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9968 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9973 LDKUnsignedNodeAnnouncement this_ptr_conv;
9974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9975 this_ptr_conv.is_owned = false;
9976 LDKThreeBytes val_ref;
9977 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9978 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9979 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9982 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9983 LDKUnsignedNodeAnnouncement this_ptr_conv;
9984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9985 this_ptr_conv.is_owned = false;
9986 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9987 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9992 LDKUnsignedNodeAnnouncement this_ptr_conv;
9993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9994 this_ptr_conv.is_owned = false;
9995 LDKThirtyTwoBytes val_ref;
9996 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9997 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9998 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
10001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10002 LDKUnsignedNodeAnnouncement this_ptr_conv;
10003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10004 this_ptr_conv.is_owned = false;
10005 LDKCVec_NetAddressZ val_constr;
10006 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10007 if (val_constr.datalen > 0)
10008 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10010 val_constr.data = NULL;
10011 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10012 for (size_t m = 0; m < val_constr.datalen; m++) {
10013 long arr_conv_12 = val_vals[m];
10014 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
10015 FREE((void*)arr_conv_12);
10016 val_constr.data[m] = arr_conv_12_conv;
10018 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10019 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
10022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10023 LDKNodeAnnouncement this_ptr_conv;
10024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10026 NodeAnnouncement_free(this_ptr_conv);
10029 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10030 LDKNodeAnnouncement orig_conv;
10031 orig_conv.inner = (void*)(orig & (~1));
10032 orig_conv.is_owned = false;
10033 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
10034 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10035 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10036 long ret_ref = (long)ret_var.inner;
10037 if (ret_var.is_owned) {
10043 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10044 LDKNodeAnnouncement this_ptr_conv;
10045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10046 this_ptr_conv.is_owned = false;
10047 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10048 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
10052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10053 LDKNodeAnnouncement this_ptr_conv;
10054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10055 this_ptr_conv.is_owned = false;
10056 LDKSignature val_ref;
10057 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10058 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10059 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
10062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10063 LDKNodeAnnouncement this_ptr_conv;
10064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10065 this_ptr_conv.is_owned = false;
10066 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
10067 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10068 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10069 long ret_ref = (long)ret_var.inner;
10070 if (ret_var.is_owned) {
10076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10077 LDKNodeAnnouncement this_ptr_conv;
10078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10079 this_ptr_conv.is_owned = false;
10080 LDKUnsignedNodeAnnouncement val_conv;
10081 val_conv.inner = (void*)(val & (~1));
10082 val_conv.is_owned = (val & 1) || (val == 0);
10083 if (val_conv.inner != NULL)
10084 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
10085 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
10088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10089 LDKSignature signature_arg_ref;
10090 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10091 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10092 LDKUnsignedNodeAnnouncement contents_arg_conv;
10093 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10094 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10095 if (contents_arg_conv.inner != NULL)
10096 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
10097 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
10098 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10099 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10100 long ret_ref = (long)ret_var.inner;
10101 if (ret_var.is_owned) {
10107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10108 LDKUnsignedChannelAnnouncement this_ptr_conv;
10109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10110 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10111 UnsignedChannelAnnouncement_free(this_ptr_conv);
10114 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10115 LDKUnsignedChannelAnnouncement orig_conv;
10116 orig_conv.inner = (void*)(orig & (~1));
10117 orig_conv.is_owned = false;
10118 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10119 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10120 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10121 long ret_ref = (long)ret_var.inner;
10122 if (ret_var.is_owned) {
10128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10129 LDKUnsignedChannelAnnouncement this_ptr_conv;
10130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10131 this_ptr_conv.is_owned = false;
10132 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10133 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10134 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10135 long ret_ref = (long)ret_var.inner;
10136 if (ret_var.is_owned) {
10142 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10143 LDKUnsignedChannelAnnouncement this_ptr_conv;
10144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10145 this_ptr_conv.is_owned = false;
10146 LDKChannelFeatures val_conv;
10147 val_conv.inner = (void*)(val & (~1));
10148 val_conv.is_owned = (val & 1) || (val == 0);
10149 // Warning: we may need a move here but can't clone!
10150 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10153 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10154 LDKUnsignedChannelAnnouncement this_ptr_conv;
10155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10156 this_ptr_conv.is_owned = false;
10157 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10158 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
10162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10163 LDKUnsignedChannelAnnouncement this_ptr_conv;
10164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10165 this_ptr_conv.is_owned = false;
10166 LDKThirtyTwoBytes val_ref;
10167 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10168 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10169 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10173 LDKUnsignedChannelAnnouncement this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = false;
10176 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10181 LDKUnsignedChannelAnnouncement this_ptr_conv;
10182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10183 this_ptr_conv.is_owned = false;
10184 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10187 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10188 LDKUnsignedChannelAnnouncement this_ptr_conv;
10189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10190 this_ptr_conv.is_owned = false;
10191 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10192 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
10196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10197 LDKUnsignedChannelAnnouncement this_ptr_conv;
10198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10199 this_ptr_conv.is_owned = false;
10200 LDKPublicKey val_ref;
10201 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10202 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10203 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10206 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10207 LDKUnsignedChannelAnnouncement this_ptr_conv;
10208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10209 this_ptr_conv.is_owned = false;
10210 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10211 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
10215 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10216 LDKUnsignedChannelAnnouncement this_ptr_conv;
10217 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10218 this_ptr_conv.is_owned = false;
10219 LDKPublicKey val_ref;
10220 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10221 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10222 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10225 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10226 LDKUnsignedChannelAnnouncement this_ptr_conv;
10227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10228 this_ptr_conv.is_owned = false;
10229 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10230 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
10234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10235 LDKUnsignedChannelAnnouncement this_ptr_conv;
10236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10237 this_ptr_conv.is_owned = false;
10238 LDKPublicKey val_ref;
10239 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10240 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10241 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10244 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10245 LDKUnsignedChannelAnnouncement this_ptr_conv;
10246 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10247 this_ptr_conv.is_owned = false;
10248 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10249 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
10253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10254 LDKUnsignedChannelAnnouncement this_ptr_conv;
10255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10256 this_ptr_conv.is_owned = false;
10257 LDKPublicKey val_ref;
10258 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10259 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10260 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10264 LDKChannelAnnouncement this_ptr_conv;
10265 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10266 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10267 ChannelAnnouncement_free(this_ptr_conv);
10270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10271 LDKChannelAnnouncement orig_conv;
10272 orig_conv.inner = (void*)(orig & (~1));
10273 orig_conv.is_owned = false;
10274 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10275 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10276 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10277 long ret_ref = (long)ret_var.inner;
10278 if (ret_var.is_owned) {
10284 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10285 LDKChannelAnnouncement this_ptr_conv;
10286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10287 this_ptr_conv.is_owned = false;
10288 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10289 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10294 LDKChannelAnnouncement this_ptr_conv;
10295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10296 this_ptr_conv.is_owned = false;
10297 LDKSignature val_ref;
10298 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10299 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10300 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10303 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10304 LDKChannelAnnouncement this_ptr_conv;
10305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10306 this_ptr_conv.is_owned = false;
10307 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10308 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10313 LDKChannelAnnouncement this_ptr_conv;
10314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10315 this_ptr_conv.is_owned = false;
10316 LDKSignature val_ref;
10317 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10318 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10319 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10322 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10323 LDKChannelAnnouncement this_ptr_conv;
10324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10325 this_ptr_conv.is_owned = false;
10326 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10327 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10332 LDKChannelAnnouncement this_ptr_conv;
10333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10334 this_ptr_conv.is_owned = false;
10335 LDKSignature val_ref;
10336 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10337 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10338 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10341 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10342 LDKChannelAnnouncement this_ptr_conv;
10343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10344 this_ptr_conv.is_owned = false;
10345 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10346 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10351 LDKChannelAnnouncement this_ptr_conv;
10352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10353 this_ptr_conv.is_owned = false;
10354 LDKSignature val_ref;
10355 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10356 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10357 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10361 LDKChannelAnnouncement this_ptr_conv;
10362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10363 this_ptr_conv.is_owned = false;
10364 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10365 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10366 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10367 long ret_ref = (long)ret_var.inner;
10368 if (ret_var.is_owned) {
10374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10375 LDKChannelAnnouncement this_ptr_conv;
10376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10377 this_ptr_conv.is_owned = false;
10378 LDKUnsignedChannelAnnouncement val_conv;
10379 val_conv.inner = (void*)(val & (~1));
10380 val_conv.is_owned = (val & 1) || (val == 0);
10381 if (val_conv.inner != NULL)
10382 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10383 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10386 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) {
10387 LDKSignature node_signature_1_arg_ref;
10388 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10389 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10390 LDKSignature node_signature_2_arg_ref;
10391 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10392 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10393 LDKSignature bitcoin_signature_1_arg_ref;
10394 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10395 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10396 LDKSignature bitcoin_signature_2_arg_ref;
10397 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10398 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10399 LDKUnsignedChannelAnnouncement contents_arg_conv;
10400 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10401 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10402 if (contents_arg_conv.inner != NULL)
10403 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10404 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);
10405 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10406 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10407 long ret_ref = (long)ret_var.inner;
10408 if (ret_var.is_owned) {
10414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10415 LDKUnsignedChannelUpdate this_ptr_conv;
10416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10418 UnsignedChannelUpdate_free(this_ptr_conv);
10421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10422 LDKUnsignedChannelUpdate orig_conv;
10423 orig_conv.inner = (void*)(orig & (~1));
10424 orig_conv.is_owned = false;
10425 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10426 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10427 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10428 long ret_ref = (long)ret_var.inner;
10429 if (ret_var.is_owned) {
10435 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10436 LDKUnsignedChannelUpdate this_ptr_conv;
10437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10438 this_ptr_conv.is_owned = false;
10439 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10440 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10445 LDKUnsignedChannelUpdate this_ptr_conv;
10446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10447 this_ptr_conv.is_owned = false;
10448 LDKThirtyTwoBytes val_ref;
10449 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10450 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10451 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10455 LDKUnsignedChannelUpdate this_ptr_conv;
10456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10457 this_ptr_conv.is_owned = false;
10458 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10462 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10463 LDKUnsignedChannelUpdate this_ptr_conv;
10464 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10465 this_ptr_conv.is_owned = false;
10466 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10469 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10470 LDKUnsignedChannelUpdate this_ptr_conv;
10471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10472 this_ptr_conv.is_owned = false;
10473 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10478 LDKUnsignedChannelUpdate this_ptr_conv;
10479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10480 this_ptr_conv.is_owned = false;
10481 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10484 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10485 LDKUnsignedChannelUpdate this_ptr_conv;
10486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10487 this_ptr_conv.is_owned = false;
10488 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10493 LDKUnsignedChannelUpdate this_ptr_conv;
10494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10495 this_ptr_conv.is_owned = false;
10496 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10499 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10500 LDKUnsignedChannelUpdate this_ptr_conv;
10501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10502 this_ptr_conv.is_owned = false;
10503 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10508 LDKUnsignedChannelUpdate this_ptr_conv;
10509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10510 this_ptr_conv.is_owned = false;
10511 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10515 LDKUnsignedChannelUpdate this_ptr_conv;
10516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10517 this_ptr_conv.is_owned = false;
10518 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10523 LDKUnsignedChannelUpdate this_ptr_conv;
10524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10525 this_ptr_conv.is_owned = false;
10526 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10529 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10530 LDKUnsignedChannelUpdate this_ptr_conv;
10531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10532 this_ptr_conv.is_owned = false;
10533 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10538 LDKUnsignedChannelUpdate this_ptr_conv;
10539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10540 this_ptr_conv.is_owned = false;
10541 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10544 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10545 LDKUnsignedChannelUpdate this_ptr_conv;
10546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10547 this_ptr_conv.is_owned = false;
10548 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10553 LDKUnsignedChannelUpdate this_ptr_conv;
10554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10555 this_ptr_conv.is_owned = false;
10556 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10560 LDKChannelUpdate this_ptr_conv;
10561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10563 ChannelUpdate_free(this_ptr_conv);
10566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10567 LDKChannelUpdate orig_conv;
10568 orig_conv.inner = (void*)(orig & (~1));
10569 orig_conv.is_owned = false;
10570 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10573 long ret_ref = (long)ret_var.inner;
10574 if (ret_var.is_owned) {
10580 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10581 LDKChannelUpdate this_ptr_conv;
10582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10583 this_ptr_conv.is_owned = false;
10584 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10585 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10590 LDKChannelUpdate this_ptr_conv;
10591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10592 this_ptr_conv.is_owned = false;
10593 LDKSignature val_ref;
10594 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10595 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10596 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10600 LDKChannelUpdate this_ptr_conv;
10601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10602 this_ptr_conv.is_owned = false;
10603 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10604 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10605 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10606 long ret_ref = (long)ret_var.inner;
10607 if (ret_var.is_owned) {
10613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10614 LDKChannelUpdate this_ptr_conv;
10615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10616 this_ptr_conv.is_owned = false;
10617 LDKUnsignedChannelUpdate val_conv;
10618 val_conv.inner = (void*)(val & (~1));
10619 val_conv.is_owned = (val & 1) || (val == 0);
10620 if (val_conv.inner != NULL)
10621 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10622 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10626 LDKSignature signature_arg_ref;
10627 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10628 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10629 LDKUnsignedChannelUpdate contents_arg_conv;
10630 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10631 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10632 if (contents_arg_conv.inner != NULL)
10633 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10634 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10637 long ret_ref = (long)ret_var.inner;
10638 if (ret_var.is_owned) {
10644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10645 LDKQueryChannelRange this_ptr_conv;
10646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10648 QueryChannelRange_free(this_ptr_conv);
10651 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10652 LDKQueryChannelRange orig_conv;
10653 orig_conv.inner = (void*)(orig & (~1));
10654 orig_conv.is_owned = false;
10655 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10656 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10657 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10658 long ret_ref = (long)ret_var.inner;
10659 if (ret_var.is_owned) {
10665 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10666 LDKQueryChannelRange this_ptr_conv;
10667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10668 this_ptr_conv.is_owned = false;
10669 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10670 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10675 LDKQueryChannelRange this_ptr_conv;
10676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10677 this_ptr_conv.is_owned = false;
10678 LDKThirtyTwoBytes val_ref;
10679 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10680 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10681 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10684 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10685 LDKQueryChannelRange this_ptr_conv;
10686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10687 this_ptr_conv.is_owned = false;
10688 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10693 LDKQueryChannelRange this_ptr_conv;
10694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10695 this_ptr_conv.is_owned = false;
10696 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10699 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10700 LDKQueryChannelRange this_ptr_conv;
10701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10702 this_ptr_conv.is_owned = false;
10703 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10707 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10708 LDKQueryChannelRange this_ptr_conv;
10709 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10710 this_ptr_conv.is_owned = false;
10711 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10714 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) {
10715 LDKThirtyTwoBytes chain_hash_arg_ref;
10716 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10717 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10718 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10719 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10720 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10721 long ret_ref = (long)ret_var.inner;
10722 if (ret_var.is_owned) {
10728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10729 LDKReplyChannelRange this_ptr_conv;
10730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10732 ReplyChannelRange_free(this_ptr_conv);
10735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10736 LDKReplyChannelRange orig_conv;
10737 orig_conv.inner = (void*)(orig & (~1));
10738 orig_conv.is_owned = false;
10739 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10742 long ret_ref = (long)ret_var.inner;
10743 if (ret_var.is_owned) {
10749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10750 LDKReplyChannelRange this_ptr_conv;
10751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10752 this_ptr_conv.is_owned = false;
10753 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10754 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10759 LDKReplyChannelRange this_ptr_conv;
10760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10761 this_ptr_conv.is_owned = false;
10762 LDKThirtyTwoBytes val_ref;
10763 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10764 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10765 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10768 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10769 LDKReplyChannelRange this_ptr_conv;
10770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10771 this_ptr_conv.is_owned = false;
10772 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10777 LDKReplyChannelRange this_ptr_conv;
10778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10779 this_ptr_conv.is_owned = false;
10780 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10783 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10784 LDKReplyChannelRange this_ptr_conv;
10785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10786 this_ptr_conv.is_owned = false;
10787 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10792 LDKReplyChannelRange this_ptr_conv;
10793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10794 this_ptr_conv.is_owned = false;
10795 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10798 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10799 LDKReplyChannelRange this_ptr_conv;
10800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10801 this_ptr_conv.is_owned = false;
10802 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10807 LDKReplyChannelRange this_ptr_conv;
10808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10809 this_ptr_conv.is_owned = false;
10810 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10814 LDKReplyChannelRange this_ptr_conv;
10815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10816 this_ptr_conv.is_owned = false;
10817 LDKCVec_u64Z val_constr;
10818 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10819 if (val_constr.datalen > 0)
10820 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10822 val_constr.data = NULL;
10823 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10824 for (size_t g = 0; g < val_constr.datalen; g++) {
10825 long arr_conv_6 = val_vals[g];
10826 val_constr.data[g] = arr_conv_6;
10828 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10829 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10832 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) {
10833 LDKThirtyTwoBytes chain_hash_arg_ref;
10834 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10835 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10836 LDKCVec_u64Z short_channel_ids_arg_constr;
10837 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10838 if (short_channel_ids_arg_constr.datalen > 0)
10839 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10841 short_channel_ids_arg_constr.data = NULL;
10842 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10843 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10844 long arr_conv_6 = short_channel_ids_arg_vals[g];
10845 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10847 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10848 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10849 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10850 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10851 long ret_ref = (long)ret_var.inner;
10852 if (ret_var.is_owned) {
10858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10859 LDKQueryShortChannelIds this_ptr_conv;
10860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10861 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10862 QueryShortChannelIds_free(this_ptr_conv);
10865 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10866 LDKQueryShortChannelIds orig_conv;
10867 orig_conv.inner = (void*)(orig & (~1));
10868 orig_conv.is_owned = false;
10869 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10870 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10871 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10872 long ret_ref = (long)ret_var.inner;
10873 if (ret_var.is_owned) {
10879 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10880 LDKQueryShortChannelIds this_ptr_conv;
10881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10882 this_ptr_conv.is_owned = false;
10883 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10884 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10889 LDKQueryShortChannelIds this_ptr_conv;
10890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10891 this_ptr_conv.is_owned = false;
10892 LDKThirtyTwoBytes val_ref;
10893 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10894 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10895 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10899 LDKQueryShortChannelIds this_ptr_conv;
10900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10901 this_ptr_conv.is_owned = false;
10902 LDKCVec_u64Z val_constr;
10903 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10904 if (val_constr.datalen > 0)
10905 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10907 val_constr.data = NULL;
10908 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10909 for (size_t g = 0; g < val_constr.datalen; g++) {
10910 long arr_conv_6 = val_vals[g];
10911 val_constr.data[g] = arr_conv_6;
10913 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10914 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10918 LDKThirtyTwoBytes chain_hash_arg_ref;
10919 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10920 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10921 LDKCVec_u64Z short_channel_ids_arg_constr;
10922 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10923 if (short_channel_ids_arg_constr.datalen > 0)
10924 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10926 short_channel_ids_arg_constr.data = NULL;
10927 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10928 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10929 long arr_conv_6 = short_channel_ids_arg_vals[g];
10930 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10932 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10933 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10934 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10935 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10936 long ret_ref = (long)ret_var.inner;
10937 if (ret_var.is_owned) {
10943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10944 LDKReplyShortChannelIdsEnd this_ptr_conv;
10945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10947 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10951 LDKReplyShortChannelIdsEnd orig_conv;
10952 orig_conv.inner = (void*)(orig & (~1));
10953 orig_conv.is_owned = false;
10954 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10955 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10956 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10957 long ret_ref = (long)ret_var.inner;
10958 if (ret_var.is_owned) {
10964 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10965 LDKReplyShortChannelIdsEnd this_ptr_conv;
10966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10967 this_ptr_conv.is_owned = false;
10968 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10969 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10974 LDKReplyShortChannelIdsEnd this_ptr_conv;
10975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10976 this_ptr_conv.is_owned = false;
10977 LDKThirtyTwoBytes val_ref;
10978 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10979 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10980 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10984 LDKReplyShortChannelIdsEnd this_ptr_conv;
10985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10986 this_ptr_conv.is_owned = false;
10987 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10992 LDKReplyShortChannelIdsEnd this_ptr_conv;
10993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10994 this_ptr_conv.is_owned = false;
10995 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10999 LDKThirtyTwoBytes chain_hash_arg_ref;
11000 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
11001 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
11002 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
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 void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11013 LDKGossipTimestampFilter this_ptr_conv;
11014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11016 GossipTimestampFilter_free(this_ptr_conv);
11019 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11020 LDKGossipTimestampFilter orig_conv;
11021 orig_conv.inner = (void*)(orig & (~1));
11022 orig_conv.is_owned = false;
11023 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
11024 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11025 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11026 long ret_ref = (long)ret_var.inner;
11027 if (ret_var.is_owned) {
11033 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11034 LDKGossipTimestampFilter this_ptr_conv;
11035 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11036 this_ptr_conv.is_owned = false;
11037 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11038 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
11042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11043 LDKGossipTimestampFilter this_ptr_conv;
11044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11045 this_ptr_conv.is_owned = false;
11046 LDKThirtyTwoBytes val_ref;
11047 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11048 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11049 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
11052 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
11053 LDKGossipTimestampFilter this_ptr_conv;
11054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11055 this_ptr_conv.is_owned = false;
11056 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
11060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11061 LDKGossipTimestampFilter this_ptr_conv;
11062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11063 this_ptr_conv.is_owned = false;
11064 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
11067 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
11068 LDKGossipTimestampFilter this_ptr_conv;
11069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11070 this_ptr_conv.is_owned = false;
11071 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
11075 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11076 LDKGossipTimestampFilter this_ptr_conv;
11077 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11078 this_ptr_conv.is_owned = false;
11079 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
11082 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) {
11083 LDKThirtyTwoBytes chain_hash_arg_ref;
11084 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
11085 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
11086 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
11087 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11088 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11089 long ret_ref = (long)ret_var.inner;
11090 if (ret_var.is_owned) {
11096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11097 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
11098 FREE((void*)this_ptr);
11099 ErrorAction_free(this_ptr_conv);
11102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11103 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
11104 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11105 *ret_copy = ErrorAction_clone(orig_conv);
11106 long ret_ref = (long)ret_copy;
11110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11111 LDKLightningError this_ptr_conv;
11112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11114 LightningError_free(this_ptr_conv);
11117 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
11118 LDKLightningError this_ptr_conv;
11119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11120 this_ptr_conv.is_owned = false;
11121 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11122 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11123 memcpy(_buf, _str.chars, _str.len);
11124 _buf[_str.len] = 0;
11125 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
11130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11131 LDKLightningError this_ptr_conv;
11132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11133 this_ptr_conv.is_owned = false;
11134 LDKCVec_u8Z val_ref;
11135 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
11136 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11137 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
11138 LightningError_set_err(&this_ptr_conv, val_ref);
11141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
11142 LDKLightningError this_ptr_conv;
11143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11144 this_ptr_conv.is_owned = false;
11145 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11146 *ret_copy = LightningError_get_action(&this_ptr_conv);
11147 long ret_ref = (long)ret_copy;
11151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11152 LDKLightningError this_ptr_conv;
11153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11154 this_ptr_conv.is_owned = false;
11155 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11157 LightningError_set_action(&this_ptr_conv, val_conv);
11160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
11161 LDKCVec_u8Z err_arg_ref;
11162 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
11163 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11164 (*_env)->GetByteArrayRegion(_env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
11165 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11166 FREE((void*)action_arg);
11167 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11170 long ret_ref = (long)ret_var.inner;
11171 if (ret_var.is_owned) {
11177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11178 LDKCommitmentUpdate this_ptr_conv;
11179 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11180 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11181 CommitmentUpdate_free(this_ptr_conv);
11184 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11185 LDKCommitmentUpdate orig_conv;
11186 orig_conv.inner = (void*)(orig & (~1));
11187 orig_conv.is_owned = false;
11188 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11189 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11190 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11191 long ret_ref = (long)ret_var.inner;
11192 if (ret_var.is_owned) {
11198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11199 LDKCommitmentUpdate this_ptr_conv;
11200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11201 this_ptr_conv.is_owned = false;
11202 LDKCVec_UpdateAddHTLCZ val_constr;
11203 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11204 if (val_constr.datalen > 0)
11205 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11207 val_constr.data = NULL;
11208 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11209 for (size_t p = 0; p < val_constr.datalen; p++) {
11210 long arr_conv_15 = val_vals[p];
11211 LDKUpdateAddHTLC arr_conv_15_conv;
11212 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11213 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11214 if (arr_conv_15_conv.inner != NULL)
11215 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11216 val_constr.data[p] = arr_conv_15_conv;
11218 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11219 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11223 LDKCommitmentUpdate this_ptr_conv;
11224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11225 this_ptr_conv.is_owned = false;
11226 LDKCVec_UpdateFulfillHTLCZ val_constr;
11227 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11228 if (val_constr.datalen > 0)
11229 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11231 val_constr.data = NULL;
11232 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11233 for (size_t t = 0; t < val_constr.datalen; t++) {
11234 long arr_conv_19 = val_vals[t];
11235 LDKUpdateFulfillHTLC arr_conv_19_conv;
11236 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11237 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11238 if (arr_conv_19_conv.inner != NULL)
11239 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11240 val_constr.data[t] = arr_conv_19_conv;
11242 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11243 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11246 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_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_UpdateFailHTLCZ 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(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11255 val_constr.data = NULL;
11256 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11257 for (size_t q = 0; q < val_constr.datalen; q++) {
11258 long arr_conv_16 = val_vals[q];
11259 LDKUpdateFailHTLC arr_conv_16_conv;
11260 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11261 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11262 if (arr_conv_16_conv.inner != NULL)
11263 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11264 val_constr.data[q] = arr_conv_16_conv;
11266 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11267 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_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_UpdateFailMalformedHTLCZ 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(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11279 val_constr.data = NULL;
11280 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11281 for (size_t z = 0; z < val_constr.datalen; z++) {
11282 long arr_conv_25 = val_vals[z];
11283 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11284 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11285 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11286 if (arr_conv_25_conv.inner != NULL)
11287 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11288 val_constr.data[z] = arr_conv_25_conv;
11290 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11291 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11295 LDKCommitmentUpdate this_ptr_conv;
11296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11297 this_ptr_conv.is_owned = false;
11298 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11299 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11300 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11301 long ret_ref = (long)ret_var.inner;
11302 if (ret_var.is_owned) {
11308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11309 LDKCommitmentUpdate this_ptr_conv;
11310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11311 this_ptr_conv.is_owned = false;
11312 LDKUpdateFee val_conv;
11313 val_conv.inner = (void*)(val & (~1));
11314 val_conv.is_owned = (val & 1) || (val == 0);
11315 if (val_conv.inner != NULL)
11316 val_conv = UpdateFee_clone(&val_conv);
11317 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11320 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11321 LDKCommitmentUpdate this_ptr_conv;
11322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11323 this_ptr_conv.is_owned = false;
11324 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11325 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11326 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11327 long ret_ref = (long)ret_var.inner;
11328 if (ret_var.is_owned) {
11334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11335 LDKCommitmentUpdate this_ptr_conv;
11336 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11337 this_ptr_conv.is_owned = false;
11338 LDKCommitmentSigned val_conv;
11339 val_conv.inner = (void*)(val & (~1));
11340 val_conv.is_owned = (val & 1) || (val == 0);
11341 if (val_conv.inner != NULL)
11342 val_conv = CommitmentSigned_clone(&val_conv);
11343 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11346 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) {
11347 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11348 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11349 if (update_add_htlcs_arg_constr.datalen > 0)
11350 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11352 update_add_htlcs_arg_constr.data = NULL;
11353 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11354 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11355 long arr_conv_15 = update_add_htlcs_arg_vals[p];
11356 LDKUpdateAddHTLC arr_conv_15_conv;
11357 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11358 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11359 if (arr_conv_15_conv.inner != NULL)
11360 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11361 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11363 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11364 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11365 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11366 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11367 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11369 update_fulfill_htlcs_arg_constr.data = NULL;
11370 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11371 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11372 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11373 LDKUpdateFulfillHTLC arr_conv_19_conv;
11374 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11375 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11376 if (arr_conv_19_conv.inner != NULL)
11377 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11378 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11380 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11381 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11382 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11383 if (update_fail_htlcs_arg_constr.datalen > 0)
11384 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11386 update_fail_htlcs_arg_constr.data = NULL;
11387 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11388 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11389 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11390 LDKUpdateFailHTLC arr_conv_16_conv;
11391 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11392 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11393 if (arr_conv_16_conv.inner != NULL)
11394 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11395 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11397 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11398 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11399 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11400 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11401 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11403 update_fail_malformed_htlcs_arg_constr.data = NULL;
11404 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11405 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11406 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11407 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11408 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11409 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11410 if (arr_conv_25_conv.inner != NULL)
11411 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11412 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11414 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11415 LDKUpdateFee update_fee_arg_conv;
11416 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11417 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11418 if (update_fee_arg_conv.inner != NULL)
11419 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11420 LDKCommitmentSigned commitment_signed_arg_conv;
11421 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11422 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11423 if (commitment_signed_arg_conv.inner != NULL)
11424 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11425 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);
11426 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11427 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11428 long ret_ref = (long)ret_var.inner;
11429 if (ret_var.is_owned) {
11435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11436 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11437 FREE((void*)this_ptr);
11438 HTLCFailChannelUpdate_free(this_ptr_conv);
11441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11442 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11443 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11444 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11445 long ret_ref = (long)ret_copy;
11449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11450 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11451 FREE((void*)this_ptr);
11452 ChannelMessageHandler_free(this_ptr_conv);
11455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11456 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11457 FREE((void*)this_ptr);
11458 RoutingMessageHandler_free(this_ptr_conv);
11461 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11462 LDKAcceptChannel obj_conv;
11463 obj_conv.inner = (void*)(obj & (~1));
11464 obj_conv.is_owned = false;
11465 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11466 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11467 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11468 CVec_u8Z_free(arg_var);
11472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11473 LDKu8slice ser_ref;
11474 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11475 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11476 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11479 long ret_ref = (long)ret_var.inner;
11480 if (ret_var.is_owned) {
11483 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11487 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11488 LDKAnnouncementSignatures obj_conv;
11489 obj_conv.inner = (void*)(obj & (~1));
11490 obj_conv.is_owned = false;
11491 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11492 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11493 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11494 CVec_u8Z_free(arg_var);
11498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11499 LDKu8slice ser_ref;
11500 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11501 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11502 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11505 long ret_ref = (long)ret_var.inner;
11506 if (ret_var.is_owned) {
11509 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11513 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11514 LDKChannelReestablish obj_conv;
11515 obj_conv.inner = (void*)(obj & (~1));
11516 obj_conv.is_owned = false;
11517 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11518 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11519 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11520 CVec_u8Z_free(arg_var);
11524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11525 LDKu8slice ser_ref;
11526 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11527 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11528 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11529 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11530 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11531 long ret_ref = (long)ret_var.inner;
11532 if (ret_var.is_owned) {
11535 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11539 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11540 LDKClosingSigned obj_conv;
11541 obj_conv.inner = (void*)(obj & (~1));
11542 obj_conv.is_owned = false;
11543 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11544 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11545 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11546 CVec_u8Z_free(arg_var);
11550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11551 LDKu8slice ser_ref;
11552 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11553 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11554 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11557 long ret_ref = (long)ret_var.inner;
11558 if (ret_var.is_owned) {
11561 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11565 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11566 LDKCommitmentSigned obj_conv;
11567 obj_conv.inner = (void*)(obj & (~1));
11568 obj_conv.is_owned = false;
11569 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11570 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11571 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11572 CVec_u8Z_free(arg_var);
11576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11577 LDKu8slice ser_ref;
11578 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11579 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11580 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11581 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11582 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11583 long ret_ref = (long)ret_var.inner;
11584 if (ret_var.is_owned) {
11587 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11591 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11592 LDKFundingCreated obj_conv;
11593 obj_conv.inner = (void*)(obj & (~1));
11594 obj_conv.is_owned = false;
11595 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11596 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11597 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11598 CVec_u8Z_free(arg_var);
11602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11603 LDKu8slice ser_ref;
11604 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11605 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11606 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11609 long ret_ref = (long)ret_var.inner;
11610 if (ret_var.is_owned) {
11613 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11617 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11618 LDKFundingSigned obj_conv;
11619 obj_conv.inner = (void*)(obj & (~1));
11620 obj_conv.is_owned = false;
11621 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11622 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11623 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11624 CVec_u8Z_free(arg_var);
11628 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11629 LDKu8slice ser_ref;
11630 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11631 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11632 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11633 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11634 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11635 long ret_ref = (long)ret_var.inner;
11636 if (ret_var.is_owned) {
11639 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11643 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11644 LDKFundingLocked obj_conv;
11645 obj_conv.inner = (void*)(obj & (~1));
11646 obj_conv.is_owned = false;
11647 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11648 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11649 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11650 CVec_u8Z_free(arg_var);
11654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11655 LDKu8slice ser_ref;
11656 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11657 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11658 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11659 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11660 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11661 long ret_ref = (long)ret_var.inner;
11662 if (ret_var.is_owned) {
11665 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11669 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11671 obj_conv.inner = (void*)(obj & (~1));
11672 obj_conv.is_owned = false;
11673 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11674 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11675 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11676 CVec_u8Z_free(arg_var);
11680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11681 LDKu8slice ser_ref;
11682 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11683 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11684 LDKInit ret_var = Init_read(ser_ref);
11685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11687 long ret_ref = (long)ret_var.inner;
11688 if (ret_var.is_owned) {
11691 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11695 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11696 LDKOpenChannel obj_conv;
11697 obj_conv.inner = (void*)(obj & (~1));
11698 obj_conv.is_owned = false;
11699 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11700 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11701 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11702 CVec_u8Z_free(arg_var);
11706 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11707 LDKu8slice ser_ref;
11708 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11709 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11710 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11711 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11712 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11713 long ret_ref = (long)ret_var.inner;
11714 if (ret_var.is_owned) {
11717 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11721 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11722 LDKRevokeAndACK obj_conv;
11723 obj_conv.inner = (void*)(obj & (~1));
11724 obj_conv.is_owned = false;
11725 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11726 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11727 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11728 CVec_u8Z_free(arg_var);
11732 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11733 LDKu8slice ser_ref;
11734 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11735 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11736 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11737 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11738 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11739 long ret_ref = (long)ret_var.inner;
11740 if (ret_var.is_owned) {
11743 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11747 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11748 LDKShutdown obj_conv;
11749 obj_conv.inner = (void*)(obj & (~1));
11750 obj_conv.is_owned = false;
11751 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11752 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11753 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11754 CVec_u8Z_free(arg_var);
11758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11759 LDKu8slice ser_ref;
11760 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11761 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11762 LDKShutdown ret_var = Shutdown_read(ser_ref);
11763 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11764 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11765 long ret_ref = (long)ret_var.inner;
11766 if (ret_var.is_owned) {
11769 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11773 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11774 LDKUpdateFailHTLC obj_conv;
11775 obj_conv.inner = (void*)(obj & (~1));
11776 obj_conv.is_owned = false;
11777 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11778 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11779 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11780 CVec_u8Z_free(arg_var);
11784 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11785 LDKu8slice ser_ref;
11786 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11787 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11788 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11789 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11790 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11791 long ret_ref = (long)ret_var.inner;
11792 if (ret_var.is_owned) {
11795 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11799 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11800 LDKUpdateFailMalformedHTLC obj_conv;
11801 obj_conv.inner = (void*)(obj & (~1));
11802 obj_conv.is_owned = false;
11803 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11804 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11805 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11806 CVec_u8Z_free(arg_var);
11810 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11811 LDKu8slice ser_ref;
11812 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11813 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11814 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11815 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11816 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11817 long ret_ref = (long)ret_var.inner;
11818 if (ret_var.is_owned) {
11821 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11825 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11826 LDKUpdateFee obj_conv;
11827 obj_conv.inner = (void*)(obj & (~1));
11828 obj_conv.is_owned = false;
11829 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11830 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11831 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11832 CVec_u8Z_free(arg_var);
11836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11837 LDKu8slice ser_ref;
11838 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11839 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11840 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11841 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11842 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11843 long ret_ref = (long)ret_var.inner;
11844 if (ret_var.is_owned) {
11847 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11851 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11852 LDKUpdateFulfillHTLC obj_conv;
11853 obj_conv.inner = (void*)(obj & (~1));
11854 obj_conv.is_owned = false;
11855 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11856 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11857 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11858 CVec_u8Z_free(arg_var);
11862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11863 LDKu8slice ser_ref;
11864 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11865 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11866 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11867 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11868 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11869 long ret_ref = (long)ret_var.inner;
11870 if (ret_var.is_owned) {
11873 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11877 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11878 LDKUpdateAddHTLC obj_conv;
11879 obj_conv.inner = (void*)(obj & (~1));
11880 obj_conv.is_owned = false;
11881 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11882 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11883 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11884 CVec_u8Z_free(arg_var);
11888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11889 LDKu8slice ser_ref;
11890 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11891 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11892 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11893 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11894 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11895 long ret_ref = (long)ret_var.inner;
11896 if (ret_var.is_owned) {
11899 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11903 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11905 obj_conv.inner = (void*)(obj & (~1));
11906 obj_conv.is_owned = false;
11907 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11908 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11909 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11910 CVec_u8Z_free(arg_var);
11914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11915 LDKu8slice ser_ref;
11916 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11917 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11918 LDKPing ret_var = Ping_read(ser_ref);
11919 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11920 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11921 long ret_ref = (long)ret_var.inner;
11922 if (ret_var.is_owned) {
11925 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11929 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11931 obj_conv.inner = (void*)(obj & (~1));
11932 obj_conv.is_owned = false;
11933 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11934 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11935 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11936 CVec_u8Z_free(arg_var);
11940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11941 LDKu8slice ser_ref;
11942 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11943 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11944 LDKPong ret_var = Pong_read(ser_ref);
11945 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11946 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11947 long ret_ref = (long)ret_var.inner;
11948 if (ret_var.is_owned) {
11951 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11955 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11956 LDKUnsignedChannelAnnouncement obj_conv;
11957 obj_conv.inner = (void*)(obj & (~1));
11958 obj_conv.is_owned = false;
11959 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11960 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11961 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11962 CVec_u8Z_free(arg_var);
11966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11967 LDKu8slice ser_ref;
11968 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11969 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11970 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11971 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11972 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11973 long ret_ref = (long)ret_var.inner;
11974 if (ret_var.is_owned) {
11977 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11981 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11982 LDKChannelAnnouncement obj_conv;
11983 obj_conv.inner = (void*)(obj & (~1));
11984 obj_conv.is_owned = false;
11985 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11986 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11987 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11988 CVec_u8Z_free(arg_var);
11992 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11993 LDKu8slice ser_ref;
11994 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11995 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11996 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11997 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11998 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11999 long ret_ref = (long)ret_var.inner;
12000 if (ret_var.is_owned) {
12003 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12007 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
12008 LDKUnsignedChannelUpdate obj_conv;
12009 obj_conv.inner = (void*)(obj & (~1));
12010 obj_conv.is_owned = false;
12011 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
12012 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12013 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12014 CVec_u8Z_free(arg_var);
12018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12019 LDKu8slice ser_ref;
12020 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12021 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12022 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
12023 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12024 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12025 long ret_ref = (long)ret_var.inner;
12026 if (ret_var.is_owned) {
12029 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12033 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
12034 LDKChannelUpdate obj_conv;
12035 obj_conv.inner = (void*)(obj & (~1));
12036 obj_conv.is_owned = false;
12037 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
12038 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12039 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12040 CVec_u8Z_free(arg_var);
12044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12045 LDKu8slice ser_ref;
12046 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12047 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12048 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
12049 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12050 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12051 long ret_ref = (long)ret_var.inner;
12052 if (ret_var.is_owned) {
12055 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12059 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
12060 LDKErrorMessage obj_conv;
12061 obj_conv.inner = (void*)(obj & (~1));
12062 obj_conv.is_owned = false;
12063 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
12064 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12065 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12066 CVec_u8Z_free(arg_var);
12070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12071 LDKu8slice ser_ref;
12072 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12073 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12074 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
12075 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12076 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12077 long ret_ref = (long)ret_var.inner;
12078 if (ret_var.is_owned) {
12081 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12085 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
12086 LDKUnsignedNodeAnnouncement obj_conv;
12087 obj_conv.inner = (void*)(obj & (~1));
12088 obj_conv.is_owned = false;
12089 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
12090 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12091 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12092 CVec_u8Z_free(arg_var);
12096 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12097 LDKu8slice ser_ref;
12098 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12099 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12100 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
12101 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12102 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12103 long ret_ref = (long)ret_var.inner;
12104 if (ret_var.is_owned) {
12107 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12111 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
12112 LDKNodeAnnouncement obj_conv;
12113 obj_conv.inner = (void*)(obj & (~1));
12114 obj_conv.is_owned = false;
12115 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12116 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12117 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12118 CVec_u8Z_free(arg_var);
12122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12123 LDKu8slice ser_ref;
12124 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12125 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12126 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12127 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12128 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12129 long ret_ref = (long)ret_var.inner;
12130 if (ret_var.is_owned) {
12133 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12138 LDKu8slice ser_ref;
12139 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12140 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12141 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
12142 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12143 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12144 long ret_ref = (long)ret_var.inner;
12145 if (ret_var.is_owned) {
12148 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12152 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
12153 LDKQueryShortChannelIds obj_conv;
12154 obj_conv.inner = (void*)(obj & (~1));
12155 obj_conv.is_owned = false;
12156 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
12157 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12158 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12159 CVec_u8Z_free(arg_var);
12163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12164 LDKu8slice ser_ref;
12165 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12166 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12167 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
12168 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12169 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12170 long ret_ref = (long)ret_var.inner;
12171 if (ret_var.is_owned) {
12174 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12178 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
12179 LDKReplyShortChannelIdsEnd obj_conv;
12180 obj_conv.inner = (void*)(obj & (~1));
12181 obj_conv.is_owned = false;
12182 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
12183 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12184 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12185 CVec_u8Z_free(arg_var);
12189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12190 LDKu8slice ser_ref;
12191 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12192 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12193 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
12194 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12195 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12196 long ret_ref = (long)ret_var.inner;
12197 if (ret_var.is_owned) {
12200 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12204 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12205 LDKQueryChannelRange obj_conv;
12206 obj_conv.inner = (void*)(obj & (~1));
12207 obj_conv.is_owned = false;
12208 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
12209 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12210 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12211 CVec_u8Z_free(arg_var);
12215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12216 LDKu8slice ser_ref;
12217 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12218 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12219 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
12220 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12221 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12222 long ret_ref = (long)ret_var.inner;
12223 if (ret_var.is_owned) {
12226 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12230 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12231 LDKReplyChannelRange obj_conv;
12232 obj_conv.inner = (void*)(obj & (~1));
12233 obj_conv.is_owned = false;
12234 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
12235 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12236 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12237 CVec_u8Z_free(arg_var);
12241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12242 LDKu8slice ser_ref;
12243 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12244 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12245 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
12246 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12247 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12248 long ret_ref = (long)ret_var.inner;
12249 if (ret_var.is_owned) {
12252 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12256 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
12257 LDKGossipTimestampFilter obj_conv;
12258 obj_conv.inner = (void*)(obj & (~1));
12259 obj_conv.is_owned = false;
12260 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
12261 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12262 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12263 CVec_u8Z_free(arg_var);
12267 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12268 LDKMessageHandler this_ptr_conv;
12269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12271 MessageHandler_free(this_ptr_conv);
12274 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12275 LDKMessageHandler this_ptr_conv;
12276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12277 this_ptr_conv.is_owned = false;
12278 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12283 LDKMessageHandler this_ptr_conv;
12284 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12285 this_ptr_conv.is_owned = false;
12286 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12287 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12288 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12289 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12291 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12295 LDKMessageHandler this_ptr_conv;
12296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12297 this_ptr_conv.is_owned = false;
12298 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12303 LDKMessageHandler this_ptr_conv;
12304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12305 this_ptr_conv.is_owned = false;
12306 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12307 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12308 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12309 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12311 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12314 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12315 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12316 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12317 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12318 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12320 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12321 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12322 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12323 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12325 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12326 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12327 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12328 long ret_ref = (long)ret_var.inner;
12329 if (ret_var.is_owned) {
12335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12336 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
12337 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12338 *ret = SocketDescriptor_clone(orig_conv);
12342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12343 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12344 FREE((void*)this_ptr);
12345 SocketDescriptor_free(this_ptr_conv);
12348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12349 LDKPeerHandleError this_ptr_conv;
12350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12352 PeerHandleError_free(this_ptr_conv);
12355 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
12356 LDKPeerHandleError this_ptr_conv;
12357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12358 this_ptr_conv.is_owned = false;
12359 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12364 LDKPeerHandleError this_ptr_conv;
12365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12366 this_ptr_conv.is_owned = false;
12367 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12370 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12371 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12372 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12373 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12374 long ret_ref = (long)ret_var.inner;
12375 if (ret_var.is_owned) {
12381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12382 LDKPeerManager this_ptr_conv;
12383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12385 PeerManager_free(this_ptr_conv);
12388 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) {
12389 LDKMessageHandler message_handler_conv;
12390 message_handler_conv.inner = (void*)(message_handler & (~1));
12391 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12392 // Warning: we may need a move here but can't clone!
12393 LDKSecretKey our_node_secret_ref;
12394 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12395 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12396 unsigned char ephemeral_random_data_arr[32];
12397 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12398 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12399 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12400 LDKLogger logger_conv = *(LDKLogger*)logger;
12401 if (logger_conv.free == LDKLogger_JCalls_free) {
12402 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12403 LDKLogger_JCalls_clone(logger_conv.this_arg);
12405 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12406 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12407 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12408 long ret_ref = (long)ret_var.inner;
12409 if (ret_var.is_owned) {
12415 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12416 LDKPeerManager this_arg_conv;
12417 this_arg_conv.inner = (void*)(this_arg & (~1));
12418 this_arg_conv.is_owned = false;
12419 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12420 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
12421 for (size_t i = 0; i < ret_var.datalen; i++) {
12422 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12423 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12424 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12426 CVec_PublicKeyZ_free(ret_var);
12430 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) {
12431 LDKPeerManager this_arg_conv;
12432 this_arg_conv.inner = (void*)(this_arg & (~1));
12433 this_arg_conv.is_owned = false;
12434 LDKPublicKey their_node_id_ref;
12435 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12436 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12437 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12438 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12439 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12440 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12442 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12443 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12444 return (long)ret_conv;
12447 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12448 LDKPeerManager this_arg_conv;
12449 this_arg_conv.inner = (void*)(this_arg & (~1));
12450 this_arg_conv.is_owned = false;
12451 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12452 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12453 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12454 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12456 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12457 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12458 return (long)ret_conv;
12461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12462 LDKPeerManager this_arg_conv;
12463 this_arg_conv.inner = (void*)(this_arg & (~1));
12464 this_arg_conv.is_owned = false;
12465 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12466 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12467 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12468 return (long)ret_conv;
12471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12472 LDKPeerManager this_arg_conv;
12473 this_arg_conv.inner = (void*)(this_arg & (~1));
12474 this_arg_conv.is_owned = false;
12475 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12476 LDKu8slice data_ref;
12477 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12478 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12479 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12480 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12481 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12482 return (long)ret_conv;
12485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12486 LDKPeerManager this_arg_conv;
12487 this_arg_conv.inner = (void*)(this_arg & (~1));
12488 this_arg_conv.is_owned = false;
12489 PeerManager_process_events(&this_arg_conv);
12492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12493 LDKPeerManager this_arg_conv;
12494 this_arg_conv.inner = (void*)(this_arg & (~1));
12495 this_arg_conv.is_owned = false;
12496 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12497 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12501 LDKPeerManager this_arg_conv;
12502 this_arg_conv.inner = (void*)(this_arg & (~1));
12503 this_arg_conv.is_owned = false;
12504 PeerManager_timer_tick_occured(&this_arg_conv);
12507 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12508 unsigned char commitment_seed_arr[32];
12509 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12510 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12511 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12512 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12513 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12518 LDKPublicKey per_commitment_point_ref;
12519 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12520 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12521 unsigned char base_secret_arr[32];
12522 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12523 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12524 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12525 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12526 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12527 return (long)ret_conv;
12530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12531 LDKPublicKey per_commitment_point_ref;
12532 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12533 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12534 LDKPublicKey base_point_ref;
12535 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12536 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12537 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12538 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12539 return (long)ret_conv;
12542 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) {
12543 unsigned char per_commitment_secret_arr[32];
12544 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12545 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12546 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12547 unsigned char countersignatory_revocation_base_secret_arr[32];
12548 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12549 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12550 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12551 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12552 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12553 return (long)ret_conv;
12556 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) {
12557 LDKPublicKey per_commitment_point_ref;
12558 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12559 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12560 LDKPublicKey countersignatory_revocation_base_point_ref;
12561 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12562 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12563 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12564 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12565 return (long)ret_conv;
12568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12569 LDKTxCreationKeys this_ptr_conv;
12570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12572 TxCreationKeys_free(this_ptr_conv);
12575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12576 LDKTxCreationKeys orig_conv;
12577 orig_conv.inner = (void*)(orig & (~1));
12578 orig_conv.is_owned = false;
12579 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12582 long ret_ref = (long)ret_var.inner;
12583 if (ret_var.is_owned) {
12589 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12590 LDKTxCreationKeys this_ptr_conv;
12591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12592 this_ptr_conv.is_owned = false;
12593 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12594 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12599 LDKTxCreationKeys this_ptr_conv;
12600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12601 this_ptr_conv.is_owned = false;
12602 LDKPublicKey val_ref;
12603 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12604 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12605 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12608 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12609 LDKTxCreationKeys this_ptr_conv;
12610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12611 this_ptr_conv.is_owned = false;
12612 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12613 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12618 LDKTxCreationKeys this_ptr_conv;
12619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12620 this_ptr_conv.is_owned = false;
12621 LDKPublicKey val_ref;
12622 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12623 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12624 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12627 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12628 LDKTxCreationKeys this_ptr_conv;
12629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12630 this_ptr_conv.is_owned = false;
12631 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12632 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12637 LDKTxCreationKeys this_ptr_conv;
12638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12639 this_ptr_conv.is_owned = false;
12640 LDKPublicKey val_ref;
12641 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12642 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12643 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12646 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12647 LDKTxCreationKeys this_ptr_conv;
12648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12649 this_ptr_conv.is_owned = false;
12650 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12651 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12656 LDKTxCreationKeys this_ptr_conv;
12657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12658 this_ptr_conv.is_owned = false;
12659 LDKPublicKey val_ref;
12660 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12661 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12662 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12665 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12666 LDKTxCreationKeys this_ptr_conv;
12667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12668 this_ptr_conv.is_owned = false;
12669 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12670 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12675 LDKTxCreationKeys this_ptr_conv;
12676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12677 this_ptr_conv.is_owned = false;
12678 LDKPublicKey val_ref;
12679 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12680 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12681 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12684 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) {
12685 LDKPublicKey per_commitment_point_arg_ref;
12686 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12687 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12688 LDKPublicKey revocation_key_arg_ref;
12689 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12690 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12691 LDKPublicKey broadcaster_htlc_key_arg_ref;
12692 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12693 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12694 LDKPublicKey countersignatory_htlc_key_arg_ref;
12695 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12696 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12697 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12698 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12699 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12700 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);
12701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12703 long ret_ref = (long)ret_var.inner;
12704 if (ret_var.is_owned) {
12710 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12711 LDKTxCreationKeys obj_conv;
12712 obj_conv.inner = (void*)(obj & (~1));
12713 obj_conv.is_owned = false;
12714 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12715 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12716 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12717 CVec_u8Z_free(arg_var);
12721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12722 LDKu8slice ser_ref;
12723 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12724 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12725 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12726 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12727 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12728 long ret_ref = (long)ret_var.inner;
12729 if (ret_var.is_owned) {
12732 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12737 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12739 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12740 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12744 LDKPreCalculatedTxCreationKeys orig_conv;
12745 orig_conv.inner = (void*)(orig & (~1));
12746 orig_conv.is_owned = false;
12747 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_clone(&orig_conv);
12748 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12749 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12750 long ret_ref = (long)ret_var.inner;
12751 if (ret_var.is_owned) {
12757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12758 LDKTxCreationKeys keys_conv;
12759 keys_conv.inner = (void*)(keys & (~1));
12760 keys_conv.is_owned = (keys & 1) || (keys == 0);
12761 if (keys_conv.inner != NULL)
12762 keys_conv = TxCreationKeys_clone(&keys_conv);
12763 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12764 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12765 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12766 long ret_ref = (long)ret_var.inner;
12767 if (ret_var.is_owned) {
12773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12774 LDKPreCalculatedTxCreationKeys this_arg_conv;
12775 this_arg_conv.inner = (void*)(this_arg & (~1));
12776 this_arg_conv.is_owned = false;
12777 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12780 long ret_ref = (long)ret_var.inner;
12781 if (ret_var.is_owned) {
12787 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12788 LDKPreCalculatedTxCreationKeys this_arg_conv;
12789 this_arg_conv.inner = (void*)(this_arg & (~1));
12790 this_arg_conv.is_owned = false;
12791 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12792 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12797 LDKChannelPublicKeys this_ptr_conv;
12798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12800 ChannelPublicKeys_free(this_ptr_conv);
12803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12804 LDKChannelPublicKeys orig_conv;
12805 orig_conv.inner = (void*)(orig & (~1));
12806 orig_conv.is_owned = false;
12807 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12808 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12809 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12810 long ret_ref = (long)ret_var.inner;
12811 if (ret_var.is_owned) {
12817 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12818 LDKChannelPublicKeys this_ptr_conv;
12819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12820 this_ptr_conv.is_owned = false;
12821 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12822 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12827 LDKChannelPublicKeys this_ptr_conv;
12828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12829 this_ptr_conv.is_owned = false;
12830 LDKPublicKey val_ref;
12831 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12832 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12833 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12836 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12837 LDKChannelPublicKeys this_ptr_conv;
12838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12839 this_ptr_conv.is_owned = false;
12840 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12841 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12846 LDKChannelPublicKeys this_ptr_conv;
12847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12848 this_ptr_conv.is_owned = false;
12849 LDKPublicKey val_ref;
12850 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12851 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12852 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12855 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12856 LDKChannelPublicKeys this_ptr_conv;
12857 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12858 this_ptr_conv.is_owned = false;
12859 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12860 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12865 LDKChannelPublicKeys this_ptr_conv;
12866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12867 this_ptr_conv.is_owned = false;
12868 LDKPublicKey val_ref;
12869 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12870 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12871 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12874 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12875 LDKChannelPublicKeys this_ptr_conv;
12876 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12877 this_ptr_conv.is_owned = false;
12878 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12879 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12884 LDKChannelPublicKeys this_ptr_conv;
12885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12886 this_ptr_conv.is_owned = false;
12887 LDKPublicKey val_ref;
12888 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12889 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12890 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12893 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12894 LDKChannelPublicKeys this_ptr_conv;
12895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12896 this_ptr_conv.is_owned = false;
12897 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12898 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12903 LDKChannelPublicKeys this_ptr_conv;
12904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12905 this_ptr_conv.is_owned = false;
12906 LDKPublicKey val_ref;
12907 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12908 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12909 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12912 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) {
12913 LDKPublicKey funding_pubkey_arg_ref;
12914 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12915 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12916 LDKPublicKey revocation_basepoint_arg_ref;
12917 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12918 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12919 LDKPublicKey payment_point_arg_ref;
12920 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12921 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12922 LDKPublicKey delayed_payment_basepoint_arg_ref;
12923 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12924 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12925 LDKPublicKey htlc_basepoint_arg_ref;
12926 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12927 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12928 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);
12929 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12930 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12931 long ret_ref = (long)ret_var.inner;
12932 if (ret_var.is_owned) {
12938 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12939 LDKChannelPublicKeys obj_conv;
12940 obj_conv.inner = (void*)(obj & (~1));
12941 obj_conv.is_owned = false;
12942 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12943 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12944 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12945 CVec_u8Z_free(arg_var);
12949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12950 LDKu8slice ser_ref;
12951 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12952 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12953 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12954 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12955 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12956 long ret_ref = (long)ret_var.inner;
12957 if (ret_var.is_owned) {
12960 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12964 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) {
12965 LDKPublicKey per_commitment_point_ref;
12966 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12967 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12968 LDKPublicKey broadcaster_delayed_payment_base_ref;
12969 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12970 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12971 LDKPublicKey broadcaster_htlc_base_ref;
12972 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12973 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12974 LDKPublicKey countersignatory_revocation_base_ref;
12975 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12976 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12977 LDKPublicKey countersignatory_htlc_base_ref;
12978 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12979 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12980 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12981 *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);
12982 return (long)ret_conv;
12985 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) {
12986 LDKPublicKey revocation_key_ref;
12987 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12988 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12989 LDKPublicKey broadcaster_delayed_payment_key_ref;
12990 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12991 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12992 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12993 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12994 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12995 CVec_u8Z_free(arg_var);
12999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13000 LDKHTLCOutputInCommitment this_ptr_conv;
13001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13003 HTLCOutputInCommitment_free(this_ptr_conv);
13006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13007 LDKHTLCOutputInCommitment orig_conv;
13008 orig_conv.inner = (void*)(orig & (~1));
13009 orig_conv.is_owned = false;
13010 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
13011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13013 long ret_ref = (long)ret_var.inner;
13014 if (ret_var.is_owned) {
13020 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
13021 LDKHTLCOutputInCommitment this_ptr_conv;
13022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13023 this_ptr_conv.is_owned = false;
13024 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
13028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13029 LDKHTLCOutputInCommitment this_ptr_conv;
13030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13031 this_ptr_conv.is_owned = false;
13032 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
13035 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13036 LDKHTLCOutputInCommitment this_ptr_conv;
13037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13038 this_ptr_conv.is_owned = false;
13039 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
13043 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13044 LDKHTLCOutputInCommitment this_ptr_conv;
13045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13046 this_ptr_conv.is_owned = false;
13047 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
13050 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
13051 LDKHTLCOutputInCommitment this_ptr_conv;
13052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13053 this_ptr_conv.is_owned = false;
13054 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
13058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13059 LDKHTLCOutputInCommitment this_ptr_conv;
13060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13061 this_ptr_conv.is_owned = false;
13062 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
13065 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
13066 LDKHTLCOutputInCommitment this_ptr_conv;
13067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13068 this_ptr_conv.is_owned = false;
13069 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
13070 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
13074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13075 LDKHTLCOutputInCommitment this_ptr_conv;
13076 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13077 this_ptr_conv.is_owned = false;
13078 LDKThirtyTwoBytes val_ref;
13079 CHECK((*_env)->GetArrayLength (_env, val) == 32);
13080 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
13081 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
13084 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
13085 LDKHTLCOutputInCommitment obj_conv;
13086 obj_conv.inner = (void*)(obj & (~1));
13087 obj_conv.is_owned = false;
13088 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
13089 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13090 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13091 CVec_u8Z_free(arg_var);
13095 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13096 LDKu8slice ser_ref;
13097 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13098 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13099 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
13100 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13101 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13102 long ret_ref = (long)ret_var.inner;
13103 if (ret_var.is_owned) {
13106 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13110 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
13111 LDKHTLCOutputInCommitment htlc_conv;
13112 htlc_conv.inner = (void*)(htlc & (~1));
13113 htlc_conv.is_owned = false;
13114 LDKTxCreationKeys keys_conv;
13115 keys_conv.inner = (void*)(keys & (~1));
13116 keys_conv.is_owned = false;
13117 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
13118 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13119 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13120 CVec_u8Z_free(arg_var);
13124 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
13125 LDKPublicKey broadcaster_ref;
13126 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
13127 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
13128 LDKPublicKey countersignatory_ref;
13129 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
13130 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
13131 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13132 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13133 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13134 CVec_u8Z_free(arg_var);
13138 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) {
13139 unsigned char prev_hash_arr[32];
13140 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
13141 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
13142 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13143 LDKHTLCOutputInCommitment htlc_conv;
13144 htlc_conv.inner = (void*)(htlc & (~1));
13145 htlc_conv.is_owned = false;
13146 LDKPublicKey broadcaster_delayed_payment_key_ref;
13147 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
13148 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
13149 LDKPublicKey revocation_key_ref;
13150 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
13151 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
13152 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13153 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13154 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13155 Transaction_free(arg_var);
13159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13160 LDKHolderCommitmentTransaction this_ptr_conv;
13161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13162 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13163 HolderCommitmentTransaction_free(this_ptr_conv);
13166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13167 LDKHolderCommitmentTransaction orig_conv;
13168 orig_conv.inner = (void*)(orig & (~1));
13169 orig_conv.is_owned = false;
13170 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13171 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13172 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13173 long ret_ref = (long)ret_var.inner;
13174 if (ret_var.is_owned) {
13180 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
13181 LDKHolderCommitmentTransaction this_ptr_conv;
13182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13183 this_ptr_conv.is_owned = false;
13184 LDKTransaction arg_var = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
13185 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13186 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13187 Transaction_free(arg_var);
13191 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13192 LDKHolderCommitmentTransaction this_ptr_conv;
13193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13194 this_ptr_conv.is_owned = false;
13195 LDKTransaction val_ref;
13196 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
13197 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
13198 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
13199 val_ref.data_is_owned = true;
13200 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_ref);
13203 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
13204 LDKHolderCommitmentTransaction this_ptr_conv;
13205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13206 this_ptr_conv.is_owned = false;
13207 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13208 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
13212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13213 LDKHolderCommitmentTransaction this_ptr_conv;
13214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13215 this_ptr_conv.is_owned = false;
13216 LDKSignature val_ref;
13217 CHECK((*_env)->GetArrayLength (_env, val) == 64);
13218 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
13219 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
13222 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
13223 LDKHolderCommitmentTransaction this_ptr_conv;
13224 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13225 this_ptr_conv.is_owned = false;
13226 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
13230 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13231 LDKHolderCommitmentTransaction this_ptr_conv;
13232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13233 this_ptr_conv.is_owned = false;
13234 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
13237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13238 LDKHolderCommitmentTransaction this_ptr_conv;
13239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13240 this_ptr_conv.is_owned = false;
13241 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
13242 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13243 if (val_constr.datalen > 0)
13244 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13246 val_constr.data = NULL;
13247 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13248 for (size_t q = 0; q < val_constr.datalen; q++) {
13249 long arr_conv_42 = val_vals[q];
13250 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13251 FREE((void*)arr_conv_42);
13252 val_constr.data[q] = arr_conv_42_conv;
13254 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13255 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
13258 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) {
13259 LDKTransaction unsigned_tx_ref;
13260 unsigned_tx_ref.datalen = (*_env)->GetArrayLength (_env, unsigned_tx);
13261 unsigned_tx_ref.data = MALLOC(unsigned_tx_ref.datalen, "LDKTransaction Bytes");
13262 (*_env)->GetByteArrayRegion(_env, unsigned_tx, 0, unsigned_tx_ref.datalen, unsigned_tx_ref.data);
13263 unsigned_tx_ref.data_is_owned = true;
13264 LDKSignature counterparty_sig_ref;
13265 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
13266 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
13267 LDKPublicKey holder_funding_key_ref;
13268 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
13269 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
13270 LDKPublicKey counterparty_funding_key_ref;
13271 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
13272 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
13273 LDKTxCreationKeys keys_conv;
13274 keys_conv.inner = (void*)(keys & (~1));
13275 keys_conv.is_owned = (keys & 1) || (keys == 0);
13276 if (keys_conv.inner != NULL)
13277 keys_conv = TxCreationKeys_clone(&keys_conv);
13278 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
13279 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
13280 if (htlc_data_constr.datalen > 0)
13281 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13283 htlc_data_constr.data = NULL;
13284 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
13285 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
13286 long arr_conv_42 = htlc_data_vals[q];
13287 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13288 FREE((void*)arr_conv_42);
13289 htlc_data_constr.data[q] = arr_conv_42_conv;
13291 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
13292 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);
13293 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13294 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13295 long ret_ref = (long)ret_var.inner;
13296 if (ret_var.is_owned) {
13302 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13303 LDKHolderCommitmentTransaction this_arg_conv;
13304 this_arg_conv.inner = (void*)(this_arg & (~1));
13305 this_arg_conv.is_owned = false;
13306 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13307 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13308 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13309 long ret_ref = (long)ret_var.inner;
13310 if (ret_var.is_owned) {
13316 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13317 LDKHolderCommitmentTransaction this_arg_conv;
13318 this_arg_conv.inner = (void*)(this_arg & (~1));
13319 this_arg_conv.is_owned = false;
13320 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13321 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13325 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) {
13326 LDKHolderCommitmentTransaction this_arg_conv;
13327 this_arg_conv.inner = (void*)(this_arg & (~1));
13328 this_arg_conv.is_owned = false;
13329 unsigned char funding_key_arr[32];
13330 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13331 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13332 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13333 LDKu8slice funding_redeemscript_ref;
13334 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13335 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13336 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13337 (*_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);
13338 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13342 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) {
13343 LDKHolderCommitmentTransaction this_arg_conv;
13344 this_arg_conv.inner = (void*)(this_arg & (~1));
13345 this_arg_conv.is_owned = false;
13346 unsigned char htlc_base_key_arr[32];
13347 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13348 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13349 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13350 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13351 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13352 return (long)ret_conv;
13355 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
13356 LDKHolderCommitmentTransaction obj_conv;
13357 obj_conv.inner = (void*)(obj & (~1));
13358 obj_conv.is_owned = false;
13359 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
13360 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13361 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13362 CVec_u8Z_free(arg_var);
13366 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13367 LDKu8slice ser_ref;
13368 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13369 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13370 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13371 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13372 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13373 long ret_ref = (long)ret_var.inner;
13374 if (ret_var.is_owned) {
13377 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13382 LDKInitFeatures this_ptr_conv;
13383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13385 InitFeatures_free(this_ptr_conv);
13388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13389 LDKNodeFeatures this_ptr_conv;
13390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13392 NodeFeatures_free(this_ptr_conv);
13395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13396 LDKChannelFeatures this_ptr_conv;
13397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13399 ChannelFeatures_free(this_ptr_conv);
13402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13403 LDKRouteHop this_ptr_conv;
13404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13406 RouteHop_free(this_ptr_conv);
13409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13410 LDKRouteHop orig_conv;
13411 orig_conv.inner = (void*)(orig & (~1));
13412 orig_conv.is_owned = false;
13413 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13414 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13415 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13416 long ret_ref = (long)ret_var.inner;
13417 if (ret_var.is_owned) {
13423 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13424 LDKRouteHop this_ptr_conv;
13425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13426 this_ptr_conv.is_owned = false;
13427 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13428 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13433 LDKRouteHop this_ptr_conv;
13434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13435 this_ptr_conv.is_owned = false;
13436 LDKPublicKey val_ref;
13437 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13438 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13439 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13443 LDKRouteHop this_ptr_conv;
13444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13445 this_ptr_conv.is_owned = false;
13446 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13447 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13448 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13449 long ret_ref = (long)ret_var.inner;
13450 if (ret_var.is_owned) {
13456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13457 LDKRouteHop this_ptr_conv;
13458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13459 this_ptr_conv.is_owned = false;
13460 LDKNodeFeatures val_conv;
13461 val_conv.inner = (void*)(val & (~1));
13462 val_conv.is_owned = (val & 1) || (val == 0);
13463 // Warning: we may need a move here but can't clone!
13464 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13468 LDKRouteHop this_ptr_conv;
13469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13470 this_ptr_conv.is_owned = false;
13471 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13476 LDKRouteHop this_ptr_conv;
13477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13478 this_ptr_conv.is_owned = false;
13479 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13483 LDKRouteHop this_ptr_conv;
13484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13485 this_ptr_conv.is_owned = false;
13486 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13489 long ret_ref = (long)ret_var.inner;
13490 if (ret_var.is_owned) {
13496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13497 LDKRouteHop this_ptr_conv;
13498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13499 this_ptr_conv.is_owned = false;
13500 LDKChannelFeatures val_conv;
13501 val_conv.inner = (void*)(val & (~1));
13502 val_conv.is_owned = (val & 1) || (val == 0);
13503 // Warning: we may need a move here but can't clone!
13504 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13507 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13508 LDKRouteHop this_ptr_conv;
13509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13510 this_ptr_conv.is_owned = false;
13511 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13516 LDKRouteHop this_ptr_conv;
13517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13518 this_ptr_conv.is_owned = false;
13519 RouteHop_set_fee_msat(&this_ptr_conv, val);
13522 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13523 LDKRouteHop this_ptr_conv;
13524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13525 this_ptr_conv.is_owned = false;
13526 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13531 LDKRouteHop this_ptr_conv;
13532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13533 this_ptr_conv.is_owned = false;
13534 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13537 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) {
13538 LDKPublicKey pubkey_arg_ref;
13539 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13540 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13541 LDKNodeFeatures node_features_arg_conv;
13542 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13543 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13544 // Warning: we may need a move here but can't clone!
13545 LDKChannelFeatures channel_features_arg_conv;
13546 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13547 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13548 // Warning: we may need a move here but can't clone!
13549 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);
13550 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13551 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13552 long ret_ref = (long)ret_var.inner;
13553 if (ret_var.is_owned) {
13559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13560 LDKRoute this_ptr_conv;
13561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13563 Route_free(this_ptr_conv);
13566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13567 LDKRoute orig_conv;
13568 orig_conv.inner = (void*)(orig & (~1));
13569 orig_conv.is_owned = false;
13570 LDKRoute ret_var = Route_clone(&orig_conv);
13571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13573 long ret_ref = (long)ret_var.inner;
13574 if (ret_var.is_owned) {
13580 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13581 LDKRoute this_ptr_conv;
13582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13583 this_ptr_conv.is_owned = false;
13584 LDKCVec_CVec_RouteHopZZ val_constr;
13585 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13586 if (val_constr.datalen > 0)
13587 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13589 val_constr.data = NULL;
13590 for (size_t m = 0; m < val_constr.datalen; m++) {
13591 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13592 LDKCVec_RouteHopZ arr_conv_12_constr;
13593 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13594 if (arr_conv_12_constr.datalen > 0)
13595 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13597 arr_conv_12_constr.data = NULL;
13598 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13599 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13600 long arr_conv_10 = arr_conv_12_vals[k];
13601 LDKRouteHop arr_conv_10_conv;
13602 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13603 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13604 if (arr_conv_10_conv.inner != NULL)
13605 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13606 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13608 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13609 val_constr.data[m] = arr_conv_12_constr;
13611 Route_set_paths(&this_ptr_conv, val_constr);
13614 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13615 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13616 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13617 if (paths_arg_constr.datalen > 0)
13618 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13620 paths_arg_constr.data = NULL;
13621 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13622 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13623 LDKCVec_RouteHopZ arr_conv_12_constr;
13624 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13625 if (arr_conv_12_constr.datalen > 0)
13626 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13628 arr_conv_12_constr.data = NULL;
13629 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13630 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13631 long arr_conv_10 = arr_conv_12_vals[k];
13632 LDKRouteHop arr_conv_10_conv;
13633 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13634 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13635 if (arr_conv_10_conv.inner != NULL)
13636 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13637 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13639 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13640 paths_arg_constr.data[m] = arr_conv_12_constr;
13642 LDKRoute ret_var = Route_new(paths_arg_constr);
13643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13645 long ret_ref = (long)ret_var.inner;
13646 if (ret_var.is_owned) {
13652 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13654 obj_conv.inner = (void*)(obj & (~1));
13655 obj_conv.is_owned = false;
13656 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13657 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13658 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13659 CVec_u8Z_free(arg_var);
13663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13664 LDKu8slice ser_ref;
13665 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13666 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13667 LDKRoute ret_var = Route_read(ser_ref);
13668 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13669 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13670 long ret_ref = (long)ret_var.inner;
13671 if (ret_var.is_owned) {
13674 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13678 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13679 LDKRouteHint this_ptr_conv;
13680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13682 RouteHint_free(this_ptr_conv);
13685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13686 LDKRouteHint orig_conv;
13687 orig_conv.inner = (void*)(orig & (~1));
13688 orig_conv.is_owned = false;
13689 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13690 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13691 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13692 long ret_ref = (long)ret_var.inner;
13693 if (ret_var.is_owned) {
13699 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13700 LDKRouteHint this_ptr_conv;
13701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13702 this_ptr_conv.is_owned = false;
13703 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13704 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13709 LDKRouteHint this_ptr_conv;
13710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13711 this_ptr_conv.is_owned = false;
13712 LDKPublicKey val_ref;
13713 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13714 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13715 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13719 LDKRouteHint this_ptr_conv;
13720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13721 this_ptr_conv.is_owned = false;
13722 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13727 LDKRouteHint this_ptr_conv;
13728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13729 this_ptr_conv.is_owned = false;
13730 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13734 LDKRouteHint this_ptr_conv;
13735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13736 this_ptr_conv.is_owned = false;
13737 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_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 void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13748 LDKRouteHint this_ptr_conv;
13749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13750 this_ptr_conv.is_owned = false;
13751 LDKRoutingFees val_conv;
13752 val_conv.inner = (void*)(val & (~1));
13753 val_conv.is_owned = (val & 1) || (val == 0);
13754 if (val_conv.inner != NULL)
13755 val_conv = RoutingFees_clone(&val_conv);
13756 RouteHint_set_fees(&this_ptr_conv, val_conv);
13759 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13760 LDKRouteHint this_ptr_conv;
13761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13762 this_ptr_conv.is_owned = false;
13763 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13768 LDKRouteHint this_ptr_conv;
13769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13770 this_ptr_conv.is_owned = false;
13771 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13775 LDKRouteHint this_ptr_conv;
13776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13777 this_ptr_conv.is_owned = false;
13778 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13783 LDKRouteHint this_ptr_conv;
13784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13785 this_ptr_conv.is_owned = false;
13786 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13789 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) {
13790 LDKPublicKey src_node_id_arg_ref;
13791 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13792 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13793 LDKRoutingFees fees_arg_conv;
13794 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13795 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13796 if (fees_arg_conv.inner != NULL)
13797 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13798 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);
13799 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13800 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13801 long ret_ref = (long)ret_var.inner;
13802 if (ret_var.is_owned) {
13808 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) {
13809 LDKPublicKey our_node_id_ref;
13810 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13811 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13812 LDKNetworkGraph network_conv;
13813 network_conv.inner = (void*)(network & (~1));
13814 network_conv.is_owned = false;
13815 LDKPublicKey target_ref;
13816 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13817 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13818 LDKCVec_ChannelDetailsZ first_hops_constr;
13819 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13820 if (first_hops_constr.datalen > 0)
13821 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13823 first_hops_constr.data = NULL;
13824 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13825 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13826 long arr_conv_16 = first_hops_vals[q];
13827 LDKChannelDetails arr_conv_16_conv;
13828 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13829 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13830 first_hops_constr.data[q] = arr_conv_16_conv;
13832 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13833 LDKCVec_RouteHintZ last_hops_constr;
13834 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13835 if (last_hops_constr.datalen > 0)
13836 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13838 last_hops_constr.data = NULL;
13839 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13840 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13841 long arr_conv_11 = last_hops_vals[l];
13842 LDKRouteHint arr_conv_11_conv;
13843 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13844 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13845 if (arr_conv_11_conv.inner != NULL)
13846 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13847 last_hops_constr.data[l] = arr_conv_11_conv;
13849 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13850 LDKLogger logger_conv = *(LDKLogger*)logger;
13851 if (logger_conv.free == LDKLogger_JCalls_free) {
13852 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13853 LDKLogger_JCalls_clone(logger_conv.this_arg);
13855 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13856 *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);
13857 FREE(first_hops_constr.data);
13858 return (long)ret_conv;
13861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13862 LDKNetworkGraph this_ptr_conv;
13863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13865 NetworkGraph_free(this_ptr_conv);
13868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13869 LDKLockedNetworkGraph this_ptr_conv;
13870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13872 LockedNetworkGraph_free(this_ptr_conv);
13875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13876 LDKNetGraphMsgHandler this_ptr_conv;
13877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13879 NetGraphMsgHandler_free(this_ptr_conv);
13882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13883 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13884 LDKLogger logger_conv = *(LDKLogger*)logger;
13885 if (logger_conv.free == LDKLogger_JCalls_free) {
13886 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13887 LDKLogger_JCalls_clone(logger_conv.this_arg);
13889 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13892 long ret_ref = (long)ret_var.inner;
13893 if (ret_var.is_owned) {
13899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13900 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13901 LDKLogger logger_conv = *(LDKLogger*)logger;
13902 if (logger_conv.free == LDKLogger_JCalls_free) {
13903 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13904 LDKLogger_JCalls_clone(logger_conv.this_arg);
13906 LDKNetworkGraph network_graph_conv;
13907 network_graph_conv.inner = (void*)(network_graph & (~1));
13908 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13909 // Warning: we may need a move here but can't clone!
13910 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13911 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13912 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13913 long ret_ref = (long)ret_var.inner;
13914 if (ret_var.is_owned) {
13920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13921 LDKNetGraphMsgHandler this_arg_conv;
13922 this_arg_conv.inner = (void*)(this_arg & (~1));
13923 this_arg_conv.is_owned = false;
13924 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13925 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13926 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13927 long ret_ref = (long)ret_var.inner;
13928 if (ret_var.is_owned) {
13934 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13935 LDKLockedNetworkGraph this_arg_conv;
13936 this_arg_conv.inner = (void*)(this_arg & (~1));
13937 this_arg_conv.is_owned = false;
13938 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13939 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13940 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13941 long ret_ref = (long)ret_var.inner;
13942 if (ret_var.is_owned) {
13948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13949 LDKNetGraphMsgHandler this_arg_conv;
13950 this_arg_conv.inner = (void*)(this_arg & (~1));
13951 this_arg_conv.is_owned = false;
13952 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13953 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13958 LDKDirectionalChannelInfo this_ptr_conv;
13959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13961 DirectionalChannelInfo_free(this_ptr_conv);
13964 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13965 LDKDirectionalChannelInfo this_ptr_conv;
13966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13967 this_ptr_conv.is_owned = false;
13968 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13973 LDKDirectionalChannelInfo this_ptr_conv;
13974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13975 this_ptr_conv.is_owned = false;
13976 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13979 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
13980 LDKDirectionalChannelInfo this_ptr_conv;
13981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13982 this_ptr_conv.is_owned = false;
13983 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13988 LDKDirectionalChannelInfo this_ptr_conv;
13989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13990 this_ptr_conv.is_owned = false;
13991 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13994 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13995 LDKDirectionalChannelInfo this_ptr_conv;
13996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13997 this_ptr_conv.is_owned = false;
13998 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
14002 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
14003 LDKDirectionalChannelInfo this_ptr_conv;
14004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14005 this_ptr_conv.is_owned = false;
14006 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
14009 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14010 LDKDirectionalChannelInfo this_ptr_conv;
14011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14012 this_ptr_conv.is_owned = false;
14013 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
14017 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14018 LDKDirectionalChannelInfo this_ptr_conv;
14019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14020 this_ptr_conv.is_owned = false;
14021 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
14024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14025 LDKDirectionalChannelInfo this_ptr_conv;
14026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14027 this_ptr_conv.is_owned = false;
14028 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
14029 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14030 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14031 long ret_ref = (long)ret_var.inner;
14032 if (ret_var.is_owned) {
14038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14039 LDKDirectionalChannelInfo this_ptr_conv;
14040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14041 this_ptr_conv.is_owned = false;
14042 LDKChannelUpdate val_conv;
14043 val_conv.inner = (void*)(val & (~1));
14044 val_conv.is_owned = (val & 1) || (val == 0);
14045 if (val_conv.inner != NULL)
14046 val_conv = ChannelUpdate_clone(&val_conv);
14047 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
14050 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14051 LDKDirectionalChannelInfo obj_conv;
14052 obj_conv.inner = (void*)(obj & (~1));
14053 obj_conv.is_owned = false;
14054 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
14055 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14056 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14057 CVec_u8Z_free(arg_var);
14061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14062 LDKu8slice ser_ref;
14063 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14064 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14065 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
14066 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14067 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14068 long ret_ref = (long)ret_var.inner;
14069 if (ret_var.is_owned) {
14072 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14077 LDKChannelInfo this_ptr_conv;
14078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14080 ChannelInfo_free(this_ptr_conv);
14083 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14084 LDKChannelInfo this_ptr_conv;
14085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14086 this_ptr_conv.is_owned = false;
14087 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
14088 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14089 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14090 long ret_ref = (long)ret_var.inner;
14091 if (ret_var.is_owned) {
14097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14098 LDKChannelInfo this_ptr_conv;
14099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14100 this_ptr_conv.is_owned = false;
14101 LDKChannelFeatures val_conv;
14102 val_conv.inner = (void*)(val & (~1));
14103 val_conv.is_owned = (val & 1) || (val == 0);
14104 // Warning: we may need a move here but can't clone!
14105 ChannelInfo_set_features(&this_ptr_conv, val_conv);
14108 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14109 LDKChannelInfo this_ptr_conv;
14110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14111 this_ptr_conv.is_owned = false;
14112 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14113 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
14117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14118 LDKChannelInfo this_ptr_conv;
14119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14120 this_ptr_conv.is_owned = false;
14121 LDKPublicKey val_ref;
14122 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14123 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14124 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
14127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14128 LDKChannelInfo this_ptr_conv;
14129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14130 this_ptr_conv.is_owned = false;
14131 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
14132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14134 long ret_ref = (long)ret_var.inner;
14135 if (ret_var.is_owned) {
14141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14142 LDKChannelInfo this_ptr_conv;
14143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14144 this_ptr_conv.is_owned = false;
14145 LDKDirectionalChannelInfo val_conv;
14146 val_conv.inner = (void*)(val & (~1));
14147 val_conv.is_owned = (val & 1) || (val == 0);
14148 // Warning: we may need a move here but can't clone!
14149 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
14152 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14153 LDKChannelInfo this_ptr_conv;
14154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14155 this_ptr_conv.is_owned = false;
14156 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14157 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
14161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14162 LDKChannelInfo this_ptr_conv;
14163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14164 this_ptr_conv.is_owned = false;
14165 LDKPublicKey val_ref;
14166 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14167 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14168 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
14171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14172 LDKChannelInfo this_ptr_conv;
14173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14174 this_ptr_conv.is_owned = false;
14175 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
14176 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14177 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14178 long ret_ref = (long)ret_var.inner;
14179 if (ret_var.is_owned) {
14185 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14186 LDKChannelInfo this_ptr_conv;
14187 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14188 this_ptr_conv.is_owned = false;
14189 LDKDirectionalChannelInfo val_conv;
14190 val_conv.inner = (void*)(val & (~1));
14191 val_conv.is_owned = (val & 1) || (val == 0);
14192 // Warning: we may need a move here but can't clone!
14193 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
14196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14197 LDKChannelInfo this_ptr_conv;
14198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14199 this_ptr_conv.is_owned = false;
14200 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
14201 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14202 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14203 long ret_ref = (long)ret_var.inner;
14204 if (ret_var.is_owned) {
14210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14211 LDKChannelInfo this_ptr_conv;
14212 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14213 this_ptr_conv.is_owned = false;
14214 LDKChannelAnnouncement val_conv;
14215 val_conv.inner = (void*)(val & (~1));
14216 val_conv.is_owned = (val & 1) || (val == 0);
14217 if (val_conv.inner != NULL)
14218 val_conv = ChannelAnnouncement_clone(&val_conv);
14219 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
14222 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14223 LDKChannelInfo obj_conv;
14224 obj_conv.inner = (void*)(obj & (~1));
14225 obj_conv.is_owned = false;
14226 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
14227 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14228 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14229 CVec_u8Z_free(arg_var);
14233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14234 LDKu8slice ser_ref;
14235 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14236 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14237 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
14238 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14239 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14240 long ret_ref = (long)ret_var.inner;
14241 if (ret_var.is_owned) {
14244 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14249 LDKRoutingFees this_ptr_conv;
14250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14252 RoutingFees_free(this_ptr_conv);
14255 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14256 LDKRoutingFees orig_conv;
14257 orig_conv.inner = (void*)(orig & (~1));
14258 orig_conv.is_owned = false;
14259 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
14260 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14261 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14262 long ret_ref = (long)ret_var.inner;
14263 if (ret_var.is_owned) {
14269 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14270 LDKRoutingFees this_ptr_conv;
14271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14272 this_ptr_conv.is_owned = false;
14273 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
14277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14278 LDKRoutingFees this_ptr_conv;
14279 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14280 this_ptr_conv.is_owned = false;
14281 RoutingFees_set_base_msat(&this_ptr_conv, val);
14284 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
14285 LDKRoutingFees this_ptr_conv;
14286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14287 this_ptr_conv.is_owned = false;
14288 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
14292 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14293 LDKRoutingFees this_ptr_conv;
14294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14295 this_ptr_conv.is_owned = false;
14296 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14300 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14301 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14302 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14303 long ret_ref = (long)ret_var.inner;
14304 if (ret_var.is_owned) {
14310 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14311 LDKu8slice ser_ref;
14312 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14313 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14314 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
14315 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14316 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14317 long ret_ref = (long)ret_var.inner;
14318 if (ret_var.is_owned) {
14321 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14325 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
14326 LDKRoutingFees obj_conv;
14327 obj_conv.inner = (void*)(obj & (~1));
14328 obj_conv.is_owned = false;
14329 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
14330 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14331 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14332 CVec_u8Z_free(arg_var);
14336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14337 LDKNodeAnnouncementInfo this_ptr_conv;
14338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14340 NodeAnnouncementInfo_free(this_ptr_conv);
14343 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14344 LDKNodeAnnouncementInfo this_ptr_conv;
14345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14346 this_ptr_conv.is_owned = false;
14347 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14348 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14349 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14350 long ret_ref = (long)ret_var.inner;
14351 if (ret_var.is_owned) {
14357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14358 LDKNodeAnnouncementInfo this_ptr_conv;
14359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14360 this_ptr_conv.is_owned = false;
14361 LDKNodeFeatures val_conv;
14362 val_conv.inner = (void*)(val & (~1));
14363 val_conv.is_owned = (val & 1) || (val == 0);
14364 // Warning: we may need a move here but can't clone!
14365 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14368 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14369 LDKNodeAnnouncementInfo this_ptr_conv;
14370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14371 this_ptr_conv.is_owned = false;
14372 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14377 LDKNodeAnnouncementInfo this_ptr_conv;
14378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14379 this_ptr_conv.is_owned = false;
14380 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14383 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
14384 LDKNodeAnnouncementInfo this_ptr_conv;
14385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14386 this_ptr_conv.is_owned = false;
14387 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14388 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14393 LDKNodeAnnouncementInfo this_ptr_conv;
14394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14395 this_ptr_conv.is_owned = false;
14396 LDKThreeBytes val_ref;
14397 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14398 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14399 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14402 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14403 LDKNodeAnnouncementInfo this_ptr_conv;
14404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14405 this_ptr_conv.is_owned = false;
14406 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14407 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14412 LDKNodeAnnouncementInfo this_ptr_conv;
14413 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14414 this_ptr_conv.is_owned = false;
14415 LDKThirtyTwoBytes val_ref;
14416 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14417 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14418 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14422 LDKNodeAnnouncementInfo this_ptr_conv;
14423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14424 this_ptr_conv.is_owned = false;
14425 LDKCVec_NetAddressZ val_constr;
14426 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14427 if (val_constr.datalen > 0)
14428 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14430 val_constr.data = NULL;
14431 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14432 for (size_t m = 0; m < val_constr.datalen; m++) {
14433 long arr_conv_12 = val_vals[m];
14434 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14435 FREE((void*)arr_conv_12);
14436 val_constr.data[m] = arr_conv_12_conv;
14438 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14439 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14442 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14443 LDKNodeAnnouncementInfo this_ptr_conv;
14444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14445 this_ptr_conv.is_owned = false;
14446 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14447 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14448 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14449 long ret_ref = (long)ret_var.inner;
14450 if (ret_var.is_owned) {
14456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14457 LDKNodeAnnouncementInfo this_ptr_conv;
14458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14459 this_ptr_conv.is_owned = false;
14460 LDKNodeAnnouncement val_conv;
14461 val_conv.inner = (void*)(val & (~1));
14462 val_conv.is_owned = (val & 1) || (val == 0);
14463 if (val_conv.inner != NULL)
14464 val_conv = NodeAnnouncement_clone(&val_conv);
14465 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14468 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) {
14469 LDKNodeFeatures features_arg_conv;
14470 features_arg_conv.inner = (void*)(features_arg & (~1));
14471 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14472 // Warning: we may need a move here but can't clone!
14473 LDKThreeBytes rgb_arg_ref;
14474 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14475 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14476 LDKThirtyTwoBytes alias_arg_ref;
14477 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14478 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14479 LDKCVec_NetAddressZ addresses_arg_constr;
14480 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14481 if (addresses_arg_constr.datalen > 0)
14482 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14484 addresses_arg_constr.data = NULL;
14485 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14486 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14487 long arr_conv_12 = addresses_arg_vals[m];
14488 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14489 FREE((void*)arr_conv_12);
14490 addresses_arg_constr.data[m] = arr_conv_12_conv;
14492 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14493 LDKNodeAnnouncement announcement_message_arg_conv;
14494 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14495 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14496 if (announcement_message_arg_conv.inner != NULL)
14497 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14498 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14499 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14500 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14501 long ret_ref = (long)ret_var.inner;
14502 if (ret_var.is_owned) {
14508 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14509 LDKNodeAnnouncementInfo obj_conv;
14510 obj_conv.inner = (void*)(obj & (~1));
14511 obj_conv.is_owned = false;
14512 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14513 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14514 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14515 CVec_u8Z_free(arg_var);
14519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14520 LDKu8slice ser_ref;
14521 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14522 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14523 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14524 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14525 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14526 long ret_ref = (long)ret_var.inner;
14527 if (ret_var.is_owned) {
14530 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14535 LDKNodeInfo this_ptr_conv;
14536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14538 NodeInfo_free(this_ptr_conv);
14541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14542 LDKNodeInfo this_ptr_conv;
14543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14544 this_ptr_conv.is_owned = false;
14545 LDKCVec_u64Z val_constr;
14546 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14547 if (val_constr.datalen > 0)
14548 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14550 val_constr.data = NULL;
14551 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14552 for (size_t g = 0; g < val_constr.datalen; g++) {
14553 long arr_conv_6 = val_vals[g];
14554 val_constr.data[g] = arr_conv_6;
14556 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14557 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14561 LDKNodeInfo this_ptr_conv;
14562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14563 this_ptr_conv.is_owned = false;
14564 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14565 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14566 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14567 long ret_ref = (long)ret_var.inner;
14568 if (ret_var.is_owned) {
14574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14575 LDKNodeInfo this_ptr_conv;
14576 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14577 this_ptr_conv.is_owned = false;
14578 LDKRoutingFees val_conv;
14579 val_conv.inner = (void*)(val & (~1));
14580 val_conv.is_owned = (val & 1) || (val == 0);
14581 if (val_conv.inner != NULL)
14582 val_conv = RoutingFees_clone(&val_conv);
14583 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14586 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14587 LDKNodeInfo this_ptr_conv;
14588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14589 this_ptr_conv.is_owned = false;
14590 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14591 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14592 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14593 long ret_ref = (long)ret_var.inner;
14594 if (ret_var.is_owned) {
14600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14601 LDKNodeInfo this_ptr_conv;
14602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14603 this_ptr_conv.is_owned = false;
14604 LDKNodeAnnouncementInfo val_conv;
14605 val_conv.inner = (void*)(val & (~1));
14606 val_conv.is_owned = (val & 1) || (val == 0);
14607 // Warning: we may need a move here but can't clone!
14608 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14611 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) {
14612 LDKCVec_u64Z channels_arg_constr;
14613 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14614 if (channels_arg_constr.datalen > 0)
14615 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14617 channels_arg_constr.data = NULL;
14618 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14619 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14620 long arr_conv_6 = channels_arg_vals[g];
14621 channels_arg_constr.data[g] = arr_conv_6;
14623 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14624 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14625 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14626 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14627 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14628 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14629 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14630 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14631 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14632 // Warning: we may need a move here but can't clone!
14633 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14634 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14635 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14636 long ret_ref = (long)ret_var.inner;
14637 if (ret_var.is_owned) {
14643 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14644 LDKNodeInfo obj_conv;
14645 obj_conv.inner = (void*)(obj & (~1));
14646 obj_conv.is_owned = false;
14647 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14648 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14649 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14650 CVec_u8Z_free(arg_var);
14654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14655 LDKu8slice ser_ref;
14656 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14657 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14658 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14659 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14660 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14661 long ret_ref = (long)ret_var.inner;
14662 if (ret_var.is_owned) {
14665 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14669 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14670 LDKNetworkGraph obj_conv;
14671 obj_conv.inner = (void*)(obj & (~1));
14672 obj_conv.is_owned = false;
14673 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14674 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14675 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14676 CVec_u8Z_free(arg_var);
14680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14681 LDKu8slice ser_ref;
14682 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14683 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14684 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14687 long ret_ref = (long)ret_var.inner;
14688 if (ret_var.is_owned) {
14691 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14696 LDKNetworkGraph ret_var = NetworkGraph_new();
14697 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14698 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14699 long ret_ref = (long)ret_var.inner;
14700 if (ret_var.is_owned) {
14706 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) {
14707 LDKNetworkGraph this_arg_conv;
14708 this_arg_conv.inner = (void*)(this_arg & (~1));
14709 this_arg_conv.is_owned = false;
14710 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);