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 LDKSocketDescriptor *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 LDKSocketDescriptor *other_arg_clone = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4354 *other_arg_clone = SocketDescriptor_clone(other_arg);
4355 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4357 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, (long)other_arg_clone);
4359 uint64_t hash_jcall(const void* this_arg) {
4360 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4362 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4363 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4365 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4367 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4368 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4369 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4371 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4372 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4376 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4377 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4378 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4379 return (void*) this_arg;
4381 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4382 jclass c = (*env)->GetObjectClass(env, o);
4384 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4385 atomic_init(&calls->refcnt, 1);
4386 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4387 calls->o = (*env)->NewWeakGlobalRef(env, o);
4388 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4389 CHECK(calls->send_data_meth != NULL);
4390 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4391 CHECK(calls->disconnect_socket_meth != NULL);
4392 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4393 CHECK(calls->eq_meth != NULL);
4394 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4395 CHECK(calls->hash_meth != NULL);
4397 LDKSocketDescriptor ret = {
4398 .this_arg = (void*) calls,
4399 .send_data = send_data_jcall,
4400 .disconnect_socket = disconnect_socket_jcall,
4403 .clone = LDKSocketDescriptor_JCalls_clone,
4404 .free = LDKSocketDescriptor_JCalls_free,
4408 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4409 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4410 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4411 return (long)res_ptr;
4413 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4414 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4418 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4419 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4420 LDKu8slice data_ref;
4421 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4422 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4423 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4424 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4429 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4430 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4433 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4434 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4435 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4439 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4440 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4441 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4443 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4444 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4446 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4447 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4448 CHECK(val->result_ok);
4449 LDKCVecTempl_u8 res_var = (*val->contents.result);
4450 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4451 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4455 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4456 CHECK(!val->result_ok);
4457 LDKPeerHandleError err_var = (*val->contents.err);
4458 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4459 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4460 long err_ref = (long)err_var.inner & ~1;
4463 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4464 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4466 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4467 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4468 CHECK(val->result_ok);
4469 return *val->contents.result;
4471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4472 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4473 CHECK(!val->result_ok);
4474 LDKPeerHandleError err_var = (*val->contents.err);
4475 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4476 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4477 long err_ref = (long)err_var.inner & ~1;
4480 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4481 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4484 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4485 CHECK(val->result_ok);
4486 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4487 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4490 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4491 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4492 CHECK(!val->result_ok);
4493 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4496 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4497 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4499 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4500 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4501 CHECK(val->result_ok);
4502 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4503 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4506 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4507 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4508 CHECK(!val->result_ok);
4509 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4512 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4513 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4516 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4517 CHECK(val->result_ok);
4518 LDKTxCreationKeys res_var = (*val->contents.result);
4519 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4520 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4521 long res_ref = (long)res_var.inner & ~1;
4524 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4525 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4526 CHECK(!val->result_ok);
4527 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4530 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4531 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4532 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4535 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4536 ret->datalen = (*env)->GetArrayLength(env, elems);
4537 if (ret->datalen == 0) {
4540 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4541 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4542 for (size_t i = 0; i < ret->datalen; i++) {
4543 jlong arr_elem = java_elems[i];
4544 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4545 FREE((void*)arr_elem);
4546 ret->data[i] = arr_elem_conv;
4548 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4552 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4553 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4554 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4555 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4556 for (size_t i = 0; i < vec->datalen; i++) {
4557 CHECK((((long)vec->data[i].inner) & 1) == 0);
4558 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4560 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4564 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4565 ret->datalen = (*env)->GetArrayLength(env, elems);
4566 if (ret->datalen == 0) {
4569 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4570 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4571 for (size_t i = 0; i < ret->datalen; i++) {
4572 jlong arr_elem = java_elems[i];
4573 LDKRouteHop arr_elem_conv;
4574 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4575 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4576 if (arr_elem_conv.inner != NULL)
4577 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4578 ret->data[i] = arr_elem_conv;
4580 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4584 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4585 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4586 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4588 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4589 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4592 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4593 CHECK(val->result_ok);
4594 LDKRoute res_var = (*val->contents.result);
4595 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4596 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4597 long res_ref = (long)res_var.inner & ~1;
4600 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4601 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4602 CHECK(!val->result_ok);
4603 LDKLightningError err_var = (*val->contents.err);
4604 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4605 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4606 long err_ref = (long)err_var.inner & ~1;
4609 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4610 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4611 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4612 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4613 for (size_t i = 0; i < vec->datalen; i++) {
4614 CHECK((((long)vec->data[i].inner) & 1) == 0);
4615 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4617 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4621 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4622 ret->datalen = (*env)->GetArrayLength(env, elems);
4623 if (ret->datalen == 0) {
4626 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4627 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4628 for (size_t i = 0; i < ret->datalen; i++) {
4629 jlong arr_elem = java_elems[i];
4630 LDKRouteHint arr_elem_conv;
4631 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4632 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4633 if (arr_elem_conv.inner != NULL)
4634 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4635 ret->data[i] = arr_elem_conv;
4637 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4642 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4644 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4648 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4650 C2Tuple_OutPointScriptZ_free(arg_conv);
4653 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4654 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4656 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4660 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4662 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4665 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4666 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4668 C2Tuple_u64u64Z_free(arg_conv);
4671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4672 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4674 C2Tuple_usizeTransactionZ_free(arg_conv);
4677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4678 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4680 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4683 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4684 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4686 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4690 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4692 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4693 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4694 return (long)ret_conv;
4697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4698 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4700 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4704 LDKCVec_SignatureZ arg_constr;
4705 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4706 if (arg_constr.datalen > 0)
4707 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4709 arg_constr.data = NULL;
4710 for (size_t i = 0; i < arg_constr.datalen; i++) {
4711 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4712 LDKSignature arr_conv_8_ref;
4713 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4714 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4715 arg_constr.data[i] = arr_conv_8_ref;
4717 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4718 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4719 return (long)ret_conv;
4722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4723 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4725 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4726 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4727 return (long)ret_conv;
4730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4731 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4733 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4737 LDKCVec_u8Z arg_ref;
4738 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4739 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
4740 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
4741 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4742 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4743 return (long)ret_conv;
4746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4747 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4749 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4750 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4751 return (long)ret_conv;
4754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4755 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4757 CResult_NoneAPIErrorZ_free(arg_conv);
4760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4761 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4763 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4764 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4765 return (long)ret_conv;
4768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4769 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4771 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4775 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4777 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4778 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4779 return (long)ret_conv;
4782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4783 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4785 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4789 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4791 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4792 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4793 return (long)ret_conv;
4796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4797 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4799 CResult_NonePaymentSendFailureZ_free(arg_conv);
4802 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4803 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4805 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4806 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4807 return (long)ret_conv;
4810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4811 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4813 CResult_NonePeerHandleErrorZ_free(arg_conv);
4816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4817 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4819 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4820 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4821 return (long)ret_conv;
4824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4825 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4827 CResult_PublicKeySecpErrorZ_free(arg_conv);
4830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4831 LDKPublicKey arg_ref;
4832 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4833 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4834 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4835 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4836 return (long)ret_conv;
4839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4840 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4842 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4843 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4844 return (long)ret_conv;
4847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4848 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4850 CResult_RouteLightningErrorZ_free(arg_conv);
4853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4854 LDKRoute arg_conv = *(LDKRoute*)arg;
4856 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4857 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4858 return (long)ret_conv;
4861 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4862 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4864 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4865 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4866 return (long)ret_conv;
4869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4870 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4872 CResult_SecretKeySecpErrorZ_free(arg_conv);
4875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4876 LDKSecretKey arg_ref;
4877 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4878 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4879 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4880 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4881 return (long)ret_conv;
4884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4885 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4887 CResult_SignatureNoneZ_free(arg_conv);
4890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4891 LDKSignature arg_ref;
4892 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4893 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4894 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4895 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4896 return (long)ret_conv;
4899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4900 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4902 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4903 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4904 return (long)ret_conv;
4907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4908 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4910 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4914 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4916 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4917 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4918 return (long)ret_conv;
4921 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4922 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4924 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4925 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4926 return (long)ret_conv;
4929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4930 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4932 CResult_TxOutAccessErrorZ_free(arg_conv);
4935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4936 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4938 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4939 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4940 return (long)ret_conv;
4943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4944 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4946 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4947 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4948 return (long)ret_conv;
4951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4952 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4954 CResult_boolLightningErrorZ_free(arg_conv);
4957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4958 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4959 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4960 return (long)ret_conv;
4963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4964 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4966 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4967 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4968 return (long)ret_conv;
4971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4972 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4974 CResult_boolPeerHandleErrorZ_free(arg_conv);
4977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4978 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4979 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4980 return (long)ret_conv;
4983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4984 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4985 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4986 if (arg_constr.datalen > 0)
4987 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4989 arg_constr.data = NULL;
4990 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4991 for (size_t q = 0; q < arg_constr.datalen; q++) {
4992 long arr_conv_42 = arg_vals[q];
4993 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4994 FREE((void*)arr_conv_42);
4995 arg_constr.data[q] = arr_conv_42_conv;
4997 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4998 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
5001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5002 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
5003 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5004 if (arg_constr.datalen > 0)
5005 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
5007 arg_constr.data = NULL;
5008 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5009 for (size_t b = 0; b < arg_constr.datalen; b++) {
5010 long arr_conv_27 = arg_vals[b];
5011 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
5012 FREE((void*)arr_conv_27);
5013 arg_constr.data[b] = arr_conv_27_conv;
5015 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5016 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
5019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5020 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
5021 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5022 if (arg_constr.datalen > 0)
5023 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5025 arg_constr.data = NULL;
5026 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5027 for (size_t y = 0; y < arg_constr.datalen; y++) {
5028 long arr_conv_24 = arg_vals[y];
5029 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
5030 FREE((void*)arr_conv_24);
5031 arg_constr.data[y] = arr_conv_24_conv;
5033 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5034 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
5037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5038 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
5039 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5040 if (arg_constr.datalen > 0)
5041 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
5043 arg_constr.data = NULL;
5044 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5045 for (size_t l = 0; l < arg_constr.datalen; l++) {
5046 long arr_conv_63 = arg_vals[l];
5047 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
5048 FREE((void*)arr_conv_63);
5049 arg_constr.data[l] = arr_conv_63_conv;
5051 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5052 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
5055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5056 LDKCVec_CVec_RouteHopZZ arg_constr;
5057 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5058 if (arg_constr.datalen > 0)
5059 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
5061 arg_constr.data = NULL;
5062 for (size_t m = 0; m < arg_constr.datalen; m++) {
5063 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
5064 LDKCVec_RouteHopZ arr_conv_12_constr;
5065 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
5066 if (arr_conv_12_constr.datalen > 0)
5067 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5069 arr_conv_12_constr.data = NULL;
5070 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
5071 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
5072 long arr_conv_10 = arr_conv_12_vals[k];
5073 LDKRouteHop arr_conv_10_conv;
5074 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5075 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5076 arr_conv_12_constr.data[k] = arr_conv_10_conv;
5078 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
5079 arg_constr.data[m] = arr_conv_12_constr;
5081 CVec_CVec_RouteHopZZ_free(arg_constr);
5084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5085 LDKCVec_ChannelDetailsZ arg_constr;
5086 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5087 if (arg_constr.datalen > 0)
5088 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
5090 arg_constr.data = NULL;
5091 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5092 for (size_t q = 0; q < arg_constr.datalen; q++) {
5093 long arr_conv_16 = arg_vals[q];
5094 LDKChannelDetails arr_conv_16_conv;
5095 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5096 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5097 arg_constr.data[q] = arr_conv_16_conv;
5099 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5100 CVec_ChannelDetailsZ_free(arg_constr);
5103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5104 LDKCVec_ChannelMonitorZ arg_constr;
5105 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5106 if (arg_constr.datalen > 0)
5107 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5109 arg_constr.data = NULL;
5110 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5111 for (size_t q = 0; q < arg_constr.datalen; q++) {
5112 long arr_conv_16 = arg_vals[q];
5113 LDKChannelMonitor arr_conv_16_conv;
5114 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5115 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5116 arg_constr.data[q] = arr_conv_16_conv;
5118 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5119 CVec_ChannelMonitorZ_free(arg_constr);
5122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5123 LDKCVec_EventZ arg_constr;
5124 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5125 if (arg_constr.datalen > 0)
5126 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5128 arg_constr.data = NULL;
5129 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5130 for (size_t h = 0; h < arg_constr.datalen; h++) {
5131 long arr_conv_7 = arg_vals[h];
5132 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5133 FREE((void*)arr_conv_7);
5134 arg_constr.data[h] = arr_conv_7_conv;
5136 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5137 CVec_EventZ_free(arg_constr);
5140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5141 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
5142 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5143 if (arg_constr.datalen > 0)
5144 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
5146 arg_constr.data = NULL;
5147 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5148 for (size_t y = 0; y < arg_constr.datalen; y++) {
5149 long arr_conv_24 = arg_vals[y];
5150 LDKHTLCOutputInCommitment arr_conv_24_conv;
5151 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
5152 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
5153 arg_constr.data[y] = arr_conv_24_conv;
5155 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5156 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
5159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5160 LDKCVec_MessageSendEventZ arg_constr;
5161 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5162 if (arg_constr.datalen > 0)
5163 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5165 arg_constr.data = NULL;
5166 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5167 for (size_t s = 0; s < arg_constr.datalen; s++) {
5168 long arr_conv_18 = arg_vals[s];
5169 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5170 FREE((void*)arr_conv_18);
5171 arg_constr.data[s] = arr_conv_18_conv;
5173 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5174 CVec_MessageSendEventZ_free(arg_constr);
5177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5178 LDKCVec_MonitorEventZ arg_constr;
5179 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5180 if (arg_constr.datalen > 0)
5181 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5183 arg_constr.data = NULL;
5184 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5185 for (size_t o = 0; o < arg_constr.datalen; o++) {
5186 long arr_conv_14 = arg_vals[o];
5187 LDKMonitorEvent arr_conv_14_conv;
5188 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5189 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5190 arg_constr.data[o] = arr_conv_14_conv;
5192 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5193 CVec_MonitorEventZ_free(arg_constr);
5196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5197 LDKCVec_NetAddressZ arg_constr;
5198 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5199 if (arg_constr.datalen > 0)
5200 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5202 arg_constr.data = NULL;
5203 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5204 for (size_t m = 0; m < arg_constr.datalen; m++) {
5205 long arr_conv_12 = arg_vals[m];
5206 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5207 FREE((void*)arr_conv_12);
5208 arg_constr.data[m] = arr_conv_12_conv;
5210 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5211 CVec_NetAddressZ_free(arg_constr);
5214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5215 LDKCVec_NodeAnnouncementZ arg_constr;
5216 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5217 if (arg_constr.datalen > 0)
5218 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5220 arg_constr.data = NULL;
5221 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5222 for (size_t s = 0; s < arg_constr.datalen; s++) {
5223 long arr_conv_18 = arg_vals[s];
5224 LDKNodeAnnouncement arr_conv_18_conv;
5225 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5226 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5227 arg_constr.data[s] = arr_conv_18_conv;
5229 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5230 CVec_NodeAnnouncementZ_free(arg_constr);
5233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5234 LDKCVec_PublicKeyZ arg_constr;
5235 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5236 if (arg_constr.datalen > 0)
5237 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5239 arg_constr.data = NULL;
5240 for (size_t i = 0; i < arg_constr.datalen; i++) {
5241 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5242 LDKPublicKey arr_conv_8_ref;
5243 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
5244 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
5245 arg_constr.data[i] = arr_conv_8_ref;
5247 CVec_PublicKeyZ_free(arg_constr);
5250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5251 LDKCVec_RouteHintZ arg_constr;
5252 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5253 if (arg_constr.datalen > 0)
5254 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5256 arg_constr.data = NULL;
5257 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5258 for (size_t l = 0; l < arg_constr.datalen; l++) {
5259 long arr_conv_11 = arg_vals[l];
5260 LDKRouteHint arr_conv_11_conv;
5261 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5262 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5263 arg_constr.data[l] = arr_conv_11_conv;
5265 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5266 CVec_RouteHintZ_free(arg_constr);
5269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5270 LDKCVec_RouteHopZ arg_constr;
5271 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5272 if (arg_constr.datalen > 0)
5273 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5275 arg_constr.data = NULL;
5276 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5277 for (size_t k = 0; k < arg_constr.datalen; k++) {
5278 long arr_conv_10 = arg_vals[k];
5279 LDKRouteHop arr_conv_10_conv;
5280 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5281 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5282 arg_constr.data[k] = arr_conv_10_conv;
5284 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5285 CVec_RouteHopZ_free(arg_constr);
5288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5289 LDKCVec_SignatureZ arg_constr;
5290 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5291 if (arg_constr.datalen > 0)
5292 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5294 arg_constr.data = NULL;
5295 for (size_t i = 0; i < arg_constr.datalen; i++) {
5296 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5297 LDKSignature arr_conv_8_ref;
5298 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5299 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5300 arg_constr.data[i] = arr_conv_8_ref;
5302 CVec_SignatureZ_free(arg_constr);
5305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5306 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5307 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5308 if (arg_constr.datalen > 0)
5309 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5311 arg_constr.data = NULL;
5312 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5313 for (size_t b = 0; b < arg_constr.datalen; b++) {
5314 long arr_conv_27 = arg_vals[b];
5315 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5316 FREE((void*)arr_conv_27);
5317 arg_constr.data[b] = arr_conv_27_conv;
5319 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5320 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5324 LDKCVec_TransactionZ arg_constr;
5325 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5326 if (arg_constr.datalen > 0)
5327 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5329 arg_constr.data = NULL;
5330 for (size_t i = 0; i < arg_constr.datalen; i++) {
5331 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5332 LDKTransaction arr_conv_8_ref;
5333 arr_conv_8_ref.datalen = (*_env)->GetArrayLength (_env, arr_conv_8);
5334 arr_conv_8_ref.data = MALLOC(arr_conv_8_ref.datalen, "LDKTransaction Bytes");
5335 (*_env)->GetByteArrayRegion(_env, arr_conv_8, 0, arr_conv_8_ref.datalen, arr_conv_8_ref.data);
5336 arr_conv_8_ref.data_is_owned = true;
5337 arg_constr.data[i] = arr_conv_8_ref;
5339 CVec_TransactionZ_free(arg_constr);
5342 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5343 LDKCVec_TxOutZ arg_constr;
5344 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5345 if (arg_constr.datalen > 0)
5346 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5348 arg_constr.data = NULL;
5349 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5350 for (size_t h = 0; h < arg_constr.datalen; h++) {
5351 long arr_conv_7 = arg_vals[h];
5352 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5353 FREE((void*)arr_conv_7);
5354 arg_constr.data[h] = arr_conv_7_conv;
5356 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5357 CVec_TxOutZ_free(arg_constr);
5360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5361 LDKCVec_UpdateAddHTLCZ arg_constr;
5362 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5363 if (arg_constr.datalen > 0)
5364 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5366 arg_constr.data = NULL;
5367 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5368 for (size_t p = 0; p < arg_constr.datalen; p++) {
5369 long arr_conv_15 = arg_vals[p];
5370 LDKUpdateAddHTLC arr_conv_15_conv;
5371 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5372 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5373 arg_constr.data[p] = arr_conv_15_conv;
5375 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5376 CVec_UpdateAddHTLCZ_free(arg_constr);
5379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5380 LDKCVec_UpdateFailHTLCZ arg_constr;
5381 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5382 if (arg_constr.datalen > 0)
5383 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5385 arg_constr.data = NULL;
5386 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5387 for (size_t q = 0; q < arg_constr.datalen; q++) {
5388 long arr_conv_16 = arg_vals[q];
5389 LDKUpdateFailHTLC arr_conv_16_conv;
5390 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5391 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5392 arg_constr.data[q] = arr_conv_16_conv;
5394 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5395 CVec_UpdateFailHTLCZ_free(arg_constr);
5398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5399 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5400 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5401 if (arg_constr.datalen > 0)
5402 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5404 arg_constr.data = NULL;
5405 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5406 for (size_t z = 0; z < arg_constr.datalen; z++) {
5407 long arr_conv_25 = arg_vals[z];
5408 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5409 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5410 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5411 arg_constr.data[z] = arr_conv_25_conv;
5413 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5414 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5418 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5419 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5420 if (arg_constr.datalen > 0)
5421 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5423 arg_constr.data = NULL;
5424 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5425 for (size_t t = 0; t < arg_constr.datalen; t++) {
5426 long arr_conv_19 = arg_vals[t];
5427 LDKUpdateFulfillHTLC arr_conv_19_conv;
5428 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5429 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5430 arg_constr.data[t] = arr_conv_19_conv;
5432 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5433 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5437 LDKCVec_u64Z arg_constr;
5438 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5439 if (arg_constr.datalen > 0)
5440 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5442 arg_constr.data = NULL;
5443 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5444 for (size_t g = 0; g < arg_constr.datalen; g++) {
5445 long arr_conv_6 = arg_vals[g];
5446 arg_constr.data[g] = arr_conv_6;
5448 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5449 CVec_u64Z_free(arg_constr);
5452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5453 LDKCVec_u8Z arg_ref;
5454 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5455 arg_ref.data = MALLOC(arg_ref.datalen, "LDKCVec_u8Z Bytes");
5456 (*_env)->GetByteArrayRegion(_env, arg, 0, arg_ref.datalen, arg_ref.data);
5457 CVec_u8Z_free(arg_ref);
5460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jbyteArray _res) {
5461 LDKTransaction _res_ref;
5462 _res_ref.datalen = (*_env)->GetArrayLength (_env, _res);
5463 _res_ref.data = MALLOC(_res_ref.datalen, "LDKTransaction Bytes");
5464 (*_env)->GetByteArrayRegion(_env, _res, 0, _res_ref.datalen, _res_ref.data);
5465 _res_ref.data_is_owned = true;
5466 Transaction_free(_res_ref);
5469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5470 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5472 TxOut_free(_res_conv);
5475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5476 LDKTransaction b_ref;
5477 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5478 b_ref.data = MALLOC(b_ref.datalen, "LDKTransaction Bytes");
5479 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5480 b_ref.data_is_owned = true;
5481 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5482 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_ref);
5483 return (long)ret_ref;
5486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5487 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5488 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5489 return (long)ret_conv;
5492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5493 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5494 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5495 return (long)ret_conv;
5498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5500 a_conv.inner = (void*)(a & (~1));
5501 a_conv.is_owned = (a & 1) || (a == 0);
5502 if (a_conv.inner != NULL)
5503 a_conv = OutPoint_clone(&a_conv);
5505 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5506 b_ref.data = MALLOC(b_ref.datalen, "LDKCVec_u8Z Bytes");
5507 (*_env)->GetByteArrayRegion(_env, b, 0, b_ref.datalen, b_ref.data);
5508 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5509 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5510 return (long)ret_ref;
5513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5514 LDKThirtyTwoBytes a_ref;
5515 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5516 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5517 LDKCVec_TxOutZ b_constr;
5518 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5519 if (b_constr.datalen > 0)
5520 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5522 b_constr.data = NULL;
5523 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5524 for (size_t h = 0; h < b_constr.datalen; h++) {
5525 long arr_conv_7 = b_vals[h];
5526 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5527 FREE((void*)arr_conv_7);
5528 b_constr.data[h] = arr_conv_7_conv;
5530 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5531 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5532 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5533 return (long)ret_ref;
5536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5537 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5538 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5539 return (long)ret_ref;
5542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5544 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5545 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5546 LDKCVec_SignatureZ b_constr;
5547 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5548 if (b_constr.datalen > 0)
5549 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5551 b_constr.data = NULL;
5552 for (size_t i = 0; i < b_constr.datalen; i++) {
5553 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5554 LDKSignature arr_conv_8_ref;
5555 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5556 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5557 b_constr.data[i] = arr_conv_8_ref;
5559 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5560 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5561 return (long)ret_ref;
5564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5565 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5566 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5567 return (long)ret_conv;
5570 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5571 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5572 *ret_conv = CResult_SignatureNoneZ_err();
5573 return (long)ret_conv;
5576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5577 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5578 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5579 return (long)ret_conv;
5582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5583 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5584 *ret_conv = CResult_NoneAPIErrorZ_ok();
5585 return (long)ret_conv;
5588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5589 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5590 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5591 return (long)ret_conv;
5594 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5595 LDKChannelAnnouncement a_conv;
5596 a_conv.inner = (void*)(a & (~1));
5597 a_conv.is_owned = (a & 1) || (a == 0);
5598 if (a_conv.inner != NULL)
5599 a_conv = ChannelAnnouncement_clone(&a_conv);
5600 LDKChannelUpdate b_conv;
5601 b_conv.inner = (void*)(b & (~1));
5602 b_conv.is_owned = (b & 1) || (b == 0);
5603 if (b_conv.inner != NULL)
5604 b_conv = ChannelUpdate_clone(&b_conv);
5605 LDKChannelUpdate c_conv;
5606 c_conv.inner = (void*)(c & (~1));
5607 c_conv.is_owned = (c & 1) || (c == 0);
5608 if (c_conv.inner != NULL)
5609 c_conv = ChannelUpdate_clone(&c_conv);
5610 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5611 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5612 return (long)ret_ref;
5615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5616 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5617 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5618 return (long)ret_conv;
5621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5622 LDKHTLCOutputInCommitment a_conv;
5623 a_conv.inner = (void*)(a & (~1));
5624 a_conv.is_owned = (a & 1) || (a == 0);
5625 if (a_conv.inner != NULL)
5626 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5628 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5629 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5630 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5631 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5632 return (long)ret_ref;
5635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5636 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5637 FREE((void*)this_ptr);
5638 Event_free(this_ptr_conv);
5641 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5642 LDKEvent* orig_conv = (LDKEvent*)orig;
5643 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5644 *ret_copy = Event_clone(orig_conv);
5645 long ret_ref = (long)ret_copy;
5649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5650 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5651 FREE((void*)this_ptr);
5652 MessageSendEvent_free(this_ptr_conv);
5655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5656 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5657 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5658 *ret_copy = MessageSendEvent_clone(orig_conv);
5659 long ret_ref = (long)ret_copy;
5663 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5664 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5665 FREE((void*)this_ptr);
5666 MessageSendEventsProvider_free(this_ptr_conv);
5669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5670 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5671 FREE((void*)this_ptr);
5672 EventsProvider_free(this_ptr_conv);
5675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5676 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5677 FREE((void*)this_ptr);
5678 APIError_free(this_ptr_conv);
5681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5682 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5683 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5684 *ret_copy = APIError_clone(orig_conv);
5685 long ret_ref = (long)ret_copy;
5689 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5690 LDKLevel* orig_conv = (LDKLevel*)orig;
5691 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5695 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5696 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5701 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5702 FREE((void*)this_ptr);
5703 Logger_free(this_ptr_conv);
5706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5707 LDKChannelHandshakeConfig this_ptr_conv;
5708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5710 ChannelHandshakeConfig_free(this_ptr_conv);
5713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5714 LDKChannelHandshakeConfig orig_conv;
5715 orig_conv.inner = (void*)(orig & (~1));
5716 orig_conv.is_owned = false;
5717 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5718 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5719 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5720 long ret_ref = (long)ret_var.inner;
5721 if (ret_var.is_owned) {
5727 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5728 LDKChannelHandshakeConfig this_ptr_conv;
5729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5730 this_ptr_conv.is_owned = false;
5731 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5736 LDKChannelHandshakeConfig this_ptr_conv;
5737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5738 this_ptr_conv.is_owned = false;
5739 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5742 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5743 LDKChannelHandshakeConfig this_ptr_conv;
5744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5745 this_ptr_conv.is_owned = false;
5746 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5751 LDKChannelHandshakeConfig this_ptr_conv;
5752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5753 this_ptr_conv.is_owned = false;
5754 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5758 LDKChannelHandshakeConfig this_ptr_conv;
5759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5760 this_ptr_conv.is_owned = false;
5761 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5766 LDKChannelHandshakeConfig this_ptr_conv;
5767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5768 this_ptr_conv.is_owned = false;
5769 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5772 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) {
5773 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5774 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5775 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5776 long ret_ref = (long)ret_var.inner;
5777 if (ret_var.is_owned) {
5783 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5784 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5785 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5786 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5787 long ret_ref = (long)ret_var.inner;
5788 if (ret_var.is_owned) {
5794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5795 LDKChannelHandshakeLimits this_ptr_conv;
5796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5798 ChannelHandshakeLimits_free(this_ptr_conv);
5801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5802 LDKChannelHandshakeLimits orig_conv;
5803 orig_conv.inner = (void*)(orig & (~1));
5804 orig_conv.is_owned = false;
5805 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5806 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5807 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5808 long ret_ref = (long)ret_var.inner;
5809 if (ret_var.is_owned) {
5815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5816 LDKChannelHandshakeLimits this_ptr_conv;
5817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5818 this_ptr_conv.is_owned = false;
5819 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5824 LDKChannelHandshakeLimits this_ptr_conv;
5825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5826 this_ptr_conv.is_owned = false;
5827 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5830 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5831 LDKChannelHandshakeLimits this_ptr_conv;
5832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5833 this_ptr_conv.is_owned = false;
5834 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5839 LDKChannelHandshakeLimits this_ptr_conv;
5840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5841 this_ptr_conv.is_owned = false;
5842 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5846 LDKChannelHandshakeLimits this_ptr_conv;
5847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5848 this_ptr_conv.is_owned = false;
5849 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5853 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) {
5854 LDKChannelHandshakeLimits this_ptr_conv;
5855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5856 this_ptr_conv.is_owned = false;
5857 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5861 LDKChannelHandshakeLimits this_ptr_conv;
5862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5863 this_ptr_conv.is_owned = false;
5864 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5869 LDKChannelHandshakeLimits this_ptr_conv;
5870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5871 this_ptr_conv.is_owned = false;
5872 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5875 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5876 LDKChannelHandshakeLimits this_ptr_conv;
5877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5878 this_ptr_conv.is_owned = false;
5879 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5884 LDKChannelHandshakeLimits this_ptr_conv;
5885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5886 this_ptr_conv.is_owned = false;
5887 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5891 LDKChannelHandshakeLimits this_ptr_conv;
5892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5893 this_ptr_conv.is_owned = false;
5894 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5899 LDKChannelHandshakeLimits this_ptr_conv;
5900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5901 this_ptr_conv.is_owned = false;
5902 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5906 LDKChannelHandshakeLimits this_ptr_conv;
5907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5908 this_ptr_conv.is_owned = false;
5909 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5914 LDKChannelHandshakeLimits this_ptr_conv;
5915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5916 this_ptr_conv.is_owned = false;
5917 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5920 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5921 LDKChannelHandshakeLimits this_ptr_conv;
5922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5923 this_ptr_conv.is_owned = false;
5924 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5929 LDKChannelHandshakeLimits this_ptr_conv;
5930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5931 this_ptr_conv.is_owned = false;
5932 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5935 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5936 LDKChannelHandshakeLimits this_ptr_conv;
5937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5938 this_ptr_conv.is_owned = false;
5939 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5944 LDKChannelHandshakeLimits this_ptr_conv;
5945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5946 this_ptr_conv.is_owned = false;
5947 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5950 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5951 LDKChannelHandshakeLimits this_ptr_conv;
5952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5953 this_ptr_conv.is_owned = false;
5954 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5959 LDKChannelHandshakeLimits this_ptr_conv;
5960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5961 this_ptr_conv.is_owned = false;
5962 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5965 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) {
5966 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);
5967 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5968 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5969 long ret_ref = (long)ret_var.inner;
5970 if (ret_var.is_owned) {
5976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5977 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5978 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5979 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5980 long ret_ref = (long)ret_var.inner;
5981 if (ret_var.is_owned) {
5987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5988 LDKChannelConfig this_ptr_conv;
5989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5990 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5991 ChannelConfig_free(this_ptr_conv);
5994 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5995 LDKChannelConfig orig_conv;
5996 orig_conv.inner = (void*)(orig & (~1));
5997 orig_conv.is_owned = false;
5998 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5999 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6000 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6001 long ret_ref = (long)ret_var.inner;
6002 if (ret_var.is_owned) {
6008 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
6009 LDKChannelConfig this_ptr_conv;
6010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6011 this_ptr_conv.is_owned = false;
6012 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
6016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6017 LDKChannelConfig this_ptr_conv;
6018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6019 this_ptr_conv.is_owned = false;
6020 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
6023 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
6024 LDKChannelConfig this_ptr_conv;
6025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6026 this_ptr_conv.is_owned = false;
6027 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
6031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6032 LDKChannelConfig this_ptr_conv;
6033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6034 this_ptr_conv.is_owned = false;
6035 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
6038 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6039 LDKChannelConfig this_ptr_conv;
6040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6041 this_ptr_conv.is_owned = false;
6042 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
6046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6047 LDKChannelConfig this_ptr_conv;
6048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6049 this_ptr_conv.is_owned = false;
6050 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
6053 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) {
6054 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
6055 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6056 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6057 long ret_ref = (long)ret_var.inner;
6058 if (ret_var.is_owned) {
6064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
6065 LDKChannelConfig ret_var = ChannelConfig_default();
6066 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6067 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6068 long ret_ref = (long)ret_var.inner;
6069 if (ret_var.is_owned) {
6075 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
6076 LDKChannelConfig obj_conv;
6077 obj_conv.inner = (void*)(obj & (~1));
6078 obj_conv.is_owned = false;
6079 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
6080 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6081 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6082 CVec_u8Z_free(arg_var);
6086 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6088 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6089 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6090 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
6091 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6092 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6093 long ret_ref = (long)ret_var.inner;
6094 if (ret_var.is_owned) {
6097 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6102 LDKUserConfig this_ptr_conv;
6103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6105 UserConfig_free(this_ptr_conv);
6108 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6109 LDKUserConfig orig_conv;
6110 orig_conv.inner = (void*)(orig & (~1));
6111 orig_conv.is_owned = false;
6112 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6113 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6114 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6115 long ret_ref = (long)ret_var.inner;
6116 if (ret_var.is_owned) {
6122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6123 LDKUserConfig this_ptr_conv;
6124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6125 this_ptr_conv.is_owned = false;
6126 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6127 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6128 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6129 long ret_ref = (long)ret_var.inner;
6130 if (ret_var.is_owned) {
6136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6137 LDKUserConfig this_ptr_conv;
6138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6139 this_ptr_conv.is_owned = false;
6140 LDKChannelHandshakeConfig val_conv;
6141 val_conv.inner = (void*)(val & (~1));
6142 val_conv.is_owned = (val & 1) || (val == 0);
6143 if (val_conv.inner != NULL)
6144 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6145 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6148 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
6149 LDKUserConfig this_ptr_conv;
6150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6151 this_ptr_conv.is_owned = false;
6152 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
6153 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6154 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6155 long ret_ref = (long)ret_var.inner;
6156 if (ret_var.is_owned) {
6162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6163 LDKUserConfig this_ptr_conv;
6164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6165 this_ptr_conv.is_owned = false;
6166 LDKChannelHandshakeLimits val_conv;
6167 val_conv.inner = (void*)(val & (~1));
6168 val_conv.is_owned = (val & 1) || (val == 0);
6169 if (val_conv.inner != NULL)
6170 val_conv = ChannelHandshakeLimits_clone(&val_conv);
6171 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
6175 LDKUserConfig this_ptr_conv;
6176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6177 this_ptr_conv.is_owned = false;
6178 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
6179 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6180 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6181 long ret_ref = (long)ret_var.inner;
6182 if (ret_var.is_owned) {
6188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6189 LDKUserConfig this_ptr_conv;
6190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6191 this_ptr_conv.is_owned = false;
6192 LDKChannelConfig val_conv;
6193 val_conv.inner = (void*)(val & (~1));
6194 val_conv.is_owned = (val & 1) || (val == 0);
6195 if (val_conv.inner != NULL)
6196 val_conv = ChannelConfig_clone(&val_conv);
6197 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6200 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) {
6201 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6202 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6203 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6204 if (own_channel_config_arg_conv.inner != NULL)
6205 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6206 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6207 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6208 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6209 if (peer_channel_config_limits_arg_conv.inner != NULL)
6210 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6211 LDKChannelConfig channel_options_arg_conv;
6212 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6213 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6214 if (channel_options_arg_conv.inner != NULL)
6215 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6216 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6217 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6218 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6219 long ret_ref = (long)ret_var.inner;
6220 if (ret_var.is_owned) {
6226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
6227 LDKUserConfig ret_var = UserConfig_default();
6228 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6229 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6230 long ret_ref = (long)ret_var.inner;
6231 if (ret_var.is_owned) {
6237 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6238 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6239 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
6243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6244 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6245 FREE((void*)this_ptr);
6246 Access_free(this_ptr_conv);
6249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6250 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6251 FREE((void*)this_ptr);
6252 Watch_free(this_ptr_conv);
6255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6256 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6257 FREE((void*)this_ptr);
6258 Filter_free(this_ptr_conv);
6261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6262 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6263 FREE((void*)this_ptr);
6264 BroadcasterInterface_free(this_ptr_conv);
6267 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6268 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6269 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6273 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6274 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6275 FREE((void*)this_ptr);
6276 FeeEstimator_free(this_ptr_conv);
6279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6280 LDKChainMonitor this_ptr_conv;
6281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6283 ChainMonitor_free(this_ptr_conv);
6286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6287 LDKChainMonitor this_arg_conv;
6288 this_arg_conv.inner = (void*)(this_arg & (~1));
6289 this_arg_conv.is_owned = false;
6290 unsigned char header_arr[80];
6291 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6292 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6293 unsigned char (*header_ref)[80] = &header_arr;
6294 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6295 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6296 if (txdata_constr.datalen > 0)
6297 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6299 txdata_constr.data = NULL;
6300 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6301 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6302 long arr_conv_24 = txdata_vals[y];
6303 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6304 FREE((void*)arr_conv_24);
6305 txdata_constr.data[y] = arr_conv_24_conv;
6307 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6308 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6312 LDKChainMonitor this_arg_conv;
6313 this_arg_conv.inner = (void*)(this_arg & (~1));
6314 this_arg_conv.is_owned = false;
6315 unsigned char header_arr[80];
6316 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6317 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6318 unsigned char (*header_ref)[80] = &header_arr;
6319 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6323 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6324 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6325 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6326 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6327 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6329 LDKLogger logger_conv = *(LDKLogger*)logger;
6330 if (logger_conv.free == LDKLogger_JCalls_free) {
6331 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6332 LDKLogger_JCalls_clone(logger_conv.this_arg);
6334 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6335 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6336 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6337 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6339 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6340 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6341 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6342 long ret_ref = (long)ret_var.inner;
6343 if (ret_var.is_owned) {
6349 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6350 LDKChainMonitor this_arg_conv;
6351 this_arg_conv.inner = (void*)(this_arg & (~1));
6352 this_arg_conv.is_owned = false;
6353 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6354 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6358 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6359 LDKChainMonitor this_arg_conv;
6360 this_arg_conv.inner = (void*)(this_arg & (~1));
6361 this_arg_conv.is_owned = false;
6362 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6363 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6368 LDKChannelMonitorUpdate this_ptr_conv;
6369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6371 ChannelMonitorUpdate_free(this_ptr_conv);
6374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6375 LDKChannelMonitorUpdate orig_conv;
6376 orig_conv.inner = (void*)(orig & (~1));
6377 orig_conv.is_owned = false;
6378 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6379 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6380 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6381 long ret_ref = (long)ret_var.inner;
6382 if (ret_var.is_owned) {
6388 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6389 LDKChannelMonitorUpdate this_ptr_conv;
6390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6391 this_ptr_conv.is_owned = false;
6392 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6396 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6397 LDKChannelMonitorUpdate this_ptr_conv;
6398 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6399 this_ptr_conv.is_owned = false;
6400 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6403 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6404 LDKChannelMonitorUpdate obj_conv;
6405 obj_conv.inner = (void*)(obj & (~1));
6406 obj_conv.is_owned = false;
6407 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6408 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6409 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6410 CVec_u8Z_free(arg_var);
6414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6416 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6417 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6418 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6419 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6420 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6421 long ret_ref = (long)ret_var.inner;
6422 if (ret_var.is_owned) {
6425 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6429 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6430 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6431 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6436 LDKMonitorUpdateError this_ptr_conv;
6437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6439 MonitorUpdateError_free(this_ptr_conv);
6442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6443 LDKMonitorEvent this_ptr_conv;
6444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6446 MonitorEvent_free(this_ptr_conv);
6449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6450 LDKMonitorEvent orig_conv;
6451 orig_conv.inner = (void*)(orig & (~1));
6452 orig_conv.is_owned = false;
6453 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6454 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6455 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6456 long ret_ref = (long)ret_var.inner;
6457 if (ret_var.is_owned) {
6463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6464 LDKHTLCUpdate this_ptr_conv;
6465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6467 HTLCUpdate_free(this_ptr_conv);
6470 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6471 LDKHTLCUpdate orig_conv;
6472 orig_conv.inner = (void*)(orig & (~1));
6473 orig_conv.is_owned = false;
6474 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6475 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6476 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6477 long ret_ref = (long)ret_var.inner;
6478 if (ret_var.is_owned) {
6484 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6485 LDKHTLCUpdate obj_conv;
6486 obj_conv.inner = (void*)(obj & (~1));
6487 obj_conv.is_owned = false;
6488 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6489 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6490 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6491 CVec_u8Z_free(arg_var);
6495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6497 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6498 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6499 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6500 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6501 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6502 long ret_ref = (long)ret_var.inner;
6503 if (ret_var.is_owned) {
6506 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6511 LDKChannelMonitor this_ptr_conv;
6512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6514 ChannelMonitor_free(this_ptr_conv);
6517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6518 LDKChannelMonitor this_arg_conv;
6519 this_arg_conv.inner = (void*)(this_arg & (~1));
6520 this_arg_conv.is_owned = false;
6521 LDKChannelMonitorUpdate updates_conv;
6522 updates_conv.inner = (void*)(updates & (~1));
6523 updates_conv.is_owned = (updates & 1) || (updates == 0);
6524 if (updates_conv.inner != NULL)
6525 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6526 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6527 LDKLogger* logger_conv = (LDKLogger*)logger;
6528 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6529 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6530 return (long)ret_conv;
6533 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6534 LDKChannelMonitor this_arg_conv;
6535 this_arg_conv.inner = (void*)(this_arg & (~1));
6536 this_arg_conv.is_owned = false;
6537 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6542 LDKChannelMonitor this_arg_conv;
6543 this_arg_conv.inner = (void*)(this_arg & (~1));
6544 this_arg_conv.is_owned = false;
6545 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6546 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6547 return (long)ret_ref;
6550 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6551 LDKChannelMonitor this_arg_conv;
6552 this_arg_conv.inner = (void*)(this_arg & (~1));
6553 this_arg_conv.is_owned = false;
6554 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6555 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6556 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6557 for (size_t o = 0; o < ret_var.datalen; o++) {
6558 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6559 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6560 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6561 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6562 if (arr_conv_14_var.is_owned) {
6563 arr_conv_14_ref |= 1;
6565 ret_arr_ptr[o] = arr_conv_14_ref;
6567 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6572 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6573 LDKChannelMonitor this_arg_conv;
6574 this_arg_conv.inner = (void*)(this_arg & (~1));
6575 this_arg_conv.is_owned = false;
6576 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6577 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6578 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6579 for (size_t h = 0; h < ret_var.datalen; h++) {
6580 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6581 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6582 long arr_conv_7_ref = (long)arr_conv_7_copy;
6583 ret_arr_ptr[h] = arr_conv_7_ref;
6585 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6586 CVec_EventZ_free(ret_var);
6590 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6591 LDKChannelMonitor this_arg_conv;
6592 this_arg_conv.inner = (void*)(this_arg & (~1));
6593 this_arg_conv.is_owned = false;
6594 LDKLogger* logger_conv = (LDKLogger*)logger;
6595 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6596 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
6597 for (size_t i = 0; i < ret_var.datalen; i++) {
6598 LDKTransaction arr_conv_8_var = ret_var.data[i];
6599 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, arr_conv_8_var.datalen);
6600 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, arr_conv_8_var.datalen, arr_conv_8_var.data);
6601 Transaction_free(arr_conv_8_var);
6602 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
6604 CVec_TransactionZ_free(ret_var);
6608 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) {
6609 LDKChannelMonitor this_arg_conv;
6610 this_arg_conv.inner = (void*)(this_arg & (~1));
6611 this_arg_conv.is_owned = false;
6612 unsigned char header_arr[80];
6613 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6614 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6615 unsigned char (*header_ref)[80] = &header_arr;
6616 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6617 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6618 if (txdata_constr.datalen > 0)
6619 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6621 txdata_constr.data = NULL;
6622 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6623 for (size_t y = 0; y < txdata_constr.datalen; y++) {
6624 long arr_conv_24 = txdata_vals[y];
6625 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
6626 FREE((void*)arr_conv_24);
6627 txdata_constr.data[y] = arr_conv_24_conv;
6629 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6630 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6631 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6632 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6633 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6635 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6636 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6637 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6638 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6640 LDKLogger logger_conv = *(LDKLogger*)logger;
6641 if (logger_conv.free == LDKLogger_JCalls_free) {
6642 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6643 LDKLogger_JCalls_clone(logger_conv.this_arg);
6645 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6646 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6647 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6648 for (size_t b = 0; b < ret_var.datalen; b++) {
6649 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6650 *arr_conv_27_ref = ret_var.data[b];
6651 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6653 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6654 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6658 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) {
6659 LDKChannelMonitor this_arg_conv;
6660 this_arg_conv.inner = (void*)(this_arg & (~1));
6661 this_arg_conv.is_owned = false;
6662 unsigned char header_arr[80];
6663 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6664 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6665 unsigned char (*header_ref)[80] = &header_arr;
6666 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6667 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6668 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6669 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6671 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6672 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6673 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6674 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6676 LDKLogger logger_conv = *(LDKLogger*)logger;
6677 if (logger_conv.free == LDKLogger_JCalls_free) {
6678 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6679 LDKLogger_JCalls_clone(logger_conv.this_arg);
6681 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6685 LDKOutPoint this_ptr_conv;
6686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6688 OutPoint_free(this_ptr_conv);
6691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6692 LDKOutPoint orig_conv;
6693 orig_conv.inner = (void*)(orig & (~1));
6694 orig_conv.is_owned = false;
6695 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6696 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6697 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6698 long ret_ref = (long)ret_var.inner;
6699 if (ret_var.is_owned) {
6705 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6706 LDKOutPoint this_ptr_conv;
6707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6708 this_ptr_conv.is_owned = false;
6709 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6710 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6715 LDKOutPoint this_ptr_conv;
6716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6717 this_ptr_conv.is_owned = false;
6718 LDKThirtyTwoBytes val_ref;
6719 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6720 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6721 OutPoint_set_txid(&this_ptr_conv, val_ref);
6724 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6725 LDKOutPoint this_ptr_conv;
6726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6727 this_ptr_conv.is_owned = false;
6728 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6733 LDKOutPoint this_ptr_conv;
6734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6735 this_ptr_conv.is_owned = false;
6736 OutPoint_set_index(&this_ptr_conv, val);
6739 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6740 LDKThirtyTwoBytes txid_arg_ref;
6741 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6742 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6743 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6744 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6745 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6746 long ret_ref = (long)ret_var.inner;
6747 if (ret_var.is_owned) {
6753 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6754 LDKOutPoint this_arg_conv;
6755 this_arg_conv.inner = (void*)(this_arg & (~1));
6756 this_arg_conv.is_owned = false;
6757 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6758 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6762 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6763 LDKOutPoint obj_conv;
6764 obj_conv.inner = (void*)(obj & (~1));
6765 obj_conv.is_owned = false;
6766 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6767 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6768 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6769 CVec_u8Z_free(arg_var);
6773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6775 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6776 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6777 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6778 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6779 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6780 long ret_ref = (long)ret_var.inner;
6781 if (ret_var.is_owned) {
6784 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6789 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6790 FREE((void*)this_ptr);
6791 SpendableOutputDescriptor_free(this_ptr_conv);
6794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6795 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6796 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6797 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6798 long ret_ref = (long)ret_copy;
6802 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6803 LDKChannelKeys* orig_conv = (LDKChannelKeys*)orig;
6804 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6805 *ret = ChannelKeys_clone(orig_conv);
6809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6810 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6811 FREE((void*)this_ptr);
6812 ChannelKeys_free(this_ptr_conv);
6815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6816 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6817 FREE((void*)this_ptr);
6818 KeysInterface_free(this_ptr_conv);
6821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6822 LDKInMemoryChannelKeys this_ptr_conv;
6823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6825 InMemoryChannelKeys_free(this_ptr_conv);
6828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6829 LDKInMemoryChannelKeys orig_conv;
6830 orig_conv.inner = (void*)(orig & (~1));
6831 orig_conv.is_owned = false;
6832 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6833 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6834 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6835 long ret_ref = (long)ret_var.inner;
6836 if (ret_var.is_owned) {
6842 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6843 LDKInMemoryChannelKeys this_ptr_conv;
6844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6845 this_ptr_conv.is_owned = false;
6846 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6847 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6852 LDKInMemoryChannelKeys this_ptr_conv;
6853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6854 this_ptr_conv.is_owned = false;
6855 LDKSecretKey val_ref;
6856 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6857 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6858 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6861 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6862 LDKInMemoryChannelKeys this_ptr_conv;
6863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6864 this_ptr_conv.is_owned = false;
6865 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6866 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6871 LDKInMemoryChannelKeys this_ptr_conv;
6872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6873 this_ptr_conv.is_owned = false;
6874 LDKSecretKey val_ref;
6875 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6876 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6877 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6880 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6881 LDKInMemoryChannelKeys this_ptr_conv;
6882 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6883 this_ptr_conv.is_owned = false;
6884 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6885 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6889 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6890 LDKInMemoryChannelKeys this_ptr_conv;
6891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6892 this_ptr_conv.is_owned = false;
6893 LDKSecretKey val_ref;
6894 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6895 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6896 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6899 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6900 LDKInMemoryChannelKeys this_ptr_conv;
6901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6902 this_ptr_conv.is_owned = false;
6903 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6904 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6909 LDKInMemoryChannelKeys this_ptr_conv;
6910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6911 this_ptr_conv.is_owned = false;
6912 LDKSecretKey val_ref;
6913 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6914 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6915 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6918 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6919 LDKInMemoryChannelKeys this_ptr_conv;
6920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6921 this_ptr_conv.is_owned = false;
6922 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6923 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6927 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6928 LDKInMemoryChannelKeys this_ptr_conv;
6929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6930 this_ptr_conv.is_owned = false;
6931 LDKSecretKey val_ref;
6932 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6933 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6934 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6937 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6938 LDKInMemoryChannelKeys this_ptr_conv;
6939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6940 this_ptr_conv.is_owned = false;
6941 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6942 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6947 LDKInMemoryChannelKeys this_ptr_conv;
6948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6949 this_ptr_conv.is_owned = false;
6950 LDKThirtyTwoBytes val_ref;
6951 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6952 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6953 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6956 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) {
6957 LDKSecretKey funding_key_ref;
6958 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6959 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6960 LDKSecretKey revocation_base_key_ref;
6961 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6962 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6963 LDKSecretKey payment_key_ref;
6964 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6965 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6966 LDKSecretKey delayed_payment_base_key_ref;
6967 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6968 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6969 LDKSecretKey htlc_base_key_ref;
6970 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6971 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6972 LDKThirtyTwoBytes commitment_seed_ref;
6973 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6974 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6975 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6976 FREE((void*)key_derivation_params);
6977 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);
6978 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6979 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6980 long ret_ref = (long)ret_var.inner;
6981 if (ret_var.is_owned) {
6987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6988 LDKInMemoryChannelKeys this_arg_conv;
6989 this_arg_conv.inner = (void*)(this_arg & (~1));
6990 this_arg_conv.is_owned = false;
6991 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6992 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6993 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6994 long ret_ref = (long)ret_var.inner;
6995 if (ret_var.is_owned) {
7001 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
7002 LDKInMemoryChannelKeys this_arg_conv;
7003 this_arg_conv.inner = (void*)(this_arg & (~1));
7004 this_arg_conv.is_owned = false;
7005 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
7009 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
7010 LDKInMemoryChannelKeys this_arg_conv;
7011 this_arg_conv.inner = (void*)(this_arg & (~1));
7012 this_arg_conv.is_owned = false;
7013 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
7017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
7018 LDKInMemoryChannelKeys this_arg_conv;
7019 this_arg_conv.inner = (void*)(this_arg & (~1));
7020 this_arg_conv.is_owned = false;
7021 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
7022 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
7026 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
7027 LDKInMemoryChannelKeys obj_conv;
7028 obj_conv.inner = (void*)(obj & (~1));
7029 obj_conv.is_owned = false;
7030 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
7031 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7032 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7033 CVec_u8Z_free(arg_var);
7037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
7039 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
7040 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
7041 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
7042 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7043 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7044 long ret_ref = (long)ret_var.inner;
7045 if (ret_var.is_owned) {
7048 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
7052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7053 LDKKeysManager this_ptr_conv;
7054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7056 KeysManager_free(this_ptr_conv);
7059 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) {
7060 unsigned char seed_arr[32];
7061 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
7062 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
7063 unsigned char (*seed_ref)[32] = &seed_arr;
7064 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7065 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
7066 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7067 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7068 long ret_ref = (long)ret_var.inner;
7069 if (ret_var.is_owned) {
7075 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) {
7076 LDKKeysManager this_arg_conv;
7077 this_arg_conv.inner = (void*)(this_arg & (~1));
7078 this_arg_conv.is_owned = false;
7079 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
7080 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7081 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7082 long ret_ref = (long)ret_var.inner;
7083 if (ret_var.is_owned) {
7089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
7090 LDKKeysManager this_arg_conv;
7091 this_arg_conv.inner = (void*)(this_arg & (~1));
7092 this_arg_conv.is_owned = false;
7093 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
7094 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
7098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7099 LDKChannelManager this_ptr_conv;
7100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7102 ChannelManager_free(this_ptr_conv);
7105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7106 LDKChannelDetails this_ptr_conv;
7107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7109 ChannelDetails_free(this_ptr_conv);
7112 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7113 LDKChannelDetails orig_conv;
7114 orig_conv.inner = (void*)(orig & (~1));
7115 orig_conv.is_owned = false;
7116 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
7117 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7118 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7119 long ret_ref = (long)ret_var.inner;
7120 if (ret_var.is_owned) {
7126 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7127 LDKChannelDetails this_ptr_conv;
7128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7129 this_ptr_conv.is_owned = false;
7130 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7131 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
7135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7136 LDKChannelDetails this_ptr_conv;
7137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7138 this_ptr_conv.is_owned = false;
7139 LDKThirtyTwoBytes val_ref;
7140 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7141 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7142 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7145 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7146 LDKChannelDetails this_ptr_conv;
7147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7148 this_ptr_conv.is_owned = false;
7149 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7150 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
7154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7155 LDKChannelDetails this_ptr_conv;
7156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7157 this_ptr_conv.is_owned = false;
7158 LDKPublicKey val_ref;
7159 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7160 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7161 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7165 LDKChannelDetails this_ptr_conv;
7166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7167 this_ptr_conv.is_owned = false;
7168 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7169 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7170 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7171 long ret_ref = (long)ret_var.inner;
7172 if (ret_var.is_owned) {
7178 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7179 LDKChannelDetails this_ptr_conv;
7180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7181 this_ptr_conv.is_owned = false;
7182 LDKInitFeatures val_conv;
7183 val_conv.inner = (void*)(val & (~1));
7184 val_conv.is_owned = (val & 1) || (val == 0);
7185 // Warning: we may need a move here but can't clone!
7186 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7190 LDKChannelDetails this_ptr_conv;
7191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7192 this_ptr_conv.is_owned = false;
7193 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7197 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7198 LDKChannelDetails this_ptr_conv;
7199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7200 this_ptr_conv.is_owned = false;
7201 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7205 LDKChannelDetails this_ptr_conv;
7206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7207 this_ptr_conv.is_owned = false;
7208 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7213 LDKChannelDetails this_ptr_conv;
7214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7215 this_ptr_conv.is_owned = false;
7216 ChannelDetails_set_user_id(&this_ptr_conv, val);
7219 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7220 LDKChannelDetails this_ptr_conv;
7221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7222 this_ptr_conv.is_owned = false;
7223 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7228 LDKChannelDetails this_ptr_conv;
7229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7230 this_ptr_conv.is_owned = false;
7231 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7234 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7235 LDKChannelDetails this_ptr_conv;
7236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7237 this_ptr_conv.is_owned = false;
7238 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7243 LDKChannelDetails this_ptr_conv;
7244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7245 this_ptr_conv.is_owned = false;
7246 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7249 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
7250 LDKChannelDetails this_ptr_conv;
7251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7252 this_ptr_conv.is_owned = false;
7253 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7258 LDKChannelDetails this_ptr_conv;
7259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7260 this_ptr_conv.is_owned = false;
7261 ChannelDetails_set_is_live(&this_ptr_conv, val);
7264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7265 LDKPaymentSendFailure this_ptr_conv;
7266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7268 PaymentSendFailure_free(this_ptr_conv);
7271 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) {
7272 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7273 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7274 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7275 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7276 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7278 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7279 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7280 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7281 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7283 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7284 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7285 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7286 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7288 LDKLogger logger_conv = *(LDKLogger*)logger;
7289 if (logger_conv.free == LDKLogger_JCalls_free) {
7290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7291 LDKLogger_JCalls_clone(logger_conv.this_arg);
7293 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7294 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7295 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7296 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7298 LDKUserConfig config_conv;
7299 config_conv.inner = (void*)(config & (~1));
7300 config_conv.is_owned = (config & 1) || (config == 0);
7301 if (config_conv.inner != NULL)
7302 config_conv = UserConfig_clone(&config_conv);
7303 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);
7304 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7305 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7306 long ret_ref = (long)ret_var.inner;
7307 if (ret_var.is_owned) {
7313 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) {
7314 LDKChannelManager this_arg_conv;
7315 this_arg_conv.inner = (void*)(this_arg & (~1));
7316 this_arg_conv.is_owned = false;
7317 LDKPublicKey their_network_key_ref;
7318 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7319 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7320 LDKUserConfig override_config_conv;
7321 override_config_conv.inner = (void*)(override_config & (~1));
7322 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7323 if (override_config_conv.inner != NULL)
7324 override_config_conv = UserConfig_clone(&override_config_conv);
7325 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7326 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7327 return (long)ret_conv;
7330 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7331 LDKChannelManager this_arg_conv;
7332 this_arg_conv.inner = (void*)(this_arg & (~1));
7333 this_arg_conv.is_owned = false;
7334 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7335 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7336 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7337 for (size_t q = 0; q < ret_var.datalen; q++) {
7338 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7339 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7340 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7341 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7342 if (arr_conv_16_var.is_owned) {
7343 arr_conv_16_ref |= 1;
7345 ret_arr_ptr[q] = arr_conv_16_ref;
7347 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7352 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7353 LDKChannelManager this_arg_conv;
7354 this_arg_conv.inner = (void*)(this_arg & (~1));
7355 this_arg_conv.is_owned = false;
7356 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7357 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7358 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7359 for (size_t q = 0; q < ret_var.datalen; q++) {
7360 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7361 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7362 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7363 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7364 if (arr_conv_16_var.is_owned) {
7365 arr_conv_16_ref |= 1;
7367 ret_arr_ptr[q] = arr_conv_16_ref;
7369 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7375 LDKChannelManager this_arg_conv;
7376 this_arg_conv.inner = (void*)(this_arg & (~1));
7377 this_arg_conv.is_owned = false;
7378 unsigned char channel_id_arr[32];
7379 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7380 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7381 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7382 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7383 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7384 return (long)ret_conv;
7387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7388 LDKChannelManager this_arg_conv;
7389 this_arg_conv.inner = (void*)(this_arg & (~1));
7390 this_arg_conv.is_owned = false;
7391 unsigned char channel_id_arr[32];
7392 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7393 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7394 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7395 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7399 LDKChannelManager this_arg_conv;
7400 this_arg_conv.inner = (void*)(this_arg & (~1));
7401 this_arg_conv.is_owned = false;
7402 ChannelManager_force_close_all_channels(&this_arg_conv);
7405 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) {
7406 LDKChannelManager this_arg_conv;
7407 this_arg_conv.inner = (void*)(this_arg & (~1));
7408 this_arg_conv.is_owned = false;
7409 LDKRoute route_conv;
7410 route_conv.inner = (void*)(route & (~1));
7411 route_conv.is_owned = false;
7412 LDKThirtyTwoBytes payment_hash_ref;
7413 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7414 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7415 LDKThirtyTwoBytes payment_secret_ref;
7416 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7417 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7418 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7419 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7420 return (long)ret_conv;
7423 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) {
7424 LDKChannelManager this_arg_conv;
7425 this_arg_conv.inner = (void*)(this_arg & (~1));
7426 this_arg_conv.is_owned = false;
7427 unsigned char temporary_channel_id_arr[32];
7428 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7429 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7430 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7431 LDKOutPoint funding_txo_conv;
7432 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7433 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7434 if (funding_txo_conv.inner != NULL)
7435 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7436 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7439 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) {
7440 LDKChannelManager this_arg_conv;
7441 this_arg_conv.inner = (void*)(this_arg & (~1));
7442 this_arg_conv.is_owned = false;
7443 LDKThreeBytes rgb_ref;
7444 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7445 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7446 LDKThirtyTwoBytes alias_ref;
7447 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7448 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7449 LDKCVec_NetAddressZ addresses_constr;
7450 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7451 if (addresses_constr.datalen > 0)
7452 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7454 addresses_constr.data = NULL;
7455 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7456 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7457 long arr_conv_12 = addresses_vals[m];
7458 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7459 FREE((void*)arr_conv_12);
7460 addresses_constr.data[m] = arr_conv_12_conv;
7462 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7463 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7467 LDKChannelManager this_arg_conv;
7468 this_arg_conv.inner = (void*)(this_arg & (~1));
7469 this_arg_conv.is_owned = false;
7470 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7474 LDKChannelManager this_arg_conv;
7475 this_arg_conv.inner = (void*)(this_arg & (~1));
7476 this_arg_conv.is_owned = false;
7477 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7480 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) {
7481 LDKChannelManager this_arg_conv;
7482 this_arg_conv.inner = (void*)(this_arg & (~1));
7483 this_arg_conv.is_owned = false;
7484 unsigned char payment_hash_arr[32];
7485 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7486 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7487 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7488 LDKThirtyTwoBytes payment_secret_ref;
7489 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7490 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7491 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7495 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) {
7496 LDKChannelManager this_arg_conv;
7497 this_arg_conv.inner = (void*)(this_arg & (~1));
7498 this_arg_conv.is_owned = false;
7499 LDKThirtyTwoBytes payment_preimage_ref;
7500 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7501 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7502 LDKThirtyTwoBytes payment_secret_ref;
7503 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7504 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7505 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7509 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7510 LDKChannelManager this_arg_conv;
7511 this_arg_conv.inner = (void*)(this_arg & (~1));
7512 this_arg_conv.is_owned = false;
7513 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7514 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7518 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) {
7519 LDKChannelManager this_arg_conv;
7520 this_arg_conv.inner = (void*)(this_arg & (~1));
7521 this_arg_conv.is_owned = false;
7522 LDKOutPoint funding_txo_conv;
7523 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7524 funding_txo_conv.is_owned = false;
7525 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7529 LDKChannelManager this_arg_conv;
7530 this_arg_conv.inner = (void*)(this_arg & (~1));
7531 this_arg_conv.is_owned = false;
7532 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7533 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7538 LDKChannelManager this_arg_conv;
7539 this_arg_conv.inner = (void*)(this_arg & (~1));
7540 this_arg_conv.is_owned = false;
7541 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7542 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7547 LDKChannelManager this_arg_conv;
7548 this_arg_conv.inner = (void*)(this_arg & (~1));
7549 this_arg_conv.is_owned = false;
7550 unsigned char header_arr[80];
7551 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7552 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7553 unsigned char (*header_ref)[80] = &header_arr;
7554 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7555 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7556 if (txdata_constr.datalen > 0)
7557 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7559 txdata_constr.data = NULL;
7560 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7561 for (size_t y = 0; y < txdata_constr.datalen; y++) {
7562 long arr_conv_24 = txdata_vals[y];
7563 LDKC2Tuple_usizeTransactionZ arr_conv_24_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_24;
7564 FREE((void*)arr_conv_24);
7565 txdata_constr.data[y] = arr_conv_24_conv;
7567 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7568 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7572 LDKChannelManager this_arg_conv;
7573 this_arg_conv.inner = (void*)(this_arg & (~1));
7574 this_arg_conv.is_owned = false;
7575 unsigned char header_arr[80];
7576 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7577 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7578 unsigned char (*header_ref)[80] = &header_arr;
7579 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7583 LDKChannelManager this_arg_conv;
7584 this_arg_conv.inner = (void*)(this_arg & (~1));
7585 this_arg_conv.is_owned = false;
7586 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7587 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7592 LDKChannelManagerReadArgs this_ptr_conv;
7593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7595 ChannelManagerReadArgs_free(this_ptr_conv);
7598 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7599 LDKChannelManagerReadArgs this_ptr_conv;
7600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7601 this_ptr_conv.is_owned = false;
7602 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7607 LDKChannelManagerReadArgs this_ptr_conv;
7608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7609 this_ptr_conv.is_owned = false;
7610 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7611 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7612 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7613 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7615 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7618 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7619 LDKChannelManagerReadArgs this_ptr_conv;
7620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7621 this_ptr_conv.is_owned = false;
7622 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7627 LDKChannelManagerReadArgs this_ptr_conv;
7628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7629 this_ptr_conv.is_owned = false;
7630 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7631 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7632 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7633 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7635 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7639 LDKChannelManagerReadArgs this_ptr_conv;
7640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7641 this_ptr_conv.is_owned = false;
7642 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7647 LDKChannelManagerReadArgs this_ptr_conv;
7648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7649 this_ptr_conv.is_owned = false;
7650 LDKWatch val_conv = *(LDKWatch*)val;
7651 if (val_conv.free == LDKWatch_JCalls_free) {
7652 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7653 LDKWatch_JCalls_clone(val_conv.this_arg);
7655 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7659 LDKChannelManagerReadArgs this_ptr_conv;
7660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7661 this_ptr_conv.is_owned = false;
7662 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7667 LDKChannelManagerReadArgs this_ptr_conv;
7668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7669 this_ptr_conv.is_owned = false;
7670 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7671 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7672 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7673 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7675 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7679 LDKChannelManagerReadArgs this_ptr_conv;
7680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7681 this_ptr_conv.is_owned = false;
7682 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7687 LDKChannelManagerReadArgs this_ptr_conv;
7688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7689 this_ptr_conv.is_owned = false;
7690 LDKLogger val_conv = *(LDKLogger*)val;
7691 if (val_conv.free == LDKLogger_JCalls_free) {
7692 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7693 LDKLogger_JCalls_clone(val_conv.this_arg);
7695 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7699 LDKChannelManagerReadArgs this_ptr_conv;
7700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7701 this_ptr_conv.is_owned = false;
7702 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7703 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7704 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7705 long ret_ref = (long)ret_var.inner;
7706 if (ret_var.is_owned) {
7712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7713 LDKChannelManagerReadArgs this_ptr_conv;
7714 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7715 this_ptr_conv.is_owned = false;
7716 LDKUserConfig val_conv;
7717 val_conv.inner = (void*)(val & (~1));
7718 val_conv.is_owned = (val & 1) || (val == 0);
7719 if (val_conv.inner != NULL)
7720 val_conv = UserConfig_clone(&val_conv);
7721 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7724 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) {
7725 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7726 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7727 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7728 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7730 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7731 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7732 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7733 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7735 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7736 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7737 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7738 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7740 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7741 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7742 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7743 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7745 LDKLogger logger_conv = *(LDKLogger*)logger;
7746 if (logger_conv.free == LDKLogger_JCalls_free) {
7747 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7748 LDKLogger_JCalls_clone(logger_conv.this_arg);
7750 LDKUserConfig default_config_conv;
7751 default_config_conv.inner = (void*)(default_config & (~1));
7752 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7753 if (default_config_conv.inner != NULL)
7754 default_config_conv = UserConfig_clone(&default_config_conv);
7755 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7756 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7757 if (channel_monitors_constr.datalen > 0)
7758 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7760 channel_monitors_constr.data = NULL;
7761 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7762 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7763 long arr_conv_16 = channel_monitors_vals[q];
7764 LDKChannelMonitor arr_conv_16_conv;
7765 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7766 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7767 channel_monitors_constr.data[q] = arr_conv_16_conv;
7769 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7770 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);
7771 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7772 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7773 long ret_ref = (long)ret_var.inner;
7774 if (ret_var.is_owned) {
7780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7781 LDKDecodeError this_ptr_conv;
7782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7784 DecodeError_free(this_ptr_conv);
7787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7788 LDKInit this_ptr_conv;
7789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7791 Init_free(this_ptr_conv);
7794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7796 orig_conv.inner = (void*)(orig & (~1));
7797 orig_conv.is_owned = false;
7798 LDKInit ret_var = Init_clone(&orig_conv);
7799 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7800 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7801 long ret_ref = (long)ret_var.inner;
7802 if (ret_var.is_owned) {
7808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7809 LDKErrorMessage this_ptr_conv;
7810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7812 ErrorMessage_free(this_ptr_conv);
7815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7816 LDKErrorMessage orig_conv;
7817 orig_conv.inner = (void*)(orig & (~1));
7818 orig_conv.is_owned = false;
7819 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7822 long ret_ref = (long)ret_var.inner;
7823 if (ret_var.is_owned) {
7829 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7830 LDKErrorMessage this_ptr_conv;
7831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7832 this_ptr_conv.is_owned = false;
7833 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7834 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7839 LDKErrorMessage this_ptr_conv;
7840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7841 this_ptr_conv.is_owned = false;
7842 LDKThirtyTwoBytes val_ref;
7843 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7844 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7845 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7848 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7849 LDKErrorMessage this_ptr_conv;
7850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7851 this_ptr_conv.is_owned = false;
7852 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7853 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7854 memcpy(_buf, _str.chars, _str.len);
7856 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7862 LDKErrorMessage this_ptr_conv;
7863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7864 this_ptr_conv.is_owned = false;
7865 LDKCVec_u8Z val_ref;
7866 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7867 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
7868 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
7869 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7873 LDKThirtyTwoBytes channel_id_arg_ref;
7874 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7875 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7876 LDKCVec_u8Z data_arg_ref;
7877 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7878 data_arg_ref.data = MALLOC(data_arg_ref.datalen, "LDKCVec_u8Z Bytes");
7879 (*_env)->GetByteArrayRegion(_env, data_arg, 0, data_arg_ref.datalen, data_arg_ref.data);
7880 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7881 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7882 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7883 long ret_ref = (long)ret_var.inner;
7884 if (ret_var.is_owned) {
7890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7891 LDKPing this_ptr_conv;
7892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7894 Ping_free(this_ptr_conv);
7897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7899 orig_conv.inner = (void*)(orig & (~1));
7900 orig_conv.is_owned = false;
7901 LDKPing ret_var = Ping_clone(&orig_conv);
7902 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7903 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7904 long ret_ref = (long)ret_var.inner;
7905 if (ret_var.is_owned) {
7911 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7912 LDKPing this_ptr_conv;
7913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7914 this_ptr_conv.is_owned = false;
7915 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7920 LDKPing this_ptr_conv;
7921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7922 this_ptr_conv.is_owned = false;
7923 Ping_set_ponglen(&this_ptr_conv, val);
7926 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7927 LDKPing this_ptr_conv;
7928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7929 this_ptr_conv.is_owned = false;
7930 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7935 LDKPing this_ptr_conv;
7936 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7937 this_ptr_conv.is_owned = false;
7938 Ping_set_byteslen(&this_ptr_conv, val);
7941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7942 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7943 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7944 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7945 long ret_ref = (long)ret_var.inner;
7946 if (ret_var.is_owned) {
7952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7953 LDKPong this_ptr_conv;
7954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7956 Pong_free(this_ptr_conv);
7959 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7961 orig_conv.inner = (void*)(orig & (~1));
7962 orig_conv.is_owned = false;
7963 LDKPong ret_var = Pong_clone(&orig_conv);
7964 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7965 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7966 long ret_ref = (long)ret_var.inner;
7967 if (ret_var.is_owned) {
7973 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7974 LDKPong this_ptr_conv;
7975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7976 this_ptr_conv.is_owned = false;
7977 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7981 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7982 LDKPong this_ptr_conv;
7983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7984 this_ptr_conv.is_owned = false;
7985 Pong_set_byteslen(&this_ptr_conv, val);
7988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7989 LDKPong ret_var = Pong_new(byteslen_arg);
7990 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7991 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7992 long ret_ref = (long)ret_var.inner;
7993 if (ret_var.is_owned) {
7999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8000 LDKOpenChannel this_ptr_conv;
8001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8003 OpenChannel_free(this_ptr_conv);
8006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8007 LDKOpenChannel orig_conv;
8008 orig_conv.inner = (void*)(orig & (~1));
8009 orig_conv.is_owned = false;
8010 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
8011 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8012 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8013 long ret_ref = (long)ret_var.inner;
8014 if (ret_var.is_owned) {
8020 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8021 LDKOpenChannel this_ptr_conv;
8022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8023 this_ptr_conv.is_owned = false;
8024 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8025 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
8029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8030 LDKOpenChannel this_ptr_conv;
8031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8032 this_ptr_conv.is_owned = false;
8033 LDKThirtyTwoBytes val_ref;
8034 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8035 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8036 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
8039 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8040 LDKOpenChannel this_ptr_conv;
8041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8042 this_ptr_conv.is_owned = false;
8043 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8044 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
8048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8049 LDKOpenChannel this_ptr_conv;
8050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8051 this_ptr_conv.is_owned = false;
8052 LDKThirtyTwoBytes val_ref;
8053 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8054 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8055 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8059 LDKOpenChannel this_ptr_conv;
8060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8061 this_ptr_conv.is_owned = false;
8062 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
8066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8067 LDKOpenChannel this_ptr_conv;
8068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8069 this_ptr_conv.is_owned = false;
8070 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
8073 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8074 LDKOpenChannel this_ptr_conv;
8075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8076 this_ptr_conv.is_owned = false;
8077 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
8081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8082 LDKOpenChannel this_ptr_conv;
8083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8084 this_ptr_conv.is_owned = false;
8085 OpenChannel_set_push_msat(&this_ptr_conv, val);
8088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8089 LDKOpenChannel this_ptr_conv;
8090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8091 this_ptr_conv.is_owned = false;
8092 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
8096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8097 LDKOpenChannel this_ptr_conv;
8098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8099 this_ptr_conv.is_owned = false;
8100 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8104 LDKOpenChannel this_ptr_conv;
8105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8106 this_ptr_conv.is_owned = false;
8107 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8111 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) {
8112 LDKOpenChannel this_ptr_conv;
8113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8114 this_ptr_conv.is_owned = false;
8115 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8119 LDKOpenChannel this_ptr_conv;
8120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8121 this_ptr_conv.is_owned = false;
8122 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8127 LDKOpenChannel this_ptr_conv;
8128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8129 this_ptr_conv.is_owned = false;
8130 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8133 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8134 LDKOpenChannel this_ptr_conv;
8135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8136 this_ptr_conv.is_owned = false;
8137 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8142 LDKOpenChannel this_ptr_conv;
8143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8144 this_ptr_conv.is_owned = false;
8145 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8148 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8149 LDKOpenChannel this_ptr_conv;
8150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8151 this_ptr_conv.is_owned = false;
8152 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8157 LDKOpenChannel this_ptr_conv;
8158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8159 this_ptr_conv.is_owned = false;
8160 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8163 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8164 LDKOpenChannel this_ptr_conv;
8165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8166 this_ptr_conv.is_owned = false;
8167 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8172 LDKOpenChannel this_ptr_conv;
8173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8174 this_ptr_conv.is_owned = false;
8175 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8178 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8179 LDKOpenChannel this_ptr_conv;
8180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8181 this_ptr_conv.is_owned = false;
8182 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8187 LDKOpenChannel this_ptr_conv;
8188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8189 this_ptr_conv.is_owned = false;
8190 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8193 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8194 LDKOpenChannel this_ptr_conv;
8195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8196 this_ptr_conv.is_owned = false;
8197 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8198 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8203 LDKOpenChannel this_ptr_conv;
8204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8205 this_ptr_conv.is_owned = false;
8206 LDKPublicKey val_ref;
8207 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8208 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8209 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8212 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8213 LDKOpenChannel this_ptr_conv;
8214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8215 this_ptr_conv.is_owned = false;
8216 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8217 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8222 LDKOpenChannel this_ptr_conv;
8223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8224 this_ptr_conv.is_owned = false;
8225 LDKPublicKey val_ref;
8226 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8227 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8228 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8231 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8232 LDKOpenChannel this_ptr_conv;
8233 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8234 this_ptr_conv.is_owned = false;
8235 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8236 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
8240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8241 LDKOpenChannel this_ptr_conv;
8242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8243 this_ptr_conv.is_owned = false;
8244 LDKPublicKey val_ref;
8245 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8246 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8247 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8250 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8251 LDKOpenChannel this_ptr_conv;
8252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8253 this_ptr_conv.is_owned = false;
8254 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8255 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8260 LDKOpenChannel this_ptr_conv;
8261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8262 this_ptr_conv.is_owned = false;
8263 LDKPublicKey val_ref;
8264 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8265 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8266 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8269 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8270 LDKOpenChannel this_ptr_conv;
8271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8272 this_ptr_conv.is_owned = false;
8273 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8274 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8278 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8279 LDKOpenChannel this_ptr_conv;
8280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8281 this_ptr_conv.is_owned = false;
8282 LDKPublicKey val_ref;
8283 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8284 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8285 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8288 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8289 LDKOpenChannel this_ptr_conv;
8290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8291 this_ptr_conv.is_owned = false;
8292 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8293 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8298 LDKOpenChannel this_ptr_conv;
8299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8300 this_ptr_conv.is_owned = false;
8301 LDKPublicKey val_ref;
8302 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8303 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8304 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8307 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8308 LDKOpenChannel this_ptr_conv;
8309 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8310 this_ptr_conv.is_owned = false;
8311 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8316 LDKOpenChannel this_ptr_conv;
8317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8318 this_ptr_conv.is_owned = false;
8319 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8323 LDKAcceptChannel this_ptr_conv;
8324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8326 AcceptChannel_free(this_ptr_conv);
8329 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8330 LDKAcceptChannel orig_conv;
8331 orig_conv.inner = (void*)(orig & (~1));
8332 orig_conv.is_owned = false;
8333 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8334 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8335 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8336 long ret_ref = (long)ret_var.inner;
8337 if (ret_var.is_owned) {
8343 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8344 LDKAcceptChannel this_ptr_conv;
8345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8346 this_ptr_conv.is_owned = false;
8347 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8348 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8353 LDKAcceptChannel this_ptr_conv;
8354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8355 this_ptr_conv.is_owned = false;
8356 LDKThirtyTwoBytes val_ref;
8357 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8358 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8359 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8363 LDKAcceptChannel this_ptr_conv;
8364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8365 this_ptr_conv.is_owned = false;
8366 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8371 LDKAcceptChannel this_ptr_conv;
8372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8373 this_ptr_conv.is_owned = false;
8374 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8377 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8378 LDKAcceptChannel this_ptr_conv;
8379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8380 this_ptr_conv.is_owned = false;
8381 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8385 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) {
8386 LDKAcceptChannel this_ptr_conv;
8387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8388 this_ptr_conv.is_owned = false;
8389 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8392 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8393 LDKAcceptChannel this_ptr_conv;
8394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8395 this_ptr_conv.is_owned = false;
8396 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8401 LDKAcceptChannel this_ptr_conv;
8402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8403 this_ptr_conv.is_owned = false;
8404 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8408 LDKAcceptChannel this_ptr_conv;
8409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8410 this_ptr_conv.is_owned = false;
8411 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8416 LDKAcceptChannel this_ptr_conv;
8417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8418 this_ptr_conv.is_owned = false;
8419 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8422 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8423 LDKAcceptChannel this_ptr_conv;
8424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8425 this_ptr_conv.is_owned = false;
8426 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8431 LDKAcceptChannel this_ptr_conv;
8432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8433 this_ptr_conv.is_owned = false;
8434 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8437 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8438 LDKAcceptChannel this_ptr_conv;
8439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8440 this_ptr_conv.is_owned = false;
8441 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8446 LDKAcceptChannel this_ptr_conv;
8447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8448 this_ptr_conv.is_owned = false;
8449 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8452 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8453 LDKAcceptChannel this_ptr_conv;
8454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8455 this_ptr_conv.is_owned = false;
8456 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8461 LDKAcceptChannel this_ptr_conv;
8462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8463 this_ptr_conv.is_owned = false;
8464 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8468 LDKAcceptChannel this_ptr_conv;
8469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8470 this_ptr_conv.is_owned = false;
8471 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8472 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8477 LDKAcceptChannel this_ptr_conv;
8478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8479 this_ptr_conv.is_owned = false;
8480 LDKPublicKey val_ref;
8481 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8482 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8483 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8486 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8487 LDKAcceptChannel this_ptr_conv;
8488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8489 this_ptr_conv.is_owned = false;
8490 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8491 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8496 LDKAcceptChannel this_ptr_conv;
8497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8498 this_ptr_conv.is_owned = false;
8499 LDKPublicKey val_ref;
8500 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8501 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8502 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8505 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8506 LDKAcceptChannel this_ptr_conv;
8507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8508 this_ptr_conv.is_owned = false;
8509 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8510 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8515 LDKAcceptChannel this_ptr_conv;
8516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8517 this_ptr_conv.is_owned = false;
8518 LDKPublicKey val_ref;
8519 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8520 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8521 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8524 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8525 LDKAcceptChannel this_ptr_conv;
8526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8527 this_ptr_conv.is_owned = false;
8528 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8529 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8533 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8534 LDKAcceptChannel this_ptr_conv;
8535 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8536 this_ptr_conv.is_owned = false;
8537 LDKPublicKey val_ref;
8538 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8539 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8540 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8543 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8544 LDKAcceptChannel this_ptr_conv;
8545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8546 this_ptr_conv.is_owned = false;
8547 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8548 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8553 LDKAcceptChannel this_ptr_conv;
8554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8555 this_ptr_conv.is_owned = false;
8556 LDKPublicKey val_ref;
8557 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8558 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8559 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8562 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8563 LDKAcceptChannel this_ptr_conv;
8564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8565 this_ptr_conv.is_owned = false;
8566 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8567 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8572 LDKAcceptChannel this_ptr_conv;
8573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8574 this_ptr_conv.is_owned = false;
8575 LDKPublicKey val_ref;
8576 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8577 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8578 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8582 LDKFundingCreated this_ptr_conv;
8583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8585 FundingCreated_free(this_ptr_conv);
8588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8589 LDKFundingCreated orig_conv;
8590 orig_conv.inner = (void*)(orig & (~1));
8591 orig_conv.is_owned = false;
8592 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8595 long ret_ref = (long)ret_var.inner;
8596 if (ret_var.is_owned) {
8602 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8603 LDKFundingCreated this_ptr_conv;
8604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8605 this_ptr_conv.is_owned = false;
8606 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8607 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8612 LDKFundingCreated this_ptr_conv;
8613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8614 this_ptr_conv.is_owned = false;
8615 LDKThirtyTwoBytes val_ref;
8616 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8617 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8618 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8621 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8622 LDKFundingCreated this_ptr_conv;
8623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8624 this_ptr_conv.is_owned = false;
8625 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8626 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8631 LDKFundingCreated this_ptr_conv;
8632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8633 this_ptr_conv.is_owned = false;
8634 LDKThirtyTwoBytes val_ref;
8635 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8636 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8637 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8640 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8641 LDKFundingCreated this_ptr_conv;
8642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8643 this_ptr_conv.is_owned = false;
8644 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8649 LDKFundingCreated this_ptr_conv;
8650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8651 this_ptr_conv.is_owned = false;
8652 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8655 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8656 LDKFundingCreated this_ptr_conv;
8657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8658 this_ptr_conv.is_owned = false;
8659 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8660 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8665 LDKFundingCreated this_ptr_conv;
8666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8667 this_ptr_conv.is_owned = false;
8668 LDKSignature val_ref;
8669 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8670 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8671 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8674 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) {
8675 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8676 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8677 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8678 LDKThirtyTwoBytes funding_txid_arg_ref;
8679 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8680 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8681 LDKSignature signature_arg_ref;
8682 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8683 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8684 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8685 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8686 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8687 long ret_ref = (long)ret_var.inner;
8688 if (ret_var.is_owned) {
8694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8695 LDKFundingSigned this_ptr_conv;
8696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8698 FundingSigned_free(this_ptr_conv);
8701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8702 LDKFundingSigned orig_conv;
8703 orig_conv.inner = (void*)(orig & (~1));
8704 orig_conv.is_owned = false;
8705 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8706 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8707 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8708 long ret_ref = (long)ret_var.inner;
8709 if (ret_var.is_owned) {
8715 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8716 LDKFundingSigned this_ptr_conv;
8717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8718 this_ptr_conv.is_owned = false;
8719 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8720 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8725 LDKFundingSigned this_ptr_conv;
8726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8727 this_ptr_conv.is_owned = false;
8728 LDKThirtyTwoBytes val_ref;
8729 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8730 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8731 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8734 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8735 LDKFundingSigned this_ptr_conv;
8736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8737 this_ptr_conv.is_owned = false;
8738 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8739 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8744 LDKFundingSigned this_ptr_conv;
8745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8746 this_ptr_conv.is_owned = false;
8747 LDKSignature val_ref;
8748 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8749 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8750 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8754 LDKThirtyTwoBytes channel_id_arg_ref;
8755 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8756 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8757 LDKSignature signature_arg_ref;
8758 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8759 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8760 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8761 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8762 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8763 long ret_ref = (long)ret_var.inner;
8764 if (ret_var.is_owned) {
8770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8771 LDKFundingLocked this_ptr_conv;
8772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8774 FundingLocked_free(this_ptr_conv);
8777 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8778 LDKFundingLocked orig_conv;
8779 orig_conv.inner = (void*)(orig & (~1));
8780 orig_conv.is_owned = false;
8781 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8782 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8783 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8784 long ret_ref = (long)ret_var.inner;
8785 if (ret_var.is_owned) {
8791 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8792 LDKFundingLocked this_ptr_conv;
8793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8794 this_ptr_conv.is_owned = false;
8795 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8796 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8801 LDKFundingLocked this_ptr_conv;
8802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8803 this_ptr_conv.is_owned = false;
8804 LDKThirtyTwoBytes val_ref;
8805 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8806 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8807 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8810 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8811 LDKFundingLocked this_ptr_conv;
8812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8813 this_ptr_conv.is_owned = false;
8814 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8815 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8820 LDKFundingLocked this_ptr_conv;
8821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8822 this_ptr_conv.is_owned = false;
8823 LDKPublicKey val_ref;
8824 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8825 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8826 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8829 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8830 LDKThirtyTwoBytes channel_id_arg_ref;
8831 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8832 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8833 LDKPublicKey next_per_commitment_point_arg_ref;
8834 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8835 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8836 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8837 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8838 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8839 long ret_ref = (long)ret_var.inner;
8840 if (ret_var.is_owned) {
8846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8847 LDKShutdown this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8850 Shutdown_free(this_ptr_conv);
8853 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8854 LDKShutdown orig_conv;
8855 orig_conv.inner = (void*)(orig & (~1));
8856 orig_conv.is_owned = false;
8857 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8858 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8859 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8860 long ret_ref = (long)ret_var.inner;
8861 if (ret_var.is_owned) {
8867 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8868 LDKShutdown this_ptr_conv;
8869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8870 this_ptr_conv.is_owned = false;
8871 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8872 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8877 LDKShutdown this_ptr_conv;
8878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8879 this_ptr_conv.is_owned = false;
8880 LDKThirtyTwoBytes val_ref;
8881 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8882 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8883 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8886 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8887 LDKShutdown this_ptr_conv;
8888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8889 this_ptr_conv.is_owned = false;
8890 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8891 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8892 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8897 LDKShutdown this_ptr_conv;
8898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8899 this_ptr_conv.is_owned = false;
8900 LDKCVec_u8Z val_ref;
8901 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8902 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
8903 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
8904 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8908 LDKThirtyTwoBytes channel_id_arg_ref;
8909 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8910 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8911 LDKCVec_u8Z scriptpubkey_arg_ref;
8912 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8913 scriptpubkey_arg_ref.data = MALLOC(scriptpubkey_arg_ref.datalen, "LDKCVec_u8Z Bytes");
8914 (*_env)->GetByteArrayRegion(_env, scriptpubkey_arg, 0, scriptpubkey_arg_ref.datalen, scriptpubkey_arg_ref.data);
8915 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8916 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8917 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8918 long ret_ref = (long)ret_var.inner;
8919 if (ret_var.is_owned) {
8925 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8926 LDKClosingSigned this_ptr_conv;
8927 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8928 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8929 ClosingSigned_free(this_ptr_conv);
8932 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8933 LDKClosingSigned orig_conv;
8934 orig_conv.inner = (void*)(orig & (~1));
8935 orig_conv.is_owned = false;
8936 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8937 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8938 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8939 long ret_ref = (long)ret_var.inner;
8940 if (ret_var.is_owned) {
8946 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8947 LDKClosingSigned this_ptr_conv;
8948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8949 this_ptr_conv.is_owned = false;
8950 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8951 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8956 LDKClosingSigned this_ptr_conv;
8957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8958 this_ptr_conv.is_owned = false;
8959 LDKThirtyTwoBytes val_ref;
8960 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8961 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8962 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8965 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8966 LDKClosingSigned this_ptr_conv;
8967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8968 this_ptr_conv.is_owned = false;
8969 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8974 LDKClosingSigned this_ptr_conv;
8975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8976 this_ptr_conv.is_owned = false;
8977 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8980 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8981 LDKClosingSigned this_ptr_conv;
8982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8983 this_ptr_conv.is_owned = false;
8984 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8985 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8990 LDKClosingSigned this_ptr_conv;
8991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8992 this_ptr_conv.is_owned = false;
8993 LDKSignature val_ref;
8994 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8995 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8996 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8999 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) {
9000 LDKThirtyTwoBytes channel_id_arg_ref;
9001 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9002 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9003 LDKSignature signature_arg_ref;
9004 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9005 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9006 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
9007 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9008 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9009 long ret_ref = (long)ret_var.inner;
9010 if (ret_var.is_owned) {
9016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9017 LDKUpdateAddHTLC this_ptr_conv;
9018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9020 UpdateAddHTLC_free(this_ptr_conv);
9023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9024 LDKUpdateAddHTLC orig_conv;
9025 orig_conv.inner = (void*)(orig & (~1));
9026 orig_conv.is_owned = false;
9027 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
9028 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9029 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9030 long ret_ref = (long)ret_var.inner;
9031 if (ret_var.is_owned) {
9037 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9038 LDKUpdateAddHTLC this_ptr_conv;
9039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9040 this_ptr_conv.is_owned = false;
9041 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9042 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
9046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9047 LDKUpdateAddHTLC this_ptr_conv;
9048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9049 this_ptr_conv.is_owned = false;
9050 LDKThirtyTwoBytes val_ref;
9051 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9052 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9053 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
9056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9057 LDKUpdateAddHTLC this_ptr_conv;
9058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9059 this_ptr_conv.is_owned = false;
9060 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
9064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9065 LDKUpdateAddHTLC this_ptr_conv;
9066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9067 this_ptr_conv.is_owned = false;
9068 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
9071 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9072 LDKUpdateAddHTLC this_ptr_conv;
9073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9074 this_ptr_conv.is_owned = false;
9075 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
9079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9080 LDKUpdateAddHTLC this_ptr_conv;
9081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9082 this_ptr_conv.is_owned = false;
9083 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
9086 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9087 LDKUpdateAddHTLC this_ptr_conv;
9088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9089 this_ptr_conv.is_owned = false;
9090 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9091 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
9095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9096 LDKUpdateAddHTLC this_ptr_conv;
9097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9098 this_ptr_conv.is_owned = false;
9099 LDKThirtyTwoBytes val_ref;
9100 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9101 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9102 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
9105 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
9106 LDKUpdateAddHTLC this_ptr_conv;
9107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9108 this_ptr_conv.is_owned = false;
9109 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
9113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9114 LDKUpdateAddHTLC this_ptr_conv;
9115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9116 this_ptr_conv.is_owned = false;
9117 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9121 LDKUpdateFulfillHTLC this_ptr_conv;
9122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9124 UpdateFulfillHTLC_free(this_ptr_conv);
9127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9128 LDKUpdateFulfillHTLC orig_conv;
9129 orig_conv.inner = (void*)(orig & (~1));
9130 orig_conv.is_owned = false;
9131 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9134 long ret_ref = (long)ret_var.inner;
9135 if (ret_var.is_owned) {
9141 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9142 LDKUpdateFulfillHTLC this_ptr_conv;
9143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9144 this_ptr_conv.is_owned = false;
9145 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9146 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
9150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9151 LDKUpdateFulfillHTLC this_ptr_conv;
9152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9153 this_ptr_conv.is_owned = false;
9154 LDKThirtyTwoBytes val_ref;
9155 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9156 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9157 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9161 LDKUpdateFulfillHTLC this_ptr_conv;
9162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9163 this_ptr_conv.is_owned = false;
9164 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9169 LDKUpdateFulfillHTLC this_ptr_conv;
9170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9171 this_ptr_conv.is_owned = false;
9172 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9175 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
9176 LDKUpdateFulfillHTLC this_ptr_conv;
9177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9178 this_ptr_conv.is_owned = false;
9179 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9180 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
9184 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9185 LDKUpdateFulfillHTLC this_ptr_conv;
9186 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9187 this_ptr_conv.is_owned = false;
9188 LDKThirtyTwoBytes val_ref;
9189 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9190 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9191 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9194 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) {
9195 LDKThirtyTwoBytes channel_id_arg_ref;
9196 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9197 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9198 LDKThirtyTwoBytes payment_preimage_arg_ref;
9199 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
9200 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
9201 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9202 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9203 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9204 long ret_ref = (long)ret_var.inner;
9205 if (ret_var.is_owned) {
9211 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9212 LDKUpdateFailHTLC this_ptr_conv;
9213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9215 UpdateFailHTLC_free(this_ptr_conv);
9218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9219 LDKUpdateFailHTLC orig_conv;
9220 orig_conv.inner = (void*)(orig & (~1));
9221 orig_conv.is_owned = false;
9222 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9223 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9224 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9225 long ret_ref = (long)ret_var.inner;
9226 if (ret_var.is_owned) {
9232 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9233 LDKUpdateFailHTLC this_ptr_conv;
9234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9235 this_ptr_conv.is_owned = false;
9236 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9237 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
9241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9242 LDKUpdateFailHTLC this_ptr_conv;
9243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9244 this_ptr_conv.is_owned = false;
9245 LDKThirtyTwoBytes val_ref;
9246 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9247 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9248 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9251 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9252 LDKUpdateFailHTLC this_ptr_conv;
9253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9254 this_ptr_conv.is_owned = false;
9255 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9259 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9260 LDKUpdateFailHTLC this_ptr_conv;
9261 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9262 this_ptr_conv.is_owned = false;
9263 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9267 LDKUpdateFailMalformedHTLC this_ptr_conv;
9268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9270 UpdateFailMalformedHTLC_free(this_ptr_conv);
9273 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9274 LDKUpdateFailMalformedHTLC orig_conv;
9275 orig_conv.inner = (void*)(orig & (~1));
9276 orig_conv.is_owned = false;
9277 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9278 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9279 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9280 long ret_ref = (long)ret_var.inner;
9281 if (ret_var.is_owned) {
9287 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9288 LDKUpdateFailMalformedHTLC this_ptr_conv;
9289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9290 this_ptr_conv.is_owned = false;
9291 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9292 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9297 LDKUpdateFailMalformedHTLC this_ptr_conv;
9298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9299 this_ptr_conv.is_owned = false;
9300 LDKThirtyTwoBytes val_ref;
9301 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9302 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9303 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9306 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9307 LDKUpdateFailMalformedHTLC this_ptr_conv;
9308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9309 this_ptr_conv.is_owned = false;
9310 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9315 LDKUpdateFailMalformedHTLC this_ptr_conv;
9316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9317 this_ptr_conv.is_owned = false;
9318 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9321 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
9322 LDKUpdateFailMalformedHTLC this_ptr_conv;
9323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9324 this_ptr_conv.is_owned = false;
9325 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9330 LDKUpdateFailMalformedHTLC this_ptr_conv;
9331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9332 this_ptr_conv.is_owned = false;
9333 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9337 LDKCommitmentSigned this_ptr_conv;
9338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9340 CommitmentSigned_free(this_ptr_conv);
9343 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9344 LDKCommitmentSigned orig_conv;
9345 orig_conv.inner = (void*)(orig & (~1));
9346 orig_conv.is_owned = false;
9347 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9348 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9349 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9350 long ret_ref = (long)ret_var.inner;
9351 if (ret_var.is_owned) {
9357 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9358 LDKCommitmentSigned this_ptr_conv;
9359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9360 this_ptr_conv.is_owned = false;
9361 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9362 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9367 LDKCommitmentSigned this_ptr_conv;
9368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9369 this_ptr_conv.is_owned = false;
9370 LDKThirtyTwoBytes val_ref;
9371 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9372 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9373 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9376 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9377 LDKCommitmentSigned this_ptr_conv;
9378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9379 this_ptr_conv.is_owned = false;
9380 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9381 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9386 LDKCommitmentSigned this_ptr_conv;
9387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9388 this_ptr_conv.is_owned = false;
9389 LDKSignature val_ref;
9390 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9391 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9392 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9396 LDKCommitmentSigned this_ptr_conv;
9397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9398 this_ptr_conv.is_owned = false;
9399 LDKCVec_SignatureZ val_constr;
9400 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9401 if (val_constr.datalen > 0)
9402 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9404 val_constr.data = NULL;
9405 for (size_t i = 0; i < val_constr.datalen; i++) {
9406 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9407 LDKSignature arr_conv_8_ref;
9408 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9409 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9410 val_constr.data[i] = arr_conv_8_ref;
9412 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9415 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) {
9416 LDKThirtyTwoBytes channel_id_arg_ref;
9417 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9418 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9419 LDKSignature signature_arg_ref;
9420 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9421 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9422 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9423 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9424 if (htlc_signatures_arg_constr.datalen > 0)
9425 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9427 htlc_signatures_arg_constr.data = NULL;
9428 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9429 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9430 LDKSignature arr_conv_8_ref;
9431 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9432 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9433 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9435 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9436 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9437 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9438 long ret_ref = (long)ret_var.inner;
9439 if (ret_var.is_owned) {
9445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9446 LDKRevokeAndACK this_ptr_conv;
9447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9449 RevokeAndACK_free(this_ptr_conv);
9452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9453 LDKRevokeAndACK orig_conv;
9454 orig_conv.inner = (void*)(orig & (~1));
9455 orig_conv.is_owned = false;
9456 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9457 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9458 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9459 long ret_ref = (long)ret_var.inner;
9460 if (ret_var.is_owned) {
9466 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9467 LDKRevokeAndACK this_ptr_conv;
9468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9469 this_ptr_conv.is_owned = false;
9470 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9471 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9476 LDKRevokeAndACK this_ptr_conv;
9477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9478 this_ptr_conv.is_owned = false;
9479 LDKThirtyTwoBytes val_ref;
9480 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9481 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9482 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9485 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9486 LDKRevokeAndACK this_ptr_conv;
9487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9488 this_ptr_conv.is_owned = false;
9489 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9490 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9495 LDKRevokeAndACK this_ptr_conv;
9496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9497 this_ptr_conv.is_owned = false;
9498 LDKThirtyTwoBytes val_ref;
9499 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9500 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9501 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9504 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9505 LDKRevokeAndACK this_ptr_conv;
9506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9507 this_ptr_conv.is_owned = false;
9508 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9509 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9514 LDKRevokeAndACK this_ptr_conv;
9515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9516 this_ptr_conv.is_owned = false;
9517 LDKPublicKey val_ref;
9518 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9519 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9520 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9523 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) {
9524 LDKThirtyTwoBytes channel_id_arg_ref;
9525 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9526 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9527 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9528 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9529 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9530 LDKPublicKey next_per_commitment_point_arg_ref;
9531 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9532 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9533 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9534 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9535 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9536 long ret_ref = (long)ret_var.inner;
9537 if (ret_var.is_owned) {
9543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9544 LDKUpdateFee this_ptr_conv;
9545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9547 UpdateFee_free(this_ptr_conv);
9550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9551 LDKUpdateFee orig_conv;
9552 orig_conv.inner = (void*)(orig & (~1));
9553 orig_conv.is_owned = false;
9554 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9555 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9556 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9557 long ret_ref = (long)ret_var.inner;
9558 if (ret_var.is_owned) {
9564 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9565 LDKUpdateFee this_ptr_conv;
9566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9567 this_ptr_conv.is_owned = false;
9568 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9569 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9574 LDKUpdateFee this_ptr_conv;
9575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9576 this_ptr_conv.is_owned = false;
9577 LDKThirtyTwoBytes val_ref;
9578 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9579 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9580 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9583 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9584 LDKUpdateFee this_ptr_conv;
9585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9586 this_ptr_conv.is_owned = false;
9587 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9592 LDKUpdateFee this_ptr_conv;
9593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9594 this_ptr_conv.is_owned = false;
9595 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9598 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9599 LDKThirtyTwoBytes channel_id_arg_ref;
9600 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9601 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9602 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9603 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9604 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9605 long ret_ref = (long)ret_var.inner;
9606 if (ret_var.is_owned) {
9612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9613 LDKDataLossProtect this_ptr_conv;
9614 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9615 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9616 DataLossProtect_free(this_ptr_conv);
9619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9620 LDKDataLossProtect orig_conv;
9621 orig_conv.inner = (void*)(orig & (~1));
9622 orig_conv.is_owned = false;
9623 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9624 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9625 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9626 long ret_ref = (long)ret_var.inner;
9627 if (ret_var.is_owned) {
9633 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9634 LDKDataLossProtect this_ptr_conv;
9635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9636 this_ptr_conv.is_owned = false;
9637 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9638 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9643 LDKDataLossProtect this_ptr_conv;
9644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9645 this_ptr_conv.is_owned = false;
9646 LDKThirtyTwoBytes val_ref;
9647 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9648 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9649 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9652 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9653 LDKDataLossProtect this_ptr_conv;
9654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9655 this_ptr_conv.is_owned = false;
9656 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9657 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9662 LDKDataLossProtect this_ptr_conv;
9663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9664 this_ptr_conv.is_owned = false;
9665 LDKPublicKey val_ref;
9666 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9667 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9668 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9671 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) {
9672 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9673 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9674 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9675 LDKPublicKey my_current_per_commitment_point_arg_ref;
9676 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9677 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9678 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9679 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9680 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9681 long ret_ref = (long)ret_var.inner;
9682 if (ret_var.is_owned) {
9688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9689 LDKChannelReestablish this_ptr_conv;
9690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9692 ChannelReestablish_free(this_ptr_conv);
9695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9696 LDKChannelReestablish orig_conv;
9697 orig_conv.inner = (void*)(orig & (~1));
9698 orig_conv.is_owned = false;
9699 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9700 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9701 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9702 long ret_ref = (long)ret_var.inner;
9703 if (ret_var.is_owned) {
9709 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9710 LDKChannelReestablish this_ptr_conv;
9711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9712 this_ptr_conv.is_owned = false;
9713 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9714 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9719 LDKChannelReestablish this_ptr_conv;
9720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9721 this_ptr_conv.is_owned = false;
9722 LDKThirtyTwoBytes val_ref;
9723 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9724 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9725 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9729 LDKChannelReestablish this_ptr_conv;
9730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9731 this_ptr_conv.is_owned = false;
9732 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9737 LDKChannelReestablish this_ptr_conv;
9738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9739 this_ptr_conv.is_owned = false;
9740 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9743 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9744 LDKChannelReestablish this_ptr_conv;
9745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9746 this_ptr_conv.is_owned = false;
9747 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9752 LDKChannelReestablish this_ptr_conv;
9753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9754 this_ptr_conv.is_owned = false;
9755 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9759 LDKAnnouncementSignatures this_ptr_conv;
9760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9762 AnnouncementSignatures_free(this_ptr_conv);
9765 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9766 LDKAnnouncementSignatures orig_conv;
9767 orig_conv.inner = (void*)(orig & (~1));
9768 orig_conv.is_owned = false;
9769 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9770 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9771 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9772 long ret_ref = (long)ret_var.inner;
9773 if (ret_var.is_owned) {
9779 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9780 LDKAnnouncementSignatures this_ptr_conv;
9781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9782 this_ptr_conv.is_owned = false;
9783 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9784 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9789 LDKAnnouncementSignatures this_ptr_conv;
9790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9791 this_ptr_conv.is_owned = false;
9792 LDKThirtyTwoBytes val_ref;
9793 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9794 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9795 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9798 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9799 LDKAnnouncementSignatures this_ptr_conv;
9800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9801 this_ptr_conv.is_owned = false;
9802 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9807 LDKAnnouncementSignatures this_ptr_conv;
9808 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9809 this_ptr_conv.is_owned = false;
9810 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9813 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9814 LDKAnnouncementSignatures this_ptr_conv;
9815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9816 this_ptr_conv.is_owned = false;
9817 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9818 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9823 LDKAnnouncementSignatures this_ptr_conv;
9824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9825 this_ptr_conv.is_owned = false;
9826 LDKSignature val_ref;
9827 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9828 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9829 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9832 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9833 LDKAnnouncementSignatures this_ptr_conv;
9834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9835 this_ptr_conv.is_owned = false;
9836 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9837 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9842 LDKAnnouncementSignatures this_ptr_conv;
9843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9844 this_ptr_conv.is_owned = false;
9845 LDKSignature val_ref;
9846 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9847 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9848 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9851 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) {
9852 LDKThirtyTwoBytes channel_id_arg_ref;
9853 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9854 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9855 LDKSignature node_signature_arg_ref;
9856 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9857 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9858 LDKSignature bitcoin_signature_arg_ref;
9859 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9860 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9861 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9862 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9863 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9864 long ret_ref = (long)ret_var.inner;
9865 if (ret_var.is_owned) {
9871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9872 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9873 FREE((void*)this_ptr);
9874 NetAddress_free(this_ptr_conv);
9877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9878 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9879 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9880 *ret_copy = NetAddress_clone(orig_conv);
9881 long ret_ref = (long)ret_copy;
9885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9886 LDKUnsignedNodeAnnouncement this_ptr_conv;
9887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9889 UnsignedNodeAnnouncement_free(this_ptr_conv);
9892 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9893 LDKUnsignedNodeAnnouncement orig_conv;
9894 orig_conv.inner = (void*)(orig & (~1));
9895 orig_conv.is_owned = false;
9896 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9897 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9898 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9899 long ret_ref = (long)ret_var.inner;
9900 if (ret_var.is_owned) {
9906 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9907 LDKUnsignedNodeAnnouncement this_ptr_conv;
9908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9909 this_ptr_conv.is_owned = false;
9910 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9911 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9912 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9913 long ret_ref = (long)ret_var.inner;
9914 if (ret_var.is_owned) {
9920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9921 LDKUnsignedNodeAnnouncement this_ptr_conv;
9922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9923 this_ptr_conv.is_owned = false;
9924 LDKNodeFeatures val_conv;
9925 val_conv.inner = (void*)(val & (~1));
9926 val_conv.is_owned = (val & 1) || (val == 0);
9927 // Warning: we may need a move here but can't clone!
9928 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9931 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9932 LDKUnsignedNodeAnnouncement this_ptr_conv;
9933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9934 this_ptr_conv.is_owned = false;
9935 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9940 LDKUnsignedNodeAnnouncement this_ptr_conv;
9941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9942 this_ptr_conv.is_owned = false;
9943 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9946 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9947 LDKUnsignedNodeAnnouncement this_ptr_conv;
9948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9949 this_ptr_conv.is_owned = false;
9950 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9951 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9956 LDKUnsignedNodeAnnouncement this_ptr_conv;
9957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9958 this_ptr_conv.is_owned = false;
9959 LDKPublicKey val_ref;
9960 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9961 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9962 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9965 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9966 LDKUnsignedNodeAnnouncement this_ptr_conv;
9967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9968 this_ptr_conv.is_owned = false;
9969 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9970 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9975 LDKUnsignedNodeAnnouncement this_ptr_conv;
9976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9977 this_ptr_conv.is_owned = false;
9978 LDKThreeBytes val_ref;
9979 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9980 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9981 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9984 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9985 LDKUnsignedNodeAnnouncement this_ptr_conv;
9986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9987 this_ptr_conv.is_owned = false;
9988 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9989 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9994 LDKUnsignedNodeAnnouncement this_ptr_conv;
9995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9996 this_ptr_conv.is_owned = false;
9997 LDKThirtyTwoBytes val_ref;
9998 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9999 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10000 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
10003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10004 LDKUnsignedNodeAnnouncement this_ptr_conv;
10005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10006 this_ptr_conv.is_owned = false;
10007 LDKCVec_NetAddressZ val_constr;
10008 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10009 if (val_constr.datalen > 0)
10010 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
10012 val_constr.data = NULL;
10013 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10014 for (size_t m = 0; m < val_constr.datalen; m++) {
10015 long arr_conv_12 = val_vals[m];
10016 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
10017 FREE((void*)arr_conv_12);
10018 val_constr.data[m] = arr_conv_12_conv;
10020 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10021 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
10024 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10025 LDKNodeAnnouncement this_ptr_conv;
10026 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10027 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10028 NodeAnnouncement_free(this_ptr_conv);
10031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10032 LDKNodeAnnouncement orig_conv;
10033 orig_conv.inner = (void*)(orig & (~1));
10034 orig_conv.is_owned = false;
10035 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
10036 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10037 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10038 long ret_ref = (long)ret_var.inner;
10039 if (ret_var.is_owned) {
10045 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10046 LDKNodeAnnouncement this_ptr_conv;
10047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10048 this_ptr_conv.is_owned = false;
10049 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10050 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
10054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10055 LDKNodeAnnouncement this_ptr_conv;
10056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10057 this_ptr_conv.is_owned = false;
10058 LDKSignature val_ref;
10059 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10060 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10061 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
10064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10065 LDKNodeAnnouncement this_ptr_conv;
10066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10067 this_ptr_conv.is_owned = false;
10068 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
10069 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10070 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10071 long ret_ref = (long)ret_var.inner;
10072 if (ret_var.is_owned) {
10078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10079 LDKNodeAnnouncement this_ptr_conv;
10080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10081 this_ptr_conv.is_owned = false;
10082 LDKUnsignedNodeAnnouncement val_conv;
10083 val_conv.inner = (void*)(val & (~1));
10084 val_conv.is_owned = (val & 1) || (val == 0);
10085 if (val_conv.inner != NULL)
10086 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
10087 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
10090 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10091 LDKSignature signature_arg_ref;
10092 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10093 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10094 LDKUnsignedNodeAnnouncement contents_arg_conv;
10095 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10096 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10097 if (contents_arg_conv.inner != NULL)
10098 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
10099 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
10100 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10101 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10102 long ret_ref = (long)ret_var.inner;
10103 if (ret_var.is_owned) {
10109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10110 LDKUnsignedChannelAnnouncement this_ptr_conv;
10111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10113 UnsignedChannelAnnouncement_free(this_ptr_conv);
10116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10117 LDKUnsignedChannelAnnouncement orig_conv;
10118 orig_conv.inner = (void*)(orig & (~1));
10119 orig_conv.is_owned = false;
10120 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10121 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10122 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10123 long ret_ref = (long)ret_var.inner;
10124 if (ret_var.is_owned) {
10130 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10131 LDKUnsignedChannelAnnouncement this_ptr_conv;
10132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10133 this_ptr_conv.is_owned = false;
10134 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10135 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10136 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10137 long ret_ref = (long)ret_var.inner;
10138 if (ret_var.is_owned) {
10144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10145 LDKUnsignedChannelAnnouncement this_ptr_conv;
10146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10147 this_ptr_conv.is_owned = false;
10148 LDKChannelFeatures val_conv;
10149 val_conv.inner = (void*)(val & (~1));
10150 val_conv.is_owned = (val & 1) || (val == 0);
10151 // Warning: we may need a move here but can't clone!
10152 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10155 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10156 LDKUnsignedChannelAnnouncement this_ptr_conv;
10157 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10158 this_ptr_conv.is_owned = false;
10159 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10160 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
10164 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10165 LDKUnsignedChannelAnnouncement this_ptr_conv;
10166 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10167 this_ptr_conv.is_owned = false;
10168 LDKThirtyTwoBytes val_ref;
10169 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10170 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10171 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10174 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10175 LDKUnsignedChannelAnnouncement this_ptr_conv;
10176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10177 this_ptr_conv.is_owned = false;
10178 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10183 LDKUnsignedChannelAnnouncement this_ptr_conv;
10184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10185 this_ptr_conv.is_owned = false;
10186 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10189 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10190 LDKUnsignedChannelAnnouncement this_ptr_conv;
10191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10192 this_ptr_conv.is_owned = false;
10193 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10194 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
10198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10199 LDKUnsignedChannelAnnouncement this_ptr_conv;
10200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10201 this_ptr_conv.is_owned = false;
10202 LDKPublicKey val_ref;
10203 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10204 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10205 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10208 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10209 LDKUnsignedChannelAnnouncement this_ptr_conv;
10210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10211 this_ptr_conv.is_owned = false;
10212 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10213 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
10217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10218 LDKUnsignedChannelAnnouncement this_ptr_conv;
10219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10220 this_ptr_conv.is_owned = false;
10221 LDKPublicKey val_ref;
10222 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10223 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10224 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10227 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10228 LDKUnsignedChannelAnnouncement this_ptr_conv;
10229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10230 this_ptr_conv.is_owned = false;
10231 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10232 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
10236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10237 LDKUnsignedChannelAnnouncement this_ptr_conv;
10238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10239 this_ptr_conv.is_owned = false;
10240 LDKPublicKey val_ref;
10241 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10242 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10243 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10246 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10247 LDKUnsignedChannelAnnouncement this_ptr_conv;
10248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10249 this_ptr_conv.is_owned = false;
10250 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10251 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
10255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10256 LDKUnsignedChannelAnnouncement this_ptr_conv;
10257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10258 this_ptr_conv.is_owned = false;
10259 LDKPublicKey val_ref;
10260 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10261 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10262 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10266 LDKChannelAnnouncement this_ptr_conv;
10267 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10268 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10269 ChannelAnnouncement_free(this_ptr_conv);
10272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10273 LDKChannelAnnouncement orig_conv;
10274 orig_conv.inner = (void*)(orig & (~1));
10275 orig_conv.is_owned = false;
10276 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10277 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10278 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10279 long ret_ref = (long)ret_var.inner;
10280 if (ret_var.is_owned) {
10286 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10287 LDKChannelAnnouncement this_ptr_conv;
10288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10289 this_ptr_conv.is_owned = false;
10290 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10291 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10295 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10296 LDKChannelAnnouncement this_ptr_conv;
10297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10298 this_ptr_conv.is_owned = false;
10299 LDKSignature val_ref;
10300 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10301 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10302 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10305 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10306 LDKChannelAnnouncement this_ptr_conv;
10307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10308 this_ptr_conv.is_owned = false;
10309 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10310 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10315 LDKChannelAnnouncement this_ptr_conv;
10316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10317 this_ptr_conv.is_owned = false;
10318 LDKSignature val_ref;
10319 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10320 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10321 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10324 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10325 LDKChannelAnnouncement this_ptr_conv;
10326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10327 this_ptr_conv.is_owned = false;
10328 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10329 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10333 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10334 LDKChannelAnnouncement this_ptr_conv;
10335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10336 this_ptr_conv.is_owned = false;
10337 LDKSignature val_ref;
10338 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10339 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10340 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10343 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10344 LDKChannelAnnouncement this_ptr_conv;
10345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10346 this_ptr_conv.is_owned = false;
10347 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10348 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10353 LDKChannelAnnouncement this_ptr_conv;
10354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10355 this_ptr_conv.is_owned = false;
10356 LDKSignature val_ref;
10357 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10358 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10359 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10363 LDKChannelAnnouncement this_ptr_conv;
10364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10365 this_ptr_conv.is_owned = false;
10366 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10367 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10368 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10369 long ret_ref = (long)ret_var.inner;
10370 if (ret_var.is_owned) {
10376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10377 LDKChannelAnnouncement this_ptr_conv;
10378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10379 this_ptr_conv.is_owned = false;
10380 LDKUnsignedChannelAnnouncement val_conv;
10381 val_conv.inner = (void*)(val & (~1));
10382 val_conv.is_owned = (val & 1) || (val == 0);
10383 if (val_conv.inner != NULL)
10384 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10385 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10388 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) {
10389 LDKSignature node_signature_1_arg_ref;
10390 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10391 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10392 LDKSignature node_signature_2_arg_ref;
10393 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10394 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10395 LDKSignature bitcoin_signature_1_arg_ref;
10396 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10397 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10398 LDKSignature bitcoin_signature_2_arg_ref;
10399 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10400 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10401 LDKUnsignedChannelAnnouncement contents_arg_conv;
10402 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10403 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10404 if (contents_arg_conv.inner != NULL)
10405 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10406 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);
10407 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10408 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10409 long ret_ref = (long)ret_var.inner;
10410 if (ret_var.is_owned) {
10416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10417 LDKUnsignedChannelUpdate this_ptr_conv;
10418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10420 UnsignedChannelUpdate_free(this_ptr_conv);
10423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10424 LDKUnsignedChannelUpdate orig_conv;
10425 orig_conv.inner = (void*)(orig & (~1));
10426 orig_conv.is_owned = false;
10427 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10428 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10429 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10430 long ret_ref = (long)ret_var.inner;
10431 if (ret_var.is_owned) {
10437 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10438 LDKUnsignedChannelUpdate this_ptr_conv;
10439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10440 this_ptr_conv.is_owned = false;
10441 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10442 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10447 LDKUnsignedChannelUpdate this_ptr_conv;
10448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10449 this_ptr_conv.is_owned = false;
10450 LDKThirtyTwoBytes val_ref;
10451 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10452 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10453 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10457 LDKUnsignedChannelUpdate this_ptr_conv;
10458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10459 this_ptr_conv.is_owned = false;
10460 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10465 LDKUnsignedChannelUpdate this_ptr_conv;
10466 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10467 this_ptr_conv.is_owned = false;
10468 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10471 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10472 LDKUnsignedChannelUpdate this_ptr_conv;
10473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10474 this_ptr_conv.is_owned = false;
10475 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10480 LDKUnsignedChannelUpdate this_ptr_conv;
10481 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10482 this_ptr_conv.is_owned = false;
10483 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10486 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10487 LDKUnsignedChannelUpdate this_ptr_conv;
10488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10489 this_ptr_conv.is_owned = false;
10490 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10495 LDKUnsignedChannelUpdate this_ptr_conv;
10496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10497 this_ptr_conv.is_owned = false;
10498 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10501 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10502 LDKUnsignedChannelUpdate this_ptr_conv;
10503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10504 this_ptr_conv.is_owned = false;
10505 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10510 LDKUnsignedChannelUpdate this_ptr_conv;
10511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10512 this_ptr_conv.is_owned = false;
10513 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10517 LDKUnsignedChannelUpdate this_ptr_conv;
10518 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10519 this_ptr_conv.is_owned = false;
10520 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10525 LDKUnsignedChannelUpdate this_ptr_conv;
10526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10527 this_ptr_conv.is_owned = false;
10528 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10531 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10532 LDKUnsignedChannelUpdate this_ptr_conv;
10533 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10534 this_ptr_conv.is_owned = false;
10535 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10540 LDKUnsignedChannelUpdate this_ptr_conv;
10541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10542 this_ptr_conv.is_owned = false;
10543 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10546 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10547 LDKUnsignedChannelUpdate this_ptr_conv;
10548 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10549 this_ptr_conv.is_owned = false;
10550 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10555 LDKUnsignedChannelUpdate this_ptr_conv;
10556 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10557 this_ptr_conv.is_owned = false;
10558 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10562 LDKChannelUpdate this_ptr_conv;
10563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10565 ChannelUpdate_free(this_ptr_conv);
10568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10569 LDKChannelUpdate orig_conv;
10570 orig_conv.inner = (void*)(orig & (~1));
10571 orig_conv.is_owned = false;
10572 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10575 long ret_ref = (long)ret_var.inner;
10576 if (ret_var.is_owned) {
10582 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10583 LDKChannelUpdate this_ptr_conv;
10584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10585 this_ptr_conv.is_owned = false;
10586 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10587 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10592 LDKChannelUpdate this_ptr_conv;
10593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10594 this_ptr_conv.is_owned = false;
10595 LDKSignature val_ref;
10596 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10597 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10598 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10601 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10602 LDKChannelUpdate this_ptr_conv;
10603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10604 this_ptr_conv.is_owned = false;
10605 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10606 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10607 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10608 long ret_ref = (long)ret_var.inner;
10609 if (ret_var.is_owned) {
10615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10616 LDKChannelUpdate this_ptr_conv;
10617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10618 this_ptr_conv.is_owned = false;
10619 LDKUnsignedChannelUpdate val_conv;
10620 val_conv.inner = (void*)(val & (~1));
10621 val_conv.is_owned = (val & 1) || (val == 0);
10622 if (val_conv.inner != NULL)
10623 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10624 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10628 LDKSignature signature_arg_ref;
10629 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10630 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10631 LDKUnsignedChannelUpdate contents_arg_conv;
10632 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10633 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10634 if (contents_arg_conv.inner != NULL)
10635 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10636 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10637 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10638 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10639 long ret_ref = (long)ret_var.inner;
10640 if (ret_var.is_owned) {
10646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10647 LDKQueryChannelRange this_ptr_conv;
10648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10650 QueryChannelRange_free(this_ptr_conv);
10653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10654 LDKQueryChannelRange orig_conv;
10655 orig_conv.inner = (void*)(orig & (~1));
10656 orig_conv.is_owned = false;
10657 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10658 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10659 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10660 long ret_ref = (long)ret_var.inner;
10661 if (ret_var.is_owned) {
10667 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10668 LDKQueryChannelRange this_ptr_conv;
10669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10670 this_ptr_conv.is_owned = false;
10671 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10672 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10677 LDKQueryChannelRange this_ptr_conv;
10678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10679 this_ptr_conv.is_owned = false;
10680 LDKThirtyTwoBytes val_ref;
10681 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10682 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10683 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10686 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10687 LDKQueryChannelRange this_ptr_conv;
10688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10689 this_ptr_conv.is_owned = false;
10690 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10694 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10695 LDKQueryChannelRange this_ptr_conv;
10696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10697 this_ptr_conv.is_owned = false;
10698 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10701 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10702 LDKQueryChannelRange this_ptr_conv;
10703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10704 this_ptr_conv.is_owned = false;
10705 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10710 LDKQueryChannelRange this_ptr_conv;
10711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10712 this_ptr_conv.is_owned = false;
10713 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10716 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) {
10717 LDKThirtyTwoBytes chain_hash_arg_ref;
10718 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10719 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10720 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10721 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10722 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10723 long ret_ref = (long)ret_var.inner;
10724 if (ret_var.is_owned) {
10730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10731 LDKReplyChannelRange this_ptr_conv;
10732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10734 ReplyChannelRange_free(this_ptr_conv);
10737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10738 LDKReplyChannelRange orig_conv;
10739 orig_conv.inner = (void*)(orig & (~1));
10740 orig_conv.is_owned = false;
10741 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10744 long ret_ref = (long)ret_var.inner;
10745 if (ret_var.is_owned) {
10751 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10752 LDKReplyChannelRange this_ptr_conv;
10753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10754 this_ptr_conv.is_owned = false;
10755 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10756 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10761 LDKReplyChannelRange this_ptr_conv;
10762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10763 this_ptr_conv.is_owned = false;
10764 LDKThirtyTwoBytes val_ref;
10765 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10766 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10767 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10770 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10771 LDKReplyChannelRange this_ptr_conv;
10772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10773 this_ptr_conv.is_owned = false;
10774 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10779 LDKReplyChannelRange this_ptr_conv;
10780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10781 this_ptr_conv.is_owned = false;
10782 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10785 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10786 LDKReplyChannelRange this_ptr_conv;
10787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10788 this_ptr_conv.is_owned = false;
10789 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10794 LDKReplyChannelRange this_ptr_conv;
10795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10796 this_ptr_conv.is_owned = false;
10797 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10800 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10801 LDKReplyChannelRange this_ptr_conv;
10802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10803 this_ptr_conv.is_owned = false;
10804 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10809 LDKReplyChannelRange this_ptr_conv;
10810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10811 this_ptr_conv.is_owned = false;
10812 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10816 LDKReplyChannelRange this_ptr_conv;
10817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10818 this_ptr_conv.is_owned = false;
10819 LDKCVec_u64Z val_constr;
10820 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10821 if (val_constr.datalen > 0)
10822 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10824 val_constr.data = NULL;
10825 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10826 for (size_t g = 0; g < val_constr.datalen; g++) {
10827 long arr_conv_6 = val_vals[g];
10828 val_constr.data[g] = arr_conv_6;
10830 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10831 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10834 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) {
10835 LDKThirtyTwoBytes chain_hash_arg_ref;
10836 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10837 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10838 LDKCVec_u64Z short_channel_ids_arg_constr;
10839 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10840 if (short_channel_ids_arg_constr.datalen > 0)
10841 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10843 short_channel_ids_arg_constr.data = NULL;
10844 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10845 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10846 long arr_conv_6 = short_channel_ids_arg_vals[g];
10847 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10849 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10850 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10851 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10852 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10853 long ret_ref = (long)ret_var.inner;
10854 if (ret_var.is_owned) {
10860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10861 LDKQueryShortChannelIds this_ptr_conv;
10862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10864 QueryShortChannelIds_free(this_ptr_conv);
10867 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10868 LDKQueryShortChannelIds orig_conv;
10869 orig_conv.inner = (void*)(orig & (~1));
10870 orig_conv.is_owned = false;
10871 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10872 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10873 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10874 long ret_ref = (long)ret_var.inner;
10875 if (ret_var.is_owned) {
10881 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10882 LDKQueryShortChannelIds this_ptr_conv;
10883 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10884 this_ptr_conv.is_owned = false;
10885 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10886 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10891 LDKQueryShortChannelIds this_ptr_conv;
10892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10893 this_ptr_conv.is_owned = false;
10894 LDKThirtyTwoBytes val_ref;
10895 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10896 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10897 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10901 LDKQueryShortChannelIds this_ptr_conv;
10902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10903 this_ptr_conv.is_owned = false;
10904 LDKCVec_u64Z val_constr;
10905 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10906 if (val_constr.datalen > 0)
10907 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10909 val_constr.data = NULL;
10910 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10911 for (size_t g = 0; g < val_constr.datalen; g++) {
10912 long arr_conv_6 = val_vals[g];
10913 val_constr.data[g] = arr_conv_6;
10915 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10916 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10920 LDKThirtyTwoBytes chain_hash_arg_ref;
10921 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10922 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10923 LDKCVec_u64Z short_channel_ids_arg_constr;
10924 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10925 if (short_channel_ids_arg_constr.datalen > 0)
10926 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10928 short_channel_ids_arg_constr.data = NULL;
10929 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10930 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10931 long arr_conv_6 = short_channel_ids_arg_vals[g];
10932 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10934 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10935 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10936 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10937 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10938 long ret_ref = (long)ret_var.inner;
10939 if (ret_var.is_owned) {
10945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10946 LDKReplyShortChannelIdsEnd this_ptr_conv;
10947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10948 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10949 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10952 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10953 LDKReplyShortChannelIdsEnd orig_conv;
10954 orig_conv.inner = (void*)(orig & (~1));
10955 orig_conv.is_owned = false;
10956 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10957 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10958 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10959 long ret_ref = (long)ret_var.inner;
10960 if (ret_var.is_owned) {
10966 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10967 LDKReplyShortChannelIdsEnd this_ptr_conv;
10968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10969 this_ptr_conv.is_owned = false;
10970 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10971 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10975 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10976 LDKReplyShortChannelIdsEnd this_ptr_conv;
10977 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10978 this_ptr_conv.is_owned = false;
10979 LDKThirtyTwoBytes val_ref;
10980 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10981 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10982 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10985 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10986 LDKReplyShortChannelIdsEnd this_ptr_conv;
10987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10988 this_ptr_conv.is_owned = false;
10989 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10994 LDKReplyShortChannelIdsEnd this_ptr_conv;
10995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10996 this_ptr_conv.is_owned = false;
10997 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
11000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
11001 LDKThirtyTwoBytes chain_hash_arg_ref;
11002 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
11003 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
11004 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
11005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11007 long ret_ref = (long)ret_var.inner;
11008 if (ret_var.is_owned) {
11014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11015 LDKGossipTimestampFilter this_ptr_conv;
11016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11018 GossipTimestampFilter_free(this_ptr_conv);
11021 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11022 LDKGossipTimestampFilter orig_conv;
11023 orig_conv.inner = (void*)(orig & (~1));
11024 orig_conv.is_owned = false;
11025 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
11026 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11027 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11028 long ret_ref = (long)ret_var.inner;
11029 if (ret_var.is_owned) {
11035 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11036 LDKGossipTimestampFilter this_ptr_conv;
11037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11038 this_ptr_conv.is_owned = false;
11039 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11040 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
11044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11045 LDKGossipTimestampFilter this_ptr_conv;
11046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11047 this_ptr_conv.is_owned = false;
11048 LDKThirtyTwoBytes val_ref;
11049 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11050 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11051 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
11054 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
11055 LDKGossipTimestampFilter this_ptr_conv;
11056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11057 this_ptr_conv.is_owned = false;
11058 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
11062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11063 LDKGossipTimestampFilter this_ptr_conv;
11064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11065 this_ptr_conv.is_owned = false;
11066 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
11069 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
11070 LDKGossipTimestampFilter this_ptr_conv;
11071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11072 this_ptr_conv.is_owned = false;
11073 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
11077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11078 LDKGossipTimestampFilter this_ptr_conv;
11079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11080 this_ptr_conv.is_owned = false;
11081 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
11084 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) {
11085 LDKThirtyTwoBytes chain_hash_arg_ref;
11086 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
11087 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
11088 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
11089 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11090 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11091 long ret_ref = (long)ret_var.inner;
11092 if (ret_var.is_owned) {
11098 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11099 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
11100 FREE((void*)this_ptr);
11101 ErrorAction_free(this_ptr_conv);
11104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11105 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
11106 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11107 *ret_copy = ErrorAction_clone(orig_conv);
11108 long ret_ref = (long)ret_copy;
11112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11113 LDKLightningError this_ptr_conv;
11114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11116 LightningError_free(this_ptr_conv);
11119 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
11120 LDKLightningError this_ptr_conv;
11121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11122 this_ptr_conv.is_owned = false;
11123 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11124 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11125 memcpy(_buf, _str.chars, _str.len);
11126 _buf[_str.len] = 0;
11127 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
11132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11133 LDKLightningError this_ptr_conv;
11134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11135 this_ptr_conv.is_owned = false;
11136 LDKCVec_u8Z val_ref;
11137 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
11138 val_ref.data = MALLOC(val_ref.datalen, "LDKCVec_u8Z Bytes");
11139 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
11140 LightningError_set_err(&this_ptr_conv, val_ref);
11143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
11144 LDKLightningError this_ptr_conv;
11145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11146 this_ptr_conv.is_owned = false;
11147 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11148 *ret_copy = LightningError_get_action(&this_ptr_conv);
11149 long ret_ref = (long)ret_copy;
11153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11154 LDKLightningError this_ptr_conv;
11155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11156 this_ptr_conv.is_owned = false;
11157 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11159 LightningError_set_action(&this_ptr_conv, val_conv);
11162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
11163 LDKCVec_u8Z err_arg_ref;
11164 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
11165 err_arg_ref.data = MALLOC(err_arg_ref.datalen, "LDKCVec_u8Z Bytes");
11166 (*_env)->GetByteArrayRegion(_env, err_arg, 0, err_arg_ref.datalen, err_arg_ref.data);
11167 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11168 FREE((void*)action_arg);
11169 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11170 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11171 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11172 long ret_ref = (long)ret_var.inner;
11173 if (ret_var.is_owned) {
11179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11180 LDKCommitmentUpdate this_ptr_conv;
11181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11183 CommitmentUpdate_free(this_ptr_conv);
11186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11187 LDKCommitmentUpdate orig_conv;
11188 orig_conv.inner = (void*)(orig & (~1));
11189 orig_conv.is_owned = false;
11190 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11191 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11192 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11193 long ret_ref = (long)ret_var.inner;
11194 if (ret_var.is_owned) {
11200 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11201 LDKCommitmentUpdate this_ptr_conv;
11202 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11203 this_ptr_conv.is_owned = false;
11204 LDKCVec_UpdateAddHTLCZ val_constr;
11205 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11206 if (val_constr.datalen > 0)
11207 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11209 val_constr.data = NULL;
11210 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11211 for (size_t p = 0; p < val_constr.datalen; p++) {
11212 long arr_conv_15 = val_vals[p];
11213 LDKUpdateAddHTLC arr_conv_15_conv;
11214 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11215 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11216 if (arr_conv_15_conv.inner != NULL)
11217 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11218 val_constr.data[p] = arr_conv_15_conv;
11220 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11221 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11224 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11225 LDKCommitmentUpdate this_ptr_conv;
11226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11227 this_ptr_conv.is_owned = false;
11228 LDKCVec_UpdateFulfillHTLCZ val_constr;
11229 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11230 if (val_constr.datalen > 0)
11231 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11233 val_constr.data = NULL;
11234 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11235 for (size_t t = 0; t < val_constr.datalen; t++) {
11236 long arr_conv_19 = val_vals[t];
11237 LDKUpdateFulfillHTLC arr_conv_19_conv;
11238 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11239 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11240 if (arr_conv_19_conv.inner != NULL)
11241 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11242 val_constr.data[t] = arr_conv_19_conv;
11244 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11245 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11249 LDKCommitmentUpdate this_ptr_conv;
11250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11251 this_ptr_conv.is_owned = false;
11252 LDKCVec_UpdateFailHTLCZ val_constr;
11253 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11254 if (val_constr.datalen > 0)
11255 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11257 val_constr.data = NULL;
11258 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11259 for (size_t q = 0; q < val_constr.datalen; q++) {
11260 long arr_conv_16 = val_vals[q];
11261 LDKUpdateFailHTLC arr_conv_16_conv;
11262 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11263 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11264 if (arr_conv_16_conv.inner != NULL)
11265 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11266 val_constr.data[q] = arr_conv_16_conv;
11268 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11269 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11273 LDKCommitmentUpdate this_ptr_conv;
11274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11275 this_ptr_conv.is_owned = false;
11276 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11277 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11278 if (val_constr.datalen > 0)
11279 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11281 val_constr.data = NULL;
11282 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11283 for (size_t z = 0; z < val_constr.datalen; z++) {
11284 long arr_conv_25 = val_vals[z];
11285 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11286 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11287 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11288 if (arr_conv_25_conv.inner != NULL)
11289 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11290 val_constr.data[z] = arr_conv_25_conv;
11292 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11293 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11296 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11297 LDKCommitmentUpdate this_ptr_conv;
11298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11299 this_ptr_conv.is_owned = false;
11300 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11301 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11302 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11303 long ret_ref = (long)ret_var.inner;
11304 if (ret_var.is_owned) {
11310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11311 LDKCommitmentUpdate this_ptr_conv;
11312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11313 this_ptr_conv.is_owned = false;
11314 LDKUpdateFee val_conv;
11315 val_conv.inner = (void*)(val & (~1));
11316 val_conv.is_owned = (val & 1) || (val == 0);
11317 if (val_conv.inner != NULL)
11318 val_conv = UpdateFee_clone(&val_conv);
11319 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11323 LDKCommitmentUpdate this_ptr_conv;
11324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11325 this_ptr_conv.is_owned = false;
11326 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11327 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11328 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11329 long ret_ref = (long)ret_var.inner;
11330 if (ret_var.is_owned) {
11336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11337 LDKCommitmentUpdate this_ptr_conv;
11338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11339 this_ptr_conv.is_owned = false;
11340 LDKCommitmentSigned val_conv;
11341 val_conv.inner = (void*)(val & (~1));
11342 val_conv.is_owned = (val & 1) || (val == 0);
11343 if (val_conv.inner != NULL)
11344 val_conv = CommitmentSigned_clone(&val_conv);
11345 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11348 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) {
11349 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11350 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11351 if (update_add_htlcs_arg_constr.datalen > 0)
11352 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11354 update_add_htlcs_arg_constr.data = NULL;
11355 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11356 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11357 long arr_conv_15 = update_add_htlcs_arg_vals[p];
11358 LDKUpdateAddHTLC arr_conv_15_conv;
11359 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11360 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11361 if (arr_conv_15_conv.inner != NULL)
11362 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11363 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11365 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11366 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11367 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11368 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11369 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11371 update_fulfill_htlcs_arg_constr.data = NULL;
11372 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11373 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11374 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11375 LDKUpdateFulfillHTLC arr_conv_19_conv;
11376 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11377 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11378 if (arr_conv_19_conv.inner != NULL)
11379 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11380 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11382 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11383 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11384 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11385 if (update_fail_htlcs_arg_constr.datalen > 0)
11386 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11388 update_fail_htlcs_arg_constr.data = NULL;
11389 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11390 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11391 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11392 LDKUpdateFailHTLC arr_conv_16_conv;
11393 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11394 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11395 if (arr_conv_16_conv.inner != NULL)
11396 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11397 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11399 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11400 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11401 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11402 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11403 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11405 update_fail_malformed_htlcs_arg_constr.data = NULL;
11406 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11407 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11408 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11409 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11410 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11411 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11412 if (arr_conv_25_conv.inner != NULL)
11413 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11414 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11416 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11417 LDKUpdateFee update_fee_arg_conv;
11418 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11419 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11420 if (update_fee_arg_conv.inner != NULL)
11421 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11422 LDKCommitmentSigned commitment_signed_arg_conv;
11423 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11424 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11425 if (commitment_signed_arg_conv.inner != NULL)
11426 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11427 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);
11428 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11429 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11430 long ret_ref = (long)ret_var.inner;
11431 if (ret_var.is_owned) {
11437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11438 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11439 FREE((void*)this_ptr);
11440 HTLCFailChannelUpdate_free(this_ptr_conv);
11443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11444 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11445 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11446 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11447 long ret_ref = (long)ret_copy;
11451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11452 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11453 FREE((void*)this_ptr);
11454 ChannelMessageHandler_free(this_ptr_conv);
11457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11458 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11459 FREE((void*)this_ptr);
11460 RoutingMessageHandler_free(this_ptr_conv);
11463 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11464 LDKAcceptChannel obj_conv;
11465 obj_conv.inner = (void*)(obj & (~1));
11466 obj_conv.is_owned = false;
11467 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11468 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11469 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11470 CVec_u8Z_free(arg_var);
11474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11475 LDKu8slice ser_ref;
11476 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11477 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11478 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11479 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11480 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11481 long ret_ref = (long)ret_var.inner;
11482 if (ret_var.is_owned) {
11485 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11489 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11490 LDKAnnouncementSignatures obj_conv;
11491 obj_conv.inner = (void*)(obj & (~1));
11492 obj_conv.is_owned = false;
11493 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11494 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11495 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11496 CVec_u8Z_free(arg_var);
11500 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11501 LDKu8slice ser_ref;
11502 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11503 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11504 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11505 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11506 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11507 long ret_ref = (long)ret_var.inner;
11508 if (ret_var.is_owned) {
11511 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11515 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11516 LDKChannelReestablish obj_conv;
11517 obj_conv.inner = (void*)(obj & (~1));
11518 obj_conv.is_owned = false;
11519 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11520 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11521 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11522 CVec_u8Z_free(arg_var);
11526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11527 LDKu8slice ser_ref;
11528 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11529 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11530 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11531 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11532 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11533 long ret_ref = (long)ret_var.inner;
11534 if (ret_var.is_owned) {
11537 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11541 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11542 LDKClosingSigned obj_conv;
11543 obj_conv.inner = (void*)(obj & (~1));
11544 obj_conv.is_owned = false;
11545 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11546 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11547 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11548 CVec_u8Z_free(arg_var);
11552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11553 LDKu8slice ser_ref;
11554 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11555 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11556 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11557 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11558 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11559 long ret_ref = (long)ret_var.inner;
11560 if (ret_var.is_owned) {
11563 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11567 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11568 LDKCommitmentSigned obj_conv;
11569 obj_conv.inner = (void*)(obj & (~1));
11570 obj_conv.is_owned = false;
11571 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11572 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11573 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11574 CVec_u8Z_free(arg_var);
11578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11579 LDKu8slice ser_ref;
11580 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11581 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11582 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11583 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11584 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11585 long ret_ref = (long)ret_var.inner;
11586 if (ret_var.is_owned) {
11589 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11593 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11594 LDKFundingCreated obj_conv;
11595 obj_conv.inner = (void*)(obj & (~1));
11596 obj_conv.is_owned = false;
11597 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11598 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11599 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11600 CVec_u8Z_free(arg_var);
11604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11605 LDKu8slice ser_ref;
11606 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11607 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11608 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11609 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11610 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11611 long ret_ref = (long)ret_var.inner;
11612 if (ret_var.is_owned) {
11615 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11619 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11620 LDKFundingSigned obj_conv;
11621 obj_conv.inner = (void*)(obj & (~1));
11622 obj_conv.is_owned = false;
11623 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11624 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11625 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11626 CVec_u8Z_free(arg_var);
11630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11631 LDKu8slice ser_ref;
11632 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11633 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11634 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11637 long ret_ref = (long)ret_var.inner;
11638 if (ret_var.is_owned) {
11641 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11645 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11646 LDKFundingLocked obj_conv;
11647 obj_conv.inner = (void*)(obj & (~1));
11648 obj_conv.is_owned = false;
11649 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11650 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11651 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11652 CVec_u8Z_free(arg_var);
11656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11657 LDKu8slice ser_ref;
11658 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11659 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11660 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11661 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11662 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11663 long ret_ref = (long)ret_var.inner;
11664 if (ret_var.is_owned) {
11667 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11671 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11673 obj_conv.inner = (void*)(obj & (~1));
11674 obj_conv.is_owned = false;
11675 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11676 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11677 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11678 CVec_u8Z_free(arg_var);
11682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11683 LDKu8slice ser_ref;
11684 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11685 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11686 LDKInit ret_var = Init_read(ser_ref);
11687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11689 long ret_ref = (long)ret_var.inner;
11690 if (ret_var.is_owned) {
11693 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11697 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11698 LDKOpenChannel obj_conv;
11699 obj_conv.inner = (void*)(obj & (~1));
11700 obj_conv.is_owned = false;
11701 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11702 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11703 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11704 CVec_u8Z_free(arg_var);
11708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11709 LDKu8slice ser_ref;
11710 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11711 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11712 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11713 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11714 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11715 long ret_ref = (long)ret_var.inner;
11716 if (ret_var.is_owned) {
11719 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11723 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11724 LDKRevokeAndACK obj_conv;
11725 obj_conv.inner = (void*)(obj & (~1));
11726 obj_conv.is_owned = false;
11727 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11728 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11729 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11730 CVec_u8Z_free(arg_var);
11734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11735 LDKu8slice ser_ref;
11736 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11737 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11738 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11739 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11740 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11741 long ret_ref = (long)ret_var.inner;
11742 if (ret_var.is_owned) {
11745 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11750 LDKShutdown obj_conv;
11751 obj_conv.inner = (void*)(obj & (~1));
11752 obj_conv.is_owned = false;
11753 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11754 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11755 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11756 CVec_u8Z_free(arg_var);
11760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11761 LDKu8slice ser_ref;
11762 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11763 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11764 LDKShutdown ret_var = Shutdown_read(ser_ref);
11765 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11766 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11767 long ret_ref = (long)ret_var.inner;
11768 if (ret_var.is_owned) {
11771 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11775 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11776 LDKUpdateFailHTLC obj_conv;
11777 obj_conv.inner = (void*)(obj & (~1));
11778 obj_conv.is_owned = false;
11779 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11780 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11781 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11782 CVec_u8Z_free(arg_var);
11786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11787 LDKu8slice ser_ref;
11788 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11789 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11790 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11791 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11792 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11793 long ret_ref = (long)ret_var.inner;
11794 if (ret_var.is_owned) {
11797 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11801 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11802 LDKUpdateFailMalformedHTLC obj_conv;
11803 obj_conv.inner = (void*)(obj & (~1));
11804 obj_conv.is_owned = false;
11805 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11806 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11807 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11808 CVec_u8Z_free(arg_var);
11812 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11813 LDKu8slice ser_ref;
11814 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11815 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11816 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11817 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11818 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11819 long ret_ref = (long)ret_var.inner;
11820 if (ret_var.is_owned) {
11823 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11827 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11828 LDKUpdateFee obj_conv;
11829 obj_conv.inner = (void*)(obj & (~1));
11830 obj_conv.is_owned = false;
11831 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11832 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11833 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11834 CVec_u8Z_free(arg_var);
11838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11839 LDKu8slice ser_ref;
11840 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11841 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11842 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11843 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11844 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11845 long ret_ref = (long)ret_var.inner;
11846 if (ret_var.is_owned) {
11849 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11853 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11854 LDKUpdateFulfillHTLC obj_conv;
11855 obj_conv.inner = (void*)(obj & (~1));
11856 obj_conv.is_owned = false;
11857 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11858 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11859 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11860 CVec_u8Z_free(arg_var);
11864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11865 LDKu8slice ser_ref;
11866 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11867 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11868 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11869 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11870 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11871 long ret_ref = (long)ret_var.inner;
11872 if (ret_var.is_owned) {
11875 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11879 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11880 LDKUpdateAddHTLC obj_conv;
11881 obj_conv.inner = (void*)(obj & (~1));
11882 obj_conv.is_owned = false;
11883 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11884 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11885 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11886 CVec_u8Z_free(arg_var);
11890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11891 LDKu8slice ser_ref;
11892 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11893 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11894 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11895 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11896 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11897 long ret_ref = (long)ret_var.inner;
11898 if (ret_var.is_owned) {
11901 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11905 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11907 obj_conv.inner = (void*)(obj & (~1));
11908 obj_conv.is_owned = false;
11909 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11910 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11911 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11912 CVec_u8Z_free(arg_var);
11916 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11917 LDKu8slice ser_ref;
11918 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11919 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11920 LDKPing ret_var = Ping_read(ser_ref);
11921 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11922 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11923 long ret_ref = (long)ret_var.inner;
11924 if (ret_var.is_owned) {
11927 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11931 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11933 obj_conv.inner = (void*)(obj & (~1));
11934 obj_conv.is_owned = false;
11935 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11936 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11937 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11938 CVec_u8Z_free(arg_var);
11942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11943 LDKu8slice ser_ref;
11944 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11945 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11946 LDKPong ret_var = Pong_read(ser_ref);
11947 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11948 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11949 long ret_ref = (long)ret_var.inner;
11950 if (ret_var.is_owned) {
11953 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11957 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11958 LDKUnsignedChannelAnnouncement obj_conv;
11959 obj_conv.inner = (void*)(obj & (~1));
11960 obj_conv.is_owned = false;
11961 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11962 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11963 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11964 CVec_u8Z_free(arg_var);
11968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11969 LDKu8slice ser_ref;
11970 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11971 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11972 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11975 long ret_ref = (long)ret_var.inner;
11976 if (ret_var.is_owned) {
11979 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11983 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11984 LDKChannelAnnouncement obj_conv;
11985 obj_conv.inner = (void*)(obj & (~1));
11986 obj_conv.is_owned = false;
11987 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11988 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11989 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11990 CVec_u8Z_free(arg_var);
11994 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11995 LDKu8slice ser_ref;
11996 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11997 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11998 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11999 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12000 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12001 long ret_ref = (long)ret_var.inner;
12002 if (ret_var.is_owned) {
12005 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12009 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
12010 LDKUnsignedChannelUpdate obj_conv;
12011 obj_conv.inner = (void*)(obj & (~1));
12012 obj_conv.is_owned = false;
12013 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
12014 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12015 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12016 CVec_u8Z_free(arg_var);
12020 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12021 LDKu8slice ser_ref;
12022 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12023 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12024 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
12025 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12026 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12027 long ret_ref = (long)ret_var.inner;
12028 if (ret_var.is_owned) {
12031 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12035 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
12036 LDKChannelUpdate obj_conv;
12037 obj_conv.inner = (void*)(obj & (~1));
12038 obj_conv.is_owned = false;
12039 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
12040 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12041 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12042 CVec_u8Z_free(arg_var);
12046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12047 LDKu8slice ser_ref;
12048 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12049 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12050 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
12051 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12052 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12053 long ret_ref = (long)ret_var.inner;
12054 if (ret_var.is_owned) {
12057 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12061 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
12062 LDKErrorMessage obj_conv;
12063 obj_conv.inner = (void*)(obj & (~1));
12064 obj_conv.is_owned = false;
12065 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
12066 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12067 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12068 CVec_u8Z_free(arg_var);
12072 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12073 LDKu8slice ser_ref;
12074 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12075 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12076 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
12077 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12078 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12079 long ret_ref = (long)ret_var.inner;
12080 if (ret_var.is_owned) {
12083 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12087 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
12088 LDKUnsignedNodeAnnouncement obj_conv;
12089 obj_conv.inner = (void*)(obj & (~1));
12090 obj_conv.is_owned = false;
12091 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
12092 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12093 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12094 CVec_u8Z_free(arg_var);
12098 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12099 LDKu8slice ser_ref;
12100 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12101 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12102 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
12103 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12104 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12105 long ret_ref = (long)ret_var.inner;
12106 if (ret_var.is_owned) {
12109 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12113 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
12114 LDKNodeAnnouncement obj_conv;
12115 obj_conv.inner = (void*)(obj & (~1));
12116 obj_conv.is_owned = false;
12117 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12118 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12119 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12120 CVec_u8Z_free(arg_var);
12124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12125 LDKu8slice ser_ref;
12126 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12127 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12128 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12129 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12130 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12131 long ret_ref = (long)ret_var.inner;
12132 if (ret_var.is_owned) {
12135 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12139 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12140 LDKu8slice ser_ref;
12141 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12142 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12143 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
12144 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12145 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12146 long ret_ref = (long)ret_var.inner;
12147 if (ret_var.is_owned) {
12150 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
12155 LDKQueryShortChannelIds obj_conv;
12156 obj_conv.inner = (void*)(obj & (~1));
12157 obj_conv.is_owned = false;
12158 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
12159 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12160 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12161 CVec_u8Z_free(arg_var);
12165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12166 LDKu8slice ser_ref;
12167 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12168 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12169 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
12170 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12171 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12172 long ret_ref = (long)ret_var.inner;
12173 if (ret_var.is_owned) {
12176 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12180 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
12181 LDKReplyShortChannelIdsEnd obj_conv;
12182 obj_conv.inner = (void*)(obj & (~1));
12183 obj_conv.is_owned = false;
12184 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
12185 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12186 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12187 CVec_u8Z_free(arg_var);
12191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12192 LDKu8slice ser_ref;
12193 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12194 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12195 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
12196 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12197 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12198 long ret_ref = (long)ret_var.inner;
12199 if (ret_var.is_owned) {
12202 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12206 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12207 LDKQueryChannelRange obj_conv;
12208 obj_conv.inner = (void*)(obj & (~1));
12209 obj_conv.is_owned = false;
12210 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
12211 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12212 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12213 CVec_u8Z_free(arg_var);
12217 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12218 LDKu8slice ser_ref;
12219 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12220 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12221 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
12222 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12223 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12224 long ret_ref = (long)ret_var.inner;
12225 if (ret_var.is_owned) {
12228 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12232 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12233 LDKReplyChannelRange obj_conv;
12234 obj_conv.inner = (void*)(obj & (~1));
12235 obj_conv.is_owned = false;
12236 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
12237 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12238 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12239 CVec_u8Z_free(arg_var);
12243 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12244 LDKu8slice ser_ref;
12245 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12246 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12247 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
12248 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12249 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12250 long ret_ref = (long)ret_var.inner;
12251 if (ret_var.is_owned) {
12254 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12258 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
12259 LDKGossipTimestampFilter obj_conv;
12260 obj_conv.inner = (void*)(obj & (~1));
12261 obj_conv.is_owned = false;
12262 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
12263 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12264 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12265 CVec_u8Z_free(arg_var);
12269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12270 LDKMessageHandler this_ptr_conv;
12271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12273 MessageHandler_free(this_ptr_conv);
12276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12277 LDKMessageHandler this_ptr_conv;
12278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12279 this_ptr_conv.is_owned = false;
12280 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12285 LDKMessageHandler this_ptr_conv;
12286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12287 this_ptr_conv.is_owned = false;
12288 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12289 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12290 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12291 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12293 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12296 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12297 LDKMessageHandler this_ptr_conv;
12298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12299 this_ptr_conv.is_owned = false;
12300 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12305 LDKMessageHandler this_ptr_conv;
12306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12307 this_ptr_conv.is_owned = false;
12308 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12309 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12310 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12311 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12313 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12316 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12317 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12318 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12319 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12320 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12322 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12323 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12324 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12325 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12327 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12328 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12329 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12330 long ret_ref = (long)ret_var.inner;
12331 if (ret_var.is_owned) {
12337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12338 LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)orig;
12339 LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
12340 *ret = SocketDescriptor_clone(orig_conv);
12344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12345 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12346 FREE((void*)this_ptr);
12347 SocketDescriptor_free(this_ptr_conv);
12350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12351 LDKPeerHandleError this_ptr_conv;
12352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12354 PeerHandleError_free(this_ptr_conv);
12357 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
12358 LDKPeerHandleError this_ptr_conv;
12359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12360 this_ptr_conv.is_owned = false;
12361 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12366 LDKPeerHandleError this_ptr_conv;
12367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12368 this_ptr_conv.is_owned = false;
12369 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12373 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12374 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12375 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12376 long ret_ref = (long)ret_var.inner;
12377 if (ret_var.is_owned) {
12383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12384 LDKPeerManager this_ptr_conv;
12385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12387 PeerManager_free(this_ptr_conv);
12390 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) {
12391 LDKMessageHandler message_handler_conv;
12392 message_handler_conv.inner = (void*)(message_handler & (~1));
12393 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12394 // Warning: we may need a move here but can't clone!
12395 LDKSecretKey our_node_secret_ref;
12396 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12397 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12398 unsigned char ephemeral_random_data_arr[32];
12399 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12400 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12401 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12402 LDKLogger logger_conv = *(LDKLogger*)logger;
12403 if (logger_conv.free == LDKLogger_JCalls_free) {
12404 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12405 LDKLogger_JCalls_clone(logger_conv.this_arg);
12407 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12408 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12409 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12410 long ret_ref = (long)ret_var.inner;
12411 if (ret_var.is_owned) {
12417 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12418 LDKPeerManager this_arg_conv;
12419 this_arg_conv.inner = (void*)(this_arg & (~1));
12420 this_arg_conv.is_owned = false;
12421 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12422 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
12423 for (size_t i = 0; i < ret_var.datalen; i++) {
12424 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12425 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12426 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12428 CVec_PublicKeyZ_free(ret_var);
12432 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) {
12433 LDKPeerManager this_arg_conv;
12434 this_arg_conv.inner = (void*)(this_arg & (~1));
12435 this_arg_conv.is_owned = false;
12436 LDKPublicKey their_node_id_ref;
12437 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12438 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12439 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12440 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12441 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12442 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12444 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12445 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12446 return (long)ret_conv;
12449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12450 LDKPeerManager this_arg_conv;
12451 this_arg_conv.inner = (void*)(this_arg & (~1));
12452 this_arg_conv.is_owned = false;
12453 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12454 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12455 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12456 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12458 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12459 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12460 return (long)ret_conv;
12463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12464 LDKPeerManager this_arg_conv;
12465 this_arg_conv.inner = (void*)(this_arg & (~1));
12466 this_arg_conv.is_owned = false;
12467 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12468 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12469 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12470 return (long)ret_conv;
12473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12474 LDKPeerManager this_arg_conv;
12475 this_arg_conv.inner = (void*)(this_arg & (~1));
12476 this_arg_conv.is_owned = false;
12477 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12478 LDKu8slice data_ref;
12479 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12480 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12481 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12482 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12483 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12484 return (long)ret_conv;
12487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12488 LDKPeerManager this_arg_conv;
12489 this_arg_conv.inner = (void*)(this_arg & (~1));
12490 this_arg_conv.is_owned = false;
12491 PeerManager_process_events(&this_arg_conv);
12494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12495 LDKPeerManager this_arg_conv;
12496 this_arg_conv.inner = (void*)(this_arg & (~1));
12497 this_arg_conv.is_owned = false;
12498 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12499 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12503 LDKPeerManager this_arg_conv;
12504 this_arg_conv.inner = (void*)(this_arg & (~1));
12505 this_arg_conv.is_owned = false;
12506 PeerManager_timer_tick_occured(&this_arg_conv);
12509 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12510 unsigned char commitment_seed_arr[32];
12511 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12512 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12513 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12514 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12515 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12520 LDKPublicKey per_commitment_point_ref;
12521 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12522 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12523 unsigned char base_secret_arr[32];
12524 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12525 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12526 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12527 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12528 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12529 return (long)ret_conv;
12532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12533 LDKPublicKey per_commitment_point_ref;
12534 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12535 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12536 LDKPublicKey base_point_ref;
12537 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12538 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12539 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12540 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12541 return (long)ret_conv;
12544 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) {
12545 unsigned char per_commitment_secret_arr[32];
12546 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12547 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12548 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12549 unsigned char countersignatory_revocation_base_secret_arr[32];
12550 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12551 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12552 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12553 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12554 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12555 return (long)ret_conv;
12558 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) {
12559 LDKPublicKey per_commitment_point_ref;
12560 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12561 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12562 LDKPublicKey countersignatory_revocation_base_point_ref;
12563 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12564 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12565 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12566 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12567 return (long)ret_conv;
12570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12571 LDKTxCreationKeys this_ptr_conv;
12572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12574 TxCreationKeys_free(this_ptr_conv);
12577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12578 LDKTxCreationKeys orig_conv;
12579 orig_conv.inner = (void*)(orig & (~1));
12580 orig_conv.is_owned = false;
12581 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12582 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12583 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12584 long ret_ref = (long)ret_var.inner;
12585 if (ret_var.is_owned) {
12591 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12592 LDKTxCreationKeys this_ptr_conv;
12593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12594 this_ptr_conv.is_owned = false;
12595 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12596 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12601 LDKTxCreationKeys this_ptr_conv;
12602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12603 this_ptr_conv.is_owned = false;
12604 LDKPublicKey val_ref;
12605 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12606 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12607 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12610 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12611 LDKTxCreationKeys this_ptr_conv;
12612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12613 this_ptr_conv.is_owned = false;
12614 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12615 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12620 LDKTxCreationKeys this_ptr_conv;
12621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12622 this_ptr_conv.is_owned = false;
12623 LDKPublicKey val_ref;
12624 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12625 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12626 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12629 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12630 LDKTxCreationKeys this_ptr_conv;
12631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12632 this_ptr_conv.is_owned = false;
12633 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12634 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12639 LDKTxCreationKeys this_ptr_conv;
12640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12641 this_ptr_conv.is_owned = false;
12642 LDKPublicKey val_ref;
12643 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12644 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12645 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12648 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12649 LDKTxCreationKeys this_ptr_conv;
12650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12651 this_ptr_conv.is_owned = false;
12652 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12653 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12658 LDKTxCreationKeys this_ptr_conv;
12659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12660 this_ptr_conv.is_owned = false;
12661 LDKPublicKey val_ref;
12662 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12663 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12664 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12667 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12668 LDKTxCreationKeys this_ptr_conv;
12669 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12670 this_ptr_conv.is_owned = false;
12671 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12672 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12677 LDKTxCreationKeys this_ptr_conv;
12678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12679 this_ptr_conv.is_owned = false;
12680 LDKPublicKey val_ref;
12681 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12682 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12683 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12686 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) {
12687 LDKPublicKey per_commitment_point_arg_ref;
12688 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12689 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12690 LDKPublicKey revocation_key_arg_ref;
12691 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12692 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12693 LDKPublicKey broadcaster_htlc_key_arg_ref;
12694 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12695 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12696 LDKPublicKey countersignatory_htlc_key_arg_ref;
12697 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12698 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12699 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12700 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12701 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12702 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);
12703 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12704 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12705 long ret_ref = (long)ret_var.inner;
12706 if (ret_var.is_owned) {
12712 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12713 LDKTxCreationKeys obj_conv;
12714 obj_conv.inner = (void*)(obj & (~1));
12715 obj_conv.is_owned = false;
12716 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12717 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12718 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12719 CVec_u8Z_free(arg_var);
12723 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12724 LDKu8slice ser_ref;
12725 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12726 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12727 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12728 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12729 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12730 long ret_ref = (long)ret_var.inner;
12731 if (ret_var.is_owned) {
12734 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12739 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12742 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12745 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12746 LDKPreCalculatedTxCreationKeys orig_conv;
12747 orig_conv.inner = (void*)(orig & (~1));
12748 orig_conv.is_owned = false;
12749 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_clone(&orig_conv);
12750 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12751 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12752 long ret_ref = (long)ret_var.inner;
12753 if (ret_var.is_owned) {
12759 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12760 LDKTxCreationKeys keys_conv;
12761 keys_conv.inner = (void*)(keys & (~1));
12762 keys_conv.is_owned = (keys & 1) || (keys == 0);
12763 if (keys_conv.inner != NULL)
12764 keys_conv = TxCreationKeys_clone(&keys_conv);
12765 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12766 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12767 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12768 long ret_ref = (long)ret_var.inner;
12769 if (ret_var.is_owned) {
12775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12776 LDKPreCalculatedTxCreationKeys this_arg_conv;
12777 this_arg_conv.inner = (void*)(this_arg & (~1));
12778 this_arg_conv.is_owned = false;
12779 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12780 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12781 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12782 long ret_ref = (long)ret_var.inner;
12783 if (ret_var.is_owned) {
12789 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12790 LDKPreCalculatedTxCreationKeys this_arg_conv;
12791 this_arg_conv.inner = (void*)(this_arg & (~1));
12792 this_arg_conv.is_owned = false;
12793 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12794 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12799 LDKChannelPublicKeys this_ptr_conv;
12800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12801 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12802 ChannelPublicKeys_free(this_ptr_conv);
12805 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12806 LDKChannelPublicKeys orig_conv;
12807 orig_conv.inner = (void*)(orig & (~1));
12808 orig_conv.is_owned = false;
12809 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12810 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12811 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12812 long ret_ref = (long)ret_var.inner;
12813 if (ret_var.is_owned) {
12819 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12820 LDKChannelPublicKeys this_ptr_conv;
12821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12822 this_ptr_conv.is_owned = false;
12823 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12824 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12829 LDKChannelPublicKeys this_ptr_conv;
12830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12831 this_ptr_conv.is_owned = false;
12832 LDKPublicKey val_ref;
12833 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12834 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12835 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12838 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12839 LDKChannelPublicKeys this_ptr_conv;
12840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12841 this_ptr_conv.is_owned = false;
12842 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12843 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12847 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12848 LDKChannelPublicKeys this_ptr_conv;
12849 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12850 this_ptr_conv.is_owned = false;
12851 LDKPublicKey val_ref;
12852 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12853 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12854 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12857 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12858 LDKChannelPublicKeys this_ptr_conv;
12859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12860 this_ptr_conv.is_owned = false;
12861 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12862 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12867 LDKChannelPublicKeys this_ptr_conv;
12868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12869 this_ptr_conv.is_owned = false;
12870 LDKPublicKey val_ref;
12871 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12872 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12873 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12876 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12877 LDKChannelPublicKeys this_ptr_conv;
12878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12879 this_ptr_conv.is_owned = false;
12880 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12881 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12886 LDKChannelPublicKeys this_ptr_conv;
12887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12888 this_ptr_conv.is_owned = false;
12889 LDKPublicKey val_ref;
12890 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12891 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12892 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12895 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12896 LDKChannelPublicKeys this_ptr_conv;
12897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12898 this_ptr_conv.is_owned = false;
12899 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12900 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12905 LDKChannelPublicKeys this_ptr_conv;
12906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12907 this_ptr_conv.is_owned = false;
12908 LDKPublicKey val_ref;
12909 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12910 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12911 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12914 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) {
12915 LDKPublicKey funding_pubkey_arg_ref;
12916 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12917 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12918 LDKPublicKey revocation_basepoint_arg_ref;
12919 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12920 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12921 LDKPublicKey payment_point_arg_ref;
12922 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12923 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12924 LDKPublicKey delayed_payment_basepoint_arg_ref;
12925 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12926 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12927 LDKPublicKey htlc_basepoint_arg_ref;
12928 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12929 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12930 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);
12931 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12932 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12933 long ret_ref = (long)ret_var.inner;
12934 if (ret_var.is_owned) {
12940 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12941 LDKChannelPublicKeys obj_conv;
12942 obj_conv.inner = (void*)(obj & (~1));
12943 obj_conv.is_owned = false;
12944 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12945 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12946 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12947 CVec_u8Z_free(arg_var);
12951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12952 LDKu8slice ser_ref;
12953 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12954 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12955 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12956 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12957 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12958 long ret_ref = (long)ret_var.inner;
12959 if (ret_var.is_owned) {
12962 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12966 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) {
12967 LDKPublicKey per_commitment_point_ref;
12968 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12969 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12970 LDKPublicKey broadcaster_delayed_payment_base_ref;
12971 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12972 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12973 LDKPublicKey broadcaster_htlc_base_ref;
12974 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12975 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12976 LDKPublicKey countersignatory_revocation_base_ref;
12977 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12978 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12979 LDKPublicKey countersignatory_htlc_base_ref;
12980 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12981 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12982 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12983 *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);
12984 return (long)ret_conv;
12987 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) {
12988 LDKPublicKey revocation_key_ref;
12989 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12990 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12991 LDKPublicKey broadcaster_delayed_payment_key_ref;
12992 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12993 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12994 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12995 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12996 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12997 CVec_u8Z_free(arg_var);
13001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13002 LDKHTLCOutputInCommitment this_ptr_conv;
13003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13005 HTLCOutputInCommitment_free(this_ptr_conv);
13008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13009 LDKHTLCOutputInCommitment orig_conv;
13010 orig_conv.inner = (void*)(orig & (~1));
13011 orig_conv.is_owned = false;
13012 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
13013 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13014 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13015 long ret_ref = (long)ret_var.inner;
13016 if (ret_var.is_owned) {
13022 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
13023 LDKHTLCOutputInCommitment this_ptr_conv;
13024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13025 this_ptr_conv.is_owned = false;
13026 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
13030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13031 LDKHTLCOutputInCommitment this_ptr_conv;
13032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13033 this_ptr_conv.is_owned = false;
13034 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
13037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13038 LDKHTLCOutputInCommitment this_ptr_conv;
13039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13040 this_ptr_conv.is_owned = false;
13041 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
13045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13046 LDKHTLCOutputInCommitment this_ptr_conv;
13047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13048 this_ptr_conv.is_owned = false;
13049 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
13052 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
13053 LDKHTLCOutputInCommitment this_ptr_conv;
13054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13055 this_ptr_conv.is_owned = false;
13056 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
13060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13061 LDKHTLCOutputInCommitment this_ptr_conv;
13062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13063 this_ptr_conv.is_owned = false;
13064 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
13067 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
13068 LDKHTLCOutputInCommitment this_ptr_conv;
13069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13070 this_ptr_conv.is_owned = false;
13071 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
13072 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
13076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13077 LDKHTLCOutputInCommitment this_ptr_conv;
13078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13079 this_ptr_conv.is_owned = false;
13080 LDKThirtyTwoBytes val_ref;
13081 CHECK((*_env)->GetArrayLength (_env, val) == 32);
13082 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
13083 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
13086 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
13087 LDKHTLCOutputInCommitment obj_conv;
13088 obj_conv.inner = (void*)(obj & (~1));
13089 obj_conv.is_owned = false;
13090 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
13091 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13092 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13093 CVec_u8Z_free(arg_var);
13097 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13098 LDKu8slice ser_ref;
13099 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13100 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13101 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
13102 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13103 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13104 long ret_ref = (long)ret_var.inner;
13105 if (ret_var.is_owned) {
13108 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13112 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
13113 LDKHTLCOutputInCommitment htlc_conv;
13114 htlc_conv.inner = (void*)(htlc & (~1));
13115 htlc_conv.is_owned = false;
13116 LDKTxCreationKeys keys_conv;
13117 keys_conv.inner = (void*)(keys & (~1));
13118 keys_conv.is_owned = false;
13119 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
13120 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13121 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13122 CVec_u8Z_free(arg_var);
13126 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
13127 LDKPublicKey broadcaster_ref;
13128 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
13129 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
13130 LDKPublicKey countersignatory_ref;
13131 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
13132 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
13133 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13134 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13135 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13136 CVec_u8Z_free(arg_var);
13140 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) {
13141 unsigned char prev_hash_arr[32];
13142 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
13143 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
13144 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13145 LDKHTLCOutputInCommitment htlc_conv;
13146 htlc_conv.inner = (void*)(htlc & (~1));
13147 htlc_conv.is_owned = false;
13148 LDKPublicKey broadcaster_delayed_payment_key_ref;
13149 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
13150 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
13151 LDKPublicKey revocation_key_ref;
13152 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
13153 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
13154 LDKTransaction arg_var = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13155 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13156 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13157 Transaction_free(arg_var);
13161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13162 LDKHolderCommitmentTransaction this_ptr_conv;
13163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13165 HolderCommitmentTransaction_free(this_ptr_conv);
13168 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13169 LDKHolderCommitmentTransaction orig_conv;
13170 orig_conv.inner = (void*)(orig & (~1));
13171 orig_conv.is_owned = false;
13172 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13173 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13174 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13175 long ret_ref = (long)ret_var.inner;
13176 if (ret_var.is_owned) {
13182 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
13183 LDKHolderCommitmentTransaction this_ptr_conv;
13184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13185 this_ptr_conv.is_owned = false;
13186 LDKTransaction arg_var = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
13187 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13188 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13189 Transaction_free(arg_var);
13193 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13194 LDKHolderCommitmentTransaction this_ptr_conv;
13195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13196 this_ptr_conv.is_owned = false;
13197 LDKTransaction val_ref;
13198 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
13199 val_ref.data = MALLOC(val_ref.datalen, "LDKTransaction Bytes");
13200 (*_env)->GetByteArrayRegion(_env, val, 0, val_ref.datalen, val_ref.data);
13201 val_ref.data_is_owned = true;
13202 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_ref);
13205 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
13206 LDKHolderCommitmentTransaction this_ptr_conv;
13207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13208 this_ptr_conv.is_owned = false;
13209 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13210 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
13214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13215 LDKHolderCommitmentTransaction this_ptr_conv;
13216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13217 this_ptr_conv.is_owned = false;
13218 LDKSignature val_ref;
13219 CHECK((*_env)->GetArrayLength (_env, val) == 64);
13220 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
13221 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
13224 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
13225 LDKHolderCommitmentTransaction this_ptr_conv;
13226 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13227 this_ptr_conv.is_owned = false;
13228 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
13232 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13233 LDKHolderCommitmentTransaction this_ptr_conv;
13234 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13235 this_ptr_conv.is_owned = false;
13236 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
13239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13240 LDKHolderCommitmentTransaction this_ptr_conv;
13241 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13242 this_ptr_conv.is_owned = false;
13243 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
13244 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13245 if (val_constr.datalen > 0)
13246 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13248 val_constr.data = NULL;
13249 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13250 for (size_t q = 0; q < val_constr.datalen; q++) {
13251 long arr_conv_42 = val_vals[q];
13252 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13253 FREE((void*)arr_conv_42);
13254 val_constr.data[q] = arr_conv_42_conv;
13256 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13257 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
13260 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) {
13261 LDKTransaction unsigned_tx_ref;
13262 unsigned_tx_ref.datalen = (*_env)->GetArrayLength (_env, unsigned_tx);
13263 unsigned_tx_ref.data = MALLOC(unsigned_tx_ref.datalen, "LDKTransaction Bytes");
13264 (*_env)->GetByteArrayRegion(_env, unsigned_tx, 0, unsigned_tx_ref.datalen, unsigned_tx_ref.data);
13265 unsigned_tx_ref.data_is_owned = true;
13266 LDKSignature counterparty_sig_ref;
13267 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
13268 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
13269 LDKPublicKey holder_funding_key_ref;
13270 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
13271 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
13272 LDKPublicKey counterparty_funding_key_ref;
13273 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
13274 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
13275 LDKTxCreationKeys keys_conv;
13276 keys_conv.inner = (void*)(keys & (~1));
13277 keys_conv.is_owned = (keys & 1) || (keys == 0);
13278 if (keys_conv.inner != NULL)
13279 keys_conv = TxCreationKeys_clone(&keys_conv);
13280 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
13281 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
13282 if (htlc_data_constr.datalen > 0)
13283 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13285 htlc_data_constr.data = NULL;
13286 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
13287 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
13288 long arr_conv_42 = htlc_data_vals[q];
13289 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13290 FREE((void*)arr_conv_42);
13291 htlc_data_constr.data[q] = arr_conv_42_conv;
13293 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
13294 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);
13295 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13296 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13297 long ret_ref = (long)ret_var.inner;
13298 if (ret_var.is_owned) {
13304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13305 LDKHolderCommitmentTransaction this_arg_conv;
13306 this_arg_conv.inner = (void*)(this_arg & (~1));
13307 this_arg_conv.is_owned = false;
13308 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13309 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13310 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13311 long ret_ref = (long)ret_var.inner;
13312 if (ret_var.is_owned) {
13318 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13319 LDKHolderCommitmentTransaction this_arg_conv;
13320 this_arg_conv.inner = (void*)(this_arg & (~1));
13321 this_arg_conv.is_owned = false;
13322 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13323 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13327 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) {
13328 LDKHolderCommitmentTransaction this_arg_conv;
13329 this_arg_conv.inner = (void*)(this_arg & (~1));
13330 this_arg_conv.is_owned = false;
13331 unsigned char funding_key_arr[32];
13332 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13333 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13334 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13335 LDKu8slice funding_redeemscript_ref;
13336 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13337 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13338 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13339 (*_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);
13340 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13344 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) {
13345 LDKHolderCommitmentTransaction this_arg_conv;
13346 this_arg_conv.inner = (void*)(this_arg & (~1));
13347 this_arg_conv.is_owned = false;
13348 unsigned char htlc_base_key_arr[32];
13349 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13350 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13351 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13352 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13353 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13354 return (long)ret_conv;
13357 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
13358 LDKHolderCommitmentTransaction obj_conv;
13359 obj_conv.inner = (void*)(obj & (~1));
13360 obj_conv.is_owned = false;
13361 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
13362 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13363 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13364 CVec_u8Z_free(arg_var);
13368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13369 LDKu8slice ser_ref;
13370 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13371 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13372 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13373 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13374 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13375 long ret_ref = (long)ret_var.inner;
13376 if (ret_var.is_owned) {
13379 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13384 LDKInitFeatures this_ptr_conv;
13385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13387 InitFeatures_free(this_ptr_conv);
13390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13391 LDKNodeFeatures this_ptr_conv;
13392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13394 NodeFeatures_free(this_ptr_conv);
13397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13398 LDKChannelFeatures this_ptr_conv;
13399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13401 ChannelFeatures_free(this_ptr_conv);
13404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13405 LDKRouteHop this_ptr_conv;
13406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13408 RouteHop_free(this_ptr_conv);
13411 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13412 LDKRouteHop orig_conv;
13413 orig_conv.inner = (void*)(orig & (~1));
13414 orig_conv.is_owned = false;
13415 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13416 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13417 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13418 long ret_ref = (long)ret_var.inner;
13419 if (ret_var.is_owned) {
13425 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13426 LDKRouteHop this_ptr_conv;
13427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13428 this_ptr_conv.is_owned = false;
13429 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13430 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13435 LDKRouteHop this_ptr_conv;
13436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13437 this_ptr_conv.is_owned = false;
13438 LDKPublicKey val_ref;
13439 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13440 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13441 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13445 LDKRouteHop this_ptr_conv;
13446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13447 this_ptr_conv.is_owned = false;
13448 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13451 long ret_ref = (long)ret_var.inner;
13452 if (ret_var.is_owned) {
13458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13459 LDKRouteHop this_ptr_conv;
13460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13461 this_ptr_conv.is_owned = false;
13462 LDKNodeFeatures val_conv;
13463 val_conv.inner = (void*)(val & (~1));
13464 val_conv.is_owned = (val & 1) || (val == 0);
13465 // Warning: we may need a move here but can't clone!
13466 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13470 LDKRouteHop this_ptr_conv;
13471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13472 this_ptr_conv.is_owned = false;
13473 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13478 LDKRouteHop this_ptr_conv;
13479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13480 this_ptr_conv.is_owned = false;
13481 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13485 LDKRouteHop this_ptr_conv;
13486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13487 this_ptr_conv.is_owned = false;
13488 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13489 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13490 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13491 long ret_ref = (long)ret_var.inner;
13492 if (ret_var.is_owned) {
13498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13499 LDKRouteHop this_ptr_conv;
13500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13501 this_ptr_conv.is_owned = false;
13502 LDKChannelFeatures val_conv;
13503 val_conv.inner = (void*)(val & (~1));
13504 val_conv.is_owned = (val & 1) || (val == 0);
13505 // Warning: we may need a move here but can't clone!
13506 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13510 LDKRouteHop this_ptr_conv;
13511 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13512 this_ptr_conv.is_owned = false;
13513 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13517 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13518 LDKRouteHop this_ptr_conv;
13519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13520 this_ptr_conv.is_owned = false;
13521 RouteHop_set_fee_msat(&this_ptr_conv, val);
13524 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13525 LDKRouteHop this_ptr_conv;
13526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13527 this_ptr_conv.is_owned = false;
13528 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13533 LDKRouteHop this_ptr_conv;
13534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13535 this_ptr_conv.is_owned = false;
13536 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13539 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) {
13540 LDKPublicKey pubkey_arg_ref;
13541 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13542 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13543 LDKNodeFeatures node_features_arg_conv;
13544 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13545 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13546 // Warning: we may need a move here but can't clone!
13547 LDKChannelFeatures channel_features_arg_conv;
13548 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13549 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13550 // Warning: we may need a move here but can't clone!
13551 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);
13552 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13553 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13554 long ret_ref = (long)ret_var.inner;
13555 if (ret_var.is_owned) {
13561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13562 LDKRoute this_ptr_conv;
13563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13565 Route_free(this_ptr_conv);
13568 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13569 LDKRoute orig_conv;
13570 orig_conv.inner = (void*)(orig & (~1));
13571 orig_conv.is_owned = false;
13572 LDKRoute ret_var = Route_clone(&orig_conv);
13573 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13574 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13575 long ret_ref = (long)ret_var.inner;
13576 if (ret_var.is_owned) {
13582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13583 LDKRoute this_ptr_conv;
13584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13585 this_ptr_conv.is_owned = false;
13586 LDKCVec_CVec_RouteHopZZ val_constr;
13587 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13588 if (val_constr.datalen > 0)
13589 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13591 val_constr.data = NULL;
13592 for (size_t m = 0; m < val_constr.datalen; m++) {
13593 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13594 LDKCVec_RouteHopZ arr_conv_12_constr;
13595 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13596 if (arr_conv_12_constr.datalen > 0)
13597 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13599 arr_conv_12_constr.data = NULL;
13600 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13601 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13602 long arr_conv_10 = arr_conv_12_vals[k];
13603 LDKRouteHop arr_conv_10_conv;
13604 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13605 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13606 if (arr_conv_10_conv.inner != NULL)
13607 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13608 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13610 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13611 val_constr.data[m] = arr_conv_12_constr;
13613 Route_set_paths(&this_ptr_conv, val_constr);
13616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13617 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13618 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13619 if (paths_arg_constr.datalen > 0)
13620 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13622 paths_arg_constr.data = NULL;
13623 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13624 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13625 LDKCVec_RouteHopZ arr_conv_12_constr;
13626 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13627 if (arr_conv_12_constr.datalen > 0)
13628 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13630 arr_conv_12_constr.data = NULL;
13631 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13632 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13633 long arr_conv_10 = arr_conv_12_vals[k];
13634 LDKRouteHop arr_conv_10_conv;
13635 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13636 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13637 if (arr_conv_10_conv.inner != NULL)
13638 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13639 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13641 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13642 paths_arg_constr.data[m] = arr_conv_12_constr;
13644 LDKRoute ret_var = Route_new(paths_arg_constr);
13645 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13646 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13647 long ret_ref = (long)ret_var.inner;
13648 if (ret_var.is_owned) {
13654 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13656 obj_conv.inner = (void*)(obj & (~1));
13657 obj_conv.is_owned = false;
13658 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13659 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13660 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13661 CVec_u8Z_free(arg_var);
13665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13666 LDKu8slice ser_ref;
13667 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13668 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13669 LDKRoute ret_var = Route_read(ser_ref);
13670 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13671 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13672 long ret_ref = (long)ret_var.inner;
13673 if (ret_var.is_owned) {
13676 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13681 LDKRouteHint this_ptr_conv;
13682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13684 RouteHint_free(this_ptr_conv);
13687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13688 LDKRouteHint orig_conv;
13689 orig_conv.inner = (void*)(orig & (~1));
13690 orig_conv.is_owned = false;
13691 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13692 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13693 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13694 long ret_ref = (long)ret_var.inner;
13695 if (ret_var.is_owned) {
13701 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13702 LDKRouteHint this_ptr_conv;
13703 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13704 this_ptr_conv.is_owned = false;
13705 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13706 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13711 LDKRouteHint this_ptr_conv;
13712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13713 this_ptr_conv.is_owned = false;
13714 LDKPublicKey val_ref;
13715 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13716 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13717 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13721 LDKRouteHint this_ptr_conv;
13722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13723 this_ptr_conv.is_owned = false;
13724 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13729 LDKRouteHint this_ptr_conv;
13730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13731 this_ptr_conv.is_owned = false;
13732 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13736 LDKRouteHint this_ptr_conv;
13737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13738 this_ptr_conv.is_owned = false;
13739 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13740 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13741 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13742 long ret_ref = (long)ret_var.inner;
13743 if (ret_var.is_owned) {
13749 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13750 LDKRouteHint this_ptr_conv;
13751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13752 this_ptr_conv.is_owned = false;
13753 LDKRoutingFees val_conv;
13754 val_conv.inner = (void*)(val & (~1));
13755 val_conv.is_owned = (val & 1) || (val == 0);
13756 if (val_conv.inner != NULL)
13757 val_conv = RoutingFees_clone(&val_conv);
13758 RouteHint_set_fees(&this_ptr_conv, val_conv);
13761 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13762 LDKRouteHint this_ptr_conv;
13763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13764 this_ptr_conv.is_owned = false;
13765 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13770 LDKRouteHint this_ptr_conv;
13771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13772 this_ptr_conv.is_owned = false;
13773 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13777 LDKRouteHint this_ptr_conv;
13778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13779 this_ptr_conv.is_owned = false;
13780 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13785 LDKRouteHint this_ptr_conv;
13786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13787 this_ptr_conv.is_owned = false;
13788 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13791 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) {
13792 LDKPublicKey src_node_id_arg_ref;
13793 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13794 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13795 LDKRoutingFees fees_arg_conv;
13796 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13797 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13798 if (fees_arg_conv.inner != NULL)
13799 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13800 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);
13801 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13802 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13803 long ret_ref = (long)ret_var.inner;
13804 if (ret_var.is_owned) {
13810 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) {
13811 LDKPublicKey our_node_id_ref;
13812 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13813 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13814 LDKNetworkGraph network_conv;
13815 network_conv.inner = (void*)(network & (~1));
13816 network_conv.is_owned = false;
13817 LDKPublicKey target_ref;
13818 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13819 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13820 LDKCVec_ChannelDetailsZ first_hops_constr;
13821 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13822 if (first_hops_constr.datalen > 0)
13823 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13825 first_hops_constr.data = NULL;
13826 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13827 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13828 long arr_conv_16 = first_hops_vals[q];
13829 LDKChannelDetails arr_conv_16_conv;
13830 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13831 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13832 first_hops_constr.data[q] = arr_conv_16_conv;
13834 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13835 LDKCVec_RouteHintZ last_hops_constr;
13836 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13837 if (last_hops_constr.datalen > 0)
13838 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13840 last_hops_constr.data = NULL;
13841 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13842 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13843 long arr_conv_11 = last_hops_vals[l];
13844 LDKRouteHint arr_conv_11_conv;
13845 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13846 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13847 if (arr_conv_11_conv.inner != NULL)
13848 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13849 last_hops_constr.data[l] = arr_conv_11_conv;
13851 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13852 LDKLogger logger_conv = *(LDKLogger*)logger;
13853 if (logger_conv.free == LDKLogger_JCalls_free) {
13854 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13855 LDKLogger_JCalls_clone(logger_conv.this_arg);
13857 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13858 *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);
13859 FREE(first_hops_constr.data);
13860 return (long)ret_conv;
13863 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13864 LDKNetworkGraph this_ptr_conv;
13865 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13866 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13867 NetworkGraph_free(this_ptr_conv);
13870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13871 LDKLockedNetworkGraph this_ptr_conv;
13872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13874 LockedNetworkGraph_free(this_ptr_conv);
13877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13878 LDKNetGraphMsgHandler this_ptr_conv;
13879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13881 NetGraphMsgHandler_free(this_ptr_conv);
13884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13885 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13886 LDKLogger logger_conv = *(LDKLogger*)logger;
13887 if (logger_conv.free == LDKLogger_JCalls_free) {
13888 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13889 LDKLogger_JCalls_clone(logger_conv.this_arg);
13891 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13892 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13893 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13894 long ret_ref = (long)ret_var.inner;
13895 if (ret_var.is_owned) {
13901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13902 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13903 LDKLogger logger_conv = *(LDKLogger*)logger;
13904 if (logger_conv.free == LDKLogger_JCalls_free) {
13905 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13906 LDKLogger_JCalls_clone(logger_conv.this_arg);
13908 LDKNetworkGraph network_graph_conv;
13909 network_graph_conv.inner = (void*)(network_graph & (~1));
13910 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13911 // Warning: we may need a move here but can't clone!
13912 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13913 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13914 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13915 long ret_ref = (long)ret_var.inner;
13916 if (ret_var.is_owned) {
13922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13923 LDKNetGraphMsgHandler this_arg_conv;
13924 this_arg_conv.inner = (void*)(this_arg & (~1));
13925 this_arg_conv.is_owned = false;
13926 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13927 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13928 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13929 long ret_ref = (long)ret_var.inner;
13930 if (ret_var.is_owned) {
13936 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13937 LDKLockedNetworkGraph this_arg_conv;
13938 this_arg_conv.inner = (void*)(this_arg & (~1));
13939 this_arg_conv.is_owned = false;
13940 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13941 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13942 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13943 long ret_ref = (long)ret_var.inner;
13944 if (ret_var.is_owned) {
13950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13951 LDKNetGraphMsgHandler this_arg_conv;
13952 this_arg_conv.inner = (void*)(this_arg & (~1));
13953 this_arg_conv.is_owned = false;
13954 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13955 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13960 LDKDirectionalChannelInfo this_ptr_conv;
13961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13963 DirectionalChannelInfo_free(this_ptr_conv);
13966 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13967 LDKDirectionalChannelInfo this_ptr_conv;
13968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13969 this_ptr_conv.is_owned = false;
13970 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13975 LDKDirectionalChannelInfo this_ptr_conv;
13976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13977 this_ptr_conv.is_owned = false;
13978 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13981 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
13982 LDKDirectionalChannelInfo this_ptr_conv;
13983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13984 this_ptr_conv.is_owned = false;
13985 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13990 LDKDirectionalChannelInfo this_ptr_conv;
13991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13992 this_ptr_conv.is_owned = false;
13993 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13996 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13997 LDKDirectionalChannelInfo this_ptr_conv;
13998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13999 this_ptr_conv.is_owned = false;
14000 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
14004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
14005 LDKDirectionalChannelInfo this_ptr_conv;
14006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14007 this_ptr_conv.is_owned = false;
14008 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
14011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14012 LDKDirectionalChannelInfo this_ptr_conv;
14013 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14014 this_ptr_conv.is_owned = false;
14015 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
14019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14020 LDKDirectionalChannelInfo this_ptr_conv;
14021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14022 this_ptr_conv.is_owned = false;
14023 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
14026 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14027 LDKDirectionalChannelInfo this_ptr_conv;
14028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14029 this_ptr_conv.is_owned = false;
14030 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
14031 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14032 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14033 long ret_ref = (long)ret_var.inner;
14034 if (ret_var.is_owned) {
14040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14041 LDKDirectionalChannelInfo this_ptr_conv;
14042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14043 this_ptr_conv.is_owned = false;
14044 LDKChannelUpdate val_conv;
14045 val_conv.inner = (void*)(val & (~1));
14046 val_conv.is_owned = (val & 1) || (val == 0);
14047 if (val_conv.inner != NULL)
14048 val_conv = ChannelUpdate_clone(&val_conv);
14049 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
14052 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14053 LDKDirectionalChannelInfo obj_conv;
14054 obj_conv.inner = (void*)(obj & (~1));
14055 obj_conv.is_owned = false;
14056 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
14057 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14058 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14059 CVec_u8Z_free(arg_var);
14063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14064 LDKu8slice ser_ref;
14065 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14066 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14067 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
14068 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14069 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14070 long ret_ref = (long)ret_var.inner;
14071 if (ret_var.is_owned) {
14074 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14079 LDKChannelInfo this_ptr_conv;
14080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14082 ChannelInfo_free(this_ptr_conv);
14085 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14086 LDKChannelInfo this_ptr_conv;
14087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14088 this_ptr_conv.is_owned = false;
14089 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
14090 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14091 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14092 long ret_ref = (long)ret_var.inner;
14093 if (ret_var.is_owned) {
14099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14100 LDKChannelInfo this_ptr_conv;
14101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14102 this_ptr_conv.is_owned = false;
14103 LDKChannelFeatures val_conv;
14104 val_conv.inner = (void*)(val & (~1));
14105 val_conv.is_owned = (val & 1) || (val == 0);
14106 // Warning: we may need a move here but can't clone!
14107 ChannelInfo_set_features(&this_ptr_conv, val_conv);
14110 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14111 LDKChannelInfo this_ptr_conv;
14112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14113 this_ptr_conv.is_owned = false;
14114 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14115 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
14119 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14120 LDKChannelInfo this_ptr_conv;
14121 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14122 this_ptr_conv.is_owned = false;
14123 LDKPublicKey val_ref;
14124 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14125 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14126 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
14129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14130 LDKChannelInfo this_ptr_conv;
14131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14132 this_ptr_conv.is_owned = false;
14133 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
14134 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14135 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14136 long ret_ref = (long)ret_var.inner;
14137 if (ret_var.is_owned) {
14143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14144 LDKChannelInfo this_ptr_conv;
14145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14146 this_ptr_conv.is_owned = false;
14147 LDKDirectionalChannelInfo val_conv;
14148 val_conv.inner = (void*)(val & (~1));
14149 val_conv.is_owned = (val & 1) || (val == 0);
14150 // Warning: we may need a move here but can't clone!
14151 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
14154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14155 LDKChannelInfo this_ptr_conv;
14156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14157 this_ptr_conv.is_owned = false;
14158 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14159 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
14163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14164 LDKChannelInfo this_ptr_conv;
14165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14166 this_ptr_conv.is_owned = false;
14167 LDKPublicKey val_ref;
14168 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14169 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14170 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
14173 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14174 LDKChannelInfo this_ptr_conv;
14175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14176 this_ptr_conv.is_owned = false;
14177 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
14178 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14179 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14180 long ret_ref = (long)ret_var.inner;
14181 if (ret_var.is_owned) {
14187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14188 LDKChannelInfo this_ptr_conv;
14189 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14190 this_ptr_conv.is_owned = false;
14191 LDKDirectionalChannelInfo val_conv;
14192 val_conv.inner = (void*)(val & (~1));
14193 val_conv.is_owned = (val & 1) || (val == 0);
14194 // Warning: we may need a move here but can't clone!
14195 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
14198 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14199 LDKChannelInfo this_ptr_conv;
14200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14201 this_ptr_conv.is_owned = false;
14202 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
14203 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14204 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14205 long ret_ref = (long)ret_var.inner;
14206 if (ret_var.is_owned) {
14212 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14213 LDKChannelInfo this_ptr_conv;
14214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14215 this_ptr_conv.is_owned = false;
14216 LDKChannelAnnouncement val_conv;
14217 val_conv.inner = (void*)(val & (~1));
14218 val_conv.is_owned = (val & 1) || (val == 0);
14219 if (val_conv.inner != NULL)
14220 val_conv = ChannelAnnouncement_clone(&val_conv);
14221 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
14224 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14225 LDKChannelInfo obj_conv;
14226 obj_conv.inner = (void*)(obj & (~1));
14227 obj_conv.is_owned = false;
14228 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
14229 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14230 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14231 CVec_u8Z_free(arg_var);
14235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14236 LDKu8slice ser_ref;
14237 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14238 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14239 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
14240 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14241 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14242 long ret_ref = (long)ret_var.inner;
14243 if (ret_var.is_owned) {
14246 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14251 LDKRoutingFees this_ptr_conv;
14252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14254 RoutingFees_free(this_ptr_conv);
14257 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14258 LDKRoutingFees orig_conv;
14259 orig_conv.inner = (void*)(orig & (~1));
14260 orig_conv.is_owned = false;
14261 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
14262 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14263 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14264 long ret_ref = (long)ret_var.inner;
14265 if (ret_var.is_owned) {
14271 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14272 LDKRoutingFees this_ptr_conv;
14273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14274 this_ptr_conv.is_owned = false;
14275 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
14279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14280 LDKRoutingFees this_ptr_conv;
14281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14282 this_ptr_conv.is_owned = false;
14283 RoutingFees_set_base_msat(&this_ptr_conv, val);
14286 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
14287 LDKRoutingFees this_ptr_conv;
14288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14289 this_ptr_conv.is_owned = false;
14290 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
14294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14295 LDKRoutingFees this_ptr_conv;
14296 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14297 this_ptr_conv.is_owned = false;
14298 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14301 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14302 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14303 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14304 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14305 long ret_ref = (long)ret_var.inner;
14306 if (ret_var.is_owned) {
14312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14313 LDKu8slice ser_ref;
14314 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14315 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14316 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
14317 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14318 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14319 long ret_ref = (long)ret_var.inner;
14320 if (ret_var.is_owned) {
14323 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14327 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
14328 LDKRoutingFees obj_conv;
14329 obj_conv.inner = (void*)(obj & (~1));
14330 obj_conv.is_owned = false;
14331 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
14332 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14333 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14334 CVec_u8Z_free(arg_var);
14338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14339 LDKNodeAnnouncementInfo this_ptr_conv;
14340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14342 NodeAnnouncementInfo_free(this_ptr_conv);
14345 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14346 LDKNodeAnnouncementInfo this_ptr_conv;
14347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14348 this_ptr_conv.is_owned = false;
14349 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14350 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14351 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14352 long ret_ref = (long)ret_var.inner;
14353 if (ret_var.is_owned) {
14359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14360 LDKNodeAnnouncementInfo this_ptr_conv;
14361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14362 this_ptr_conv.is_owned = false;
14363 LDKNodeFeatures val_conv;
14364 val_conv.inner = (void*)(val & (~1));
14365 val_conv.is_owned = (val & 1) || (val == 0);
14366 // Warning: we may need a move here but can't clone!
14367 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14370 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14371 LDKNodeAnnouncementInfo this_ptr_conv;
14372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14373 this_ptr_conv.is_owned = false;
14374 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14379 LDKNodeAnnouncementInfo this_ptr_conv;
14380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14381 this_ptr_conv.is_owned = false;
14382 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14385 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
14386 LDKNodeAnnouncementInfo this_ptr_conv;
14387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14388 this_ptr_conv.is_owned = false;
14389 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14390 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14395 LDKNodeAnnouncementInfo this_ptr_conv;
14396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14397 this_ptr_conv.is_owned = false;
14398 LDKThreeBytes val_ref;
14399 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14400 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14401 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14404 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14405 LDKNodeAnnouncementInfo this_ptr_conv;
14406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14407 this_ptr_conv.is_owned = false;
14408 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14409 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14413 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14414 LDKNodeAnnouncementInfo this_ptr_conv;
14415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14416 this_ptr_conv.is_owned = false;
14417 LDKThirtyTwoBytes val_ref;
14418 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14419 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14420 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14424 LDKNodeAnnouncementInfo this_ptr_conv;
14425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14426 this_ptr_conv.is_owned = false;
14427 LDKCVec_NetAddressZ val_constr;
14428 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14429 if (val_constr.datalen > 0)
14430 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14432 val_constr.data = NULL;
14433 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14434 for (size_t m = 0; m < val_constr.datalen; m++) {
14435 long arr_conv_12 = val_vals[m];
14436 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14437 FREE((void*)arr_conv_12);
14438 val_constr.data[m] = arr_conv_12_conv;
14440 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14441 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14445 LDKNodeAnnouncementInfo this_ptr_conv;
14446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14447 this_ptr_conv.is_owned = false;
14448 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14449 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14450 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14451 long ret_ref = (long)ret_var.inner;
14452 if (ret_var.is_owned) {
14458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14459 LDKNodeAnnouncementInfo this_ptr_conv;
14460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14461 this_ptr_conv.is_owned = false;
14462 LDKNodeAnnouncement val_conv;
14463 val_conv.inner = (void*)(val & (~1));
14464 val_conv.is_owned = (val & 1) || (val == 0);
14465 if (val_conv.inner != NULL)
14466 val_conv = NodeAnnouncement_clone(&val_conv);
14467 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14470 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) {
14471 LDKNodeFeatures features_arg_conv;
14472 features_arg_conv.inner = (void*)(features_arg & (~1));
14473 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14474 // Warning: we may need a move here but can't clone!
14475 LDKThreeBytes rgb_arg_ref;
14476 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14477 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14478 LDKThirtyTwoBytes alias_arg_ref;
14479 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14480 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14481 LDKCVec_NetAddressZ addresses_arg_constr;
14482 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14483 if (addresses_arg_constr.datalen > 0)
14484 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14486 addresses_arg_constr.data = NULL;
14487 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14488 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14489 long arr_conv_12 = addresses_arg_vals[m];
14490 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14491 FREE((void*)arr_conv_12);
14492 addresses_arg_constr.data[m] = arr_conv_12_conv;
14494 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14495 LDKNodeAnnouncement announcement_message_arg_conv;
14496 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14497 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14498 if (announcement_message_arg_conv.inner != NULL)
14499 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14500 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14501 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14502 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14503 long ret_ref = (long)ret_var.inner;
14504 if (ret_var.is_owned) {
14510 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14511 LDKNodeAnnouncementInfo obj_conv;
14512 obj_conv.inner = (void*)(obj & (~1));
14513 obj_conv.is_owned = false;
14514 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14515 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14516 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14517 CVec_u8Z_free(arg_var);
14521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14522 LDKu8slice ser_ref;
14523 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14524 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14525 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14526 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14527 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14528 long ret_ref = (long)ret_var.inner;
14529 if (ret_var.is_owned) {
14532 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14537 LDKNodeInfo this_ptr_conv;
14538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14540 NodeInfo_free(this_ptr_conv);
14543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14544 LDKNodeInfo this_ptr_conv;
14545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14546 this_ptr_conv.is_owned = false;
14547 LDKCVec_u64Z val_constr;
14548 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14549 if (val_constr.datalen > 0)
14550 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14552 val_constr.data = NULL;
14553 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14554 for (size_t g = 0; g < val_constr.datalen; g++) {
14555 long arr_conv_6 = val_vals[g];
14556 val_constr.data[g] = arr_conv_6;
14558 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14559 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14563 LDKNodeInfo this_ptr_conv;
14564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14565 this_ptr_conv.is_owned = false;
14566 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14567 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14568 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14569 long ret_ref = (long)ret_var.inner;
14570 if (ret_var.is_owned) {
14576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14577 LDKNodeInfo this_ptr_conv;
14578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14579 this_ptr_conv.is_owned = false;
14580 LDKRoutingFees val_conv;
14581 val_conv.inner = (void*)(val & (~1));
14582 val_conv.is_owned = (val & 1) || (val == 0);
14583 if (val_conv.inner != NULL)
14584 val_conv = RoutingFees_clone(&val_conv);
14585 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14589 LDKNodeInfo this_ptr_conv;
14590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14591 this_ptr_conv.is_owned = false;
14592 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14593 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14594 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14595 long ret_ref = (long)ret_var.inner;
14596 if (ret_var.is_owned) {
14602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14603 LDKNodeInfo this_ptr_conv;
14604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14605 this_ptr_conv.is_owned = false;
14606 LDKNodeAnnouncementInfo val_conv;
14607 val_conv.inner = (void*)(val & (~1));
14608 val_conv.is_owned = (val & 1) || (val == 0);
14609 // Warning: we may need a move here but can't clone!
14610 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14613 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) {
14614 LDKCVec_u64Z channels_arg_constr;
14615 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14616 if (channels_arg_constr.datalen > 0)
14617 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14619 channels_arg_constr.data = NULL;
14620 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14621 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14622 long arr_conv_6 = channels_arg_vals[g];
14623 channels_arg_constr.data[g] = arr_conv_6;
14625 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14626 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14627 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14628 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14629 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14630 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14631 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14632 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14633 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14634 // Warning: we may need a move here but can't clone!
14635 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14636 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14637 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14638 long ret_ref = (long)ret_var.inner;
14639 if (ret_var.is_owned) {
14645 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14646 LDKNodeInfo obj_conv;
14647 obj_conv.inner = (void*)(obj & (~1));
14648 obj_conv.is_owned = false;
14649 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14650 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14651 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14652 CVec_u8Z_free(arg_var);
14656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14657 LDKu8slice ser_ref;
14658 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14659 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14660 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14661 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14662 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14663 long ret_ref = (long)ret_var.inner;
14664 if (ret_var.is_owned) {
14667 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14671 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14672 LDKNetworkGraph obj_conv;
14673 obj_conv.inner = (void*)(obj & (~1));
14674 obj_conv.is_owned = false;
14675 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14676 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14677 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14678 CVec_u8Z_free(arg_var);
14682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14683 LDKu8slice ser_ref;
14684 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14685 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14686 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14689 long ret_ref = (long)ret_var.inner;
14690 if (ret_var.is_owned) {
14693 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14698 LDKNetworkGraph ret_var = NetworkGraph_new();
14699 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14700 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14701 long ret_ref = (long)ret_var.inner;
14702 if (ret_var.is_owned) {
14708 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) {
14709 LDKNetworkGraph this_arg_conv;
14710 this_arg_conv.inner = (void*)(this_arg & (~1));
14711 this_arg_conv.is_owned = false;
14712 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);