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) {
95 void* __real_realloc(void* ptr, size_t newlen);
96 void* __wrap_realloc(void* ptr, size_t len) {
98 void* res = __real_realloc(ptr, len);
99 new_allocation(res, "realloc call");
102 void __wrap_reallocarray(void* ptr, size_t new_sz) {
103 // Rust doesn't seem to use reallocarray currently
107 void __attribute__((destructor)) check_leaks() {
108 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
109 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
110 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
111 fprintf(stderr, "\n\n");
113 DO_ASSERT(allocation_ll == NULL);
115 static jclass arr_of_B_clz = NULL;
116 JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclass _b) {
117 arr_of_B_clz = (*env)->FindClass(env, "[B");
118 CHECK(arr_of_B_clz != NULL);
119 arr_of_B_clz = (*env)->NewGlobalRef(env, arr_of_B_clz);
122 static jmethodID ordinal_meth = NULL;
123 static jmethodID slicedef_meth = NULL;
124 static jclass slicedef_cls = NULL;
125 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
126 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
127 CHECK(ordinal_meth != NULL);
128 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
129 CHECK(slicedef_meth != NULL);
130 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
131 CHECK(slicedef_cls != NULL);
134 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
135 return *((bool*)ptr);
137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
138 return *((long*)ptr);
140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
143 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
144 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
145 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
148 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
149 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
150 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
151 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
154 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
155 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
156 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
157 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
158 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
161 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_txpointer_1get_1buffer (JNIEnv * env, jclass _b, jlong ptr) {
162 LDKTransaction *txdata = (LDKTransaction*)ptr;
164 slice.data = txdata->data;
165 slice.datalen = txdata->datalen;
166 return Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes(env, _b, (long)&slice);
168 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
169 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
170 txdata->datalen = (*env)->GetArrayLength(env, bytes);
171 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
172 txdata->data_is_owned = false;
173 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_txpointer_1free (JNIEnv * env, jclass _b, jlong ptr) {
177 LDKTransaction *tx = (LDKTransaction*)ptr;
178 tx->data_is_owned = true;
179 Transaction_free(*tx);
182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
183 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
184 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
185 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
186 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
187 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
188 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
189 return (long)vec->datalen;
191 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
192 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
193 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
194 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
195 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
196 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
197 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
203 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
204 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
205 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
206 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
208 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
209 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
210 case 0: return LDKAccessError_UnknownChain;
211 case 1: return LDKAccessError_UnknownTx;
215 static jclass LDKAccessError_class = NULL;
216 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
217 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
218 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
219 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
220 CHECK(LDKAccessError_class != NULL);
221 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
222 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
223 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
224 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
226 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
228 case LDKAccessError_UnknownChain:
229 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
230 case LDKAccessError_UnknownTx:
231 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
236 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
237 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
238 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
239 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
243 static jclass LDKChannelMonitorUpdateErr_class = NULL;
244 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
245 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
246 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
247 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
248 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
249 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
250 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
251 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
252 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
254 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
256 case LDKChannelMonitorUpdateErr_TemporaryFailure:
257 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
258 case LDKChannelMonitorUpdateErr_PermanentFailure:
259 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
264 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
265 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
266 case 0: return LDKConfirmationTarget_Background;
267 case 1: return LDKConfirmationTarget_Normal;
268 case 2: return LDKConfirmationTarget_HighPriority;
272 static jclass LDKConfirmationTarget_class = NULL;
273 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
274 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
275 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
276 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
277 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
278 CHECK(LDKConfirmationTarget_class != NULL);
279 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
280 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
281 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
282 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
283 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
284 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
286 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
288 case LDKConfirmationTarget_Background:
289 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
290 case LDKConfirmationTarget_Normal:
291 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
292 case LDKConfirmationTarget_HighPriority:
293 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
298 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
299 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
300 case 0: return LDKLevel_Off;
301 case 1: return LDKLevel_Error;
302 case 2: return LDKLevel_Warn;
303 case 3: return LDKLevel_Info;
304 case 4: return LDKLevel_Debug;
305 case 5: return LDKLevel_Trace;
309 static jclass LDKLevel_class = NULL;
310 static jfieldID LDKLevel_LDKLevel_Off = NULL;
311 static jfieldID LDKLevel_LDKLevel_Error = NULL;
312 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
313 static jfieldID LDKLevel_LDKLevel_Info = NULL;
314 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
315 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
316 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
317 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
318 CHECK(LDKLevel_class != NULL);
319 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
320 CHECK(LDKLevel_LDKLevel_Off != NULL);
321 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
322 CHECK(LDKLevel_LDKLevel_Error != NULL);
323 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
324 CHECK(LDKLevel_LDKLevel_Warn != NULL);
325 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
326 CHECK(LDKLevel_LDKLevel_Info != NULL);
327 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
328 CHECK(LDKLevel_LDKLevel_Debug != NULL);
329 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
330 CHECK(LDKLevel_LDKLevel_Trace != NULL);
332 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
335 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
337 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
339 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
341 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
343 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
345 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
350 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
351 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
352 case 0: return LDKNetwork_Bitcoin;
353 case 1: return LDKNetwork_Testnet;
354 case 2: return LDKNetwork_Regtest;
358 static jclass LDKNetwork_class = NULL;
359 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
360 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
361 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
362 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
363 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
364 CHECK(LDKNetwork_class != NULL);
365 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
366 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
367 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
368 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
369 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
370 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
372 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
374 case LDKNetwork_Bitcoin:
375 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
376 case LDKNetwork_Testnet:
377 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
378 case LDKNetwork_Regtest:
379 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
384 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
385 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
386 case 0: return LDKSecp256k1Error_IncorrectSignature;
387 case 1: return LDKSecp256k1Error_InvalidMessage;
388 case 2: return LDKSecp256k1Error_InvalidPublicKey;
389 case 3: return LDKSecp256k1Error_InvalidSignature;
390 case 4: return LDKSecp256k1Error_InvalidSecretKey;
391 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
392 case 6: return LDKSecp256k1Error_InvalidTweak;
393 case 7: return LDKSecp256k1Error_NotEnoughMemory;
394 case 8: return LDKSecp256k1Error_CallbackPanicked;
398 static jclass LDKSecp256k1Error_class = NULL;
399 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
400 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
401 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
402 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
403 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
404 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
405 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
406 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
407 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
408 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
409 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
410 CHECK(LDKSecp256k1Error_class != NULL);
411 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
412 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
413 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
414 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
415 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
416 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
417 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
418 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
419 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
420 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
421 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
422 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
423 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
424 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
425 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
426 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
427 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
428 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
430 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
432 case LDKSecp256k1Error_IncorrectSignature:
433 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
434 case LDKSecp256k1Error_InvalidMessage:
435 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
436 case LDKSecp256k1Error_InvalidPublicKey:
437 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
438 case LDKSecp256k1Error_InvalidSignature:
439 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
440 case LDKSecp256k1Error_InvalidSecretKey:
441 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
442 case LDKSecp256k1Error_InvalidRecoveryId:
443 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
444 case LDKSecp256k1Error_InvalidTweak:
445 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
446 case LDKSecp256k1Error_NotEnoughMemory:
447 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
448 case LDKSecp256k1Error_CallbackPanicked:
449 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
454 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
455 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
456 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
459 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
460 ret->datalen = (*env)->GetArrayLength(env, elems);
461 if (ret->datalen == 0) {
464 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
465 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
466 for (size_t i = 0; i < ret->datalen; i++) {
467 ret->data[i] = java_elems[i];
469 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
474 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
476 LDKTransaction b_conv = *(LDKTransaction*)b;
480 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
481 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1usizeTransactionZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
485 LDKC2TupleTempl_usize__Transaction *tuple = (LDKC2TupleTempl_usize__Transaction*)ptr;
486 LDKTransaction *b_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
488 long b_ref = (long)b_copy;
491 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
492 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
494 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
495 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
496 CHECK(val->result_ok);
497 return *val->contents.result;
499 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
500 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
501 CHECK(!val->result_ok);
502 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
505 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
506 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
508 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
509 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
510 CHECK(val->result_ok);
511 return *val->contents.result;
513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
514 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
515 CHECK(!val->result_ok);
516 LDKMonitorUpdateError err_var = (*val->contents.err);
517 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
518 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
519 long err_ref = (long)err_var.inner & ~1;
522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
523 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
525 a_conv.inner = (void*)(a & (~1));
526 a_conv.is_owned = (a & 1) || (a == 0);
527 if (a_conv.inner != NULL)
528 a_conv = OutPoint_clone(&a_conv);
531 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
532 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
534 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
538 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
539 LDKOutPoint a_var = tuple->a;
540 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
541 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
542 long a_ref = (long)a_var.inner & ~1;
545 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1OutPointScriptZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
546 LDKC2TupleTempl_OutPoint__CVec_u8Z *tuple = (LDKC2TupleTempl_OutPoint__CVec_u8Z*)ptr;
547 LDKCVec_u8Z b_var = tuple->b;
548 jbyteArray b_arr = (*_env)->NewByteArray(_env, b_var.datalen);
549 (*_env)->SetByteArrayRegion(_env, b_arr, 0, b_var.datalen, b_var.data);
552 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
553 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
554 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
557 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
558 ret->datalen = (*env)->GetArrayLength(env, elems);
559 if (ret->datalen == 0) {
562 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
563 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
564 for (size_t i = 0; i < ret->datalen; i++) {
565 jlong arr_elem = java_elems[i];
566 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
567 FREE((void*)arr_elem);
568 ret->data[i] = arr_elem_conv;
570 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
575 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
576 LDKThirtyTwoBytes a_ref;
577 CHECK((*_env)->GetArrayLength (_env, a) == 32);
578 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
580 LDKCVecTempl_TxOut b_constr;
581 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
582 if (b_constr.datalen > 0)
583 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
585 b_constr.data = NULL;
586 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
587 for (size_t h = 0; h < b_constr.datalen; h++) {
588 long arr_conv_7 = b_vals[h];
589 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
590 FREE((void*)arr_conv_7);
591 b_constr.data[h] = arr_conv_7_conv;
593 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
597 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
598 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
599 jbyteArray a_arr = (*_env)->NewByteArray(_env, 32);
600 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 32, tuple->a.data);
603 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1TxidCVec_1TxOutZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
604 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *tuple = (LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
605 LDKCVecTempl_TxOut b_var = tuple->b;
606 jlongArray b_arr = (*_env)->NewLongArray(_env, b_var.datalen);
607 jlong *b_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, b_arr, NULL);
608 for (size_t h = 0; h < b_var.datalen; h++) {
609 long arr_conv_7_ref = (long)&b_var.data[h];
610 b_arr_ptr[h] = arr_conv_7_ref;
612 (*_env)->ReleasePrimitiveArrayCritical(_env, b_arr, b_arr_ptr, 0);
615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
616 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
622 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
625 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1u64u64Z_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
626 LDKC2TupleTempl_u64__u64 *tuple = (LDKC2TupleTempl_u64__u64*)ptr;
629 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
630 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
631 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
633 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
634 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
636 CHECK((*_env)->GetArrayLength (_env, a) == 64);
637 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
639 LDKCVecTempl_Signature b_constr;
640 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
641 if (b_constr.datalen > 0)
642 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
644 b_constr.data = NULL;
645 for (size_t i = 0; i < b_constr.datalen; i++) {
646 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
647 LDKSignature arr_conv_8_ref;
648 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
649 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
650 b_constr.data[i] = arr_conv_8_ref;
655 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
656 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
657 jbyteArray a_arr = (*_env)->NewByteArray(_env, 64);
658 (*_env)->SetByteArrayRegion(_env, a_arr, 0, 64, tuple->a.compact_form);
661 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
662 LDKC2TupleTempl_Signature__CVecTempl_Signature *tuple = (LDKC2TupleTempl_Signature__CVecTempl_Signature*)ptr;
663 LDKCVecTempl_Signature b_var = tuple->b;
664 jobjectArray b_arr = (*_env)->NewObjectArray(_env, b_var.datalen, arr_of_B_clz, NULL);
665 for (size_t i = 0; i < b_var.datalen; i++) {
666 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
667 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, b_var.data[i].compact_form);
668 (*_env)->SetObjectArrayElement(_env, b_arr, i, arr_conv_8_arr);
672 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
673 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
676 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
677 CHECK(val->result_ok);
678 long res_ref = (long)&(*val->contents.result);
681 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
682 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
683 CHECK(!val->result_ok);
684 return *val->contents.err;
686 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
687 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
690 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
691 CHECK(val->result_ok);
692 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
693 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
696 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
697 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
698 CHECK(!val->result_ok);
699 return *val->contents.err;
701 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
702 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
704 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
705 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
706 CHECK(val->result_ok);
707 LDKCVecTempl_Signature res_var = (*val->contents.result);
708 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, arr_of_B_clz, NULL);
709 for (size_t i = 0; i < res_var.datalen; i++) {
710 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
711 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
712 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);
716 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
717 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
718 CHECK(!val->result_ok);
719 return *val->contents.err;
721 static jclass LDKAPIError_APIMisuseError_class = NULL;
722 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
723 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
724 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
725 static jclass LDKAPIError_RouteError_class = NULL;
726 static jmethodID LDKAPIError_RouteError_meth = NULL;
727 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
728 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
729 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
730 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
731 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
732 LDKAPIError_APIMisuseError_class =
733 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
734 CHECK(LDKAPIError_APIMisuseError_class != NULL);
735 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
736 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
737 LDKAPIError_FeeRateTooHigh_class =
738 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
739 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
740 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
741 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
742 LDKAPIError_RouteError_class =
743 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
744 CHECK(LDKAPIError_RouteError_class != NULL);
745 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
746 CHECK(LDKAPIError_RouteError_meth != NULL);
747 LDKAPIError_ChannelUnavailable_class =
748 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
749 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
750 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
751 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
752 LDKAPIError_MonitorUpdateFailed_class =
753 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
754 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
755 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
756 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
758 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
759 LDKAPIError *obj = (LDKAPIError*)ptr;
761 case LDKAPIError_APIMisuseError: {
762 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
763 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
764 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
765 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
767 case LDKAPIError_FeeRateTooHigh: {
768 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
769 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
770 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
771 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
773 case LDKAPIError_RouteError: {
774 LDKStr err_str = obj->route_error.err;
775 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
776 memcpy(err_buf, err_str.chars, err_str.len);
777 err_buf[err_str.len] = 0;
778 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
780 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
782 case LDKAPIError_ChannelUnavailable: {
783 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
784 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
785 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
786 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
788 case LDKAPIError_MonitorUpdateFailed: {
789 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
794 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
795 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
797 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
798 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
799 CHECK(val->result_ok);
800 return *val->contents.result;
802 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
803 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
804 CHECK(!val->result_ok);
805 long err_ref = (long)&(*val->contents.err);
808 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
809 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
811 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
812 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
813 CHECK(val->result_ok);
814 return *val->contents.result;
816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
817 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
818 CHECK(!val->result_ok);
819 LDKPaymentSendFailure err_var = (*val->contents.err);
820 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
821 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
822 long err_ref = (long)err_var.inner & ~1;
825 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) {
826 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
827 LDKChannelAnnouncement a_conv;
828 a_conv.inner = (void*)(a & (~1));
829 a_conv.is_owned = (a & 1) || (a == 0);
830 if (a_conv.inner != NULL)
831 a_conv = ChannelAnnouncement_clone(&a_conv);
833 LDKChannelUpdate b_conv;
834 b_conv.inner = (void*)(b & (~1));
835 b_conv.is_owned = (b & 1) || (b == 0);
836 if (b_conv.inner != NULL)
837 b_conv = ChannelUpdate_clone(&b_conv);
839 LDKChannelUpdate c_conv;
840 c_conv.inner = (void*)(c & (~1));
841 c_conv.is_owned = (c & 1) || (c == 0);
842 if (c_conv.inner != NULL)
843 c_conv = ChannelUpdate_clone(&c_conv);
847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
848 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
849 LDKChannelAnnouncement a_var = tuple->a;
850 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
851 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
852 long a_ref = (long)a_var.inner & ~1;
855 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
856 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
857 LDKChannelUpdate b_var = tuple->b;
858 CHECK((((long)b_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
859 CHECK((((long)&b_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
860 long b_ref = (long)b_var.inner & ~1;
863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1get_1c(JNIEnv *_env, jclass _b, jlong ptr) {
864 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *tuple = (LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
865 LDKChannelUpdate c_var = tuple->c;
866 CHECK((((long)c_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
867 CHECK((((long)&c_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
868 long c_ref = (long)c_var.inner & ~1;
871 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
872 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
874 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
875 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
876 CHECK(val->result_ok);
877 return *val->contents.result;
879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
880 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
881 CHECK(!val->result_ok);
882 LDKPeerHandleError err_var = (*val->contents.err);
883 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
884 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
885 long err_ref = (long)err_var.inner & ~1;
888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
889 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
890 LDKHTLCOutputInCommitment a_conv;
891 a_conv.inner = (void*)(a & (~1));
892 a_conv.is_owned = (a & 1) || (a == 0);
893 if (a_conv.inner != NULL)
894 a_conv = HTLCOutputInCommitment_clone(&a_conv);
897 CHECK((*_env)->GetArrayLength (_env, b) == 64);
898 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
902 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1a(JNIEnv *_env, jclass _b, jlong ptr) {
903 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
904 LDKHTLCOutputInCommitment a_var = tuple->a;
905 CHECK((((long)a_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
906 CHECK((((long)&a_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
907 long a_ref = (long)a_var.inner & ~1;
910 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1HTLCOutputInCommitmentSignatureZ_1get_1b(JNIEnv *_env, jclass _b, jlong ptr) {
911 LDKC2TupleTempl_HTLCOutputInCommitment__Signature *tuple = (LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
912 jbyteArray b_arr = (*_env)->NewByteArray(_env, 64);
913 (*_env)->SetByteArrayRegion(_env, b_arr, 0, 64, tuple->b.compact_form);
916 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
917 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
918 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
919 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
920 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
921 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
923 LDKSpendableOutputDescriptor_StaticOutput_class =
924 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
925 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
926 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
927 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
928 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
929 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
930 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
931 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
932 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
933 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
934 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
935 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
936 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
937 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
939 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
940 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
942 case LDKSpendableOutputDescriptor_StaticOutput: {
943 LDKOutPoint outpoint_var = obj->static_output.outpoint;
944 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
945 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
946 long outpoint_ref = (long)outpoint_var.inner & ~1;
947 long output_ref = (long)&obj->static_output.output;
948 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
950 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
951 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
952 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
953 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
954 long outpoint_ref = (long)outpoint_var.inner & ~1;
955 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
956 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
957 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
958 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
959 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
960 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
961 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);
963 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
964 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
965 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
966 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
967 long outpoint_ref = (long)outpoint_var.inner & ~1;
968 long output_ref = (long)&obj->static_output_counterparty_payment.output;
969 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
970 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
975 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
976 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
977 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
979 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
980 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
981 ret->datalen = (*env)->GetArrayLength(env, elems);
982 if (ret->datalen == 0) {
985 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
986 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
987 for (size_t i = 0; i < ret->datalen; i++) {
988 jlong arr_elem = java_elems[i];
989 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
990 FREE((void*)arr_elem);
991 ret->data[i] = arr_elem_conv;
993 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
997 static jclass LDKEvent_FundingGenerationReady_class = NULL;
998 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
999 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
1000 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
1001 static jclass LDKEvent_PaymentReceived_class = NULL;
1002 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
1003 static jclass LDKEvent_PaymentSent_class = NULL;
1004 static jmethodID LDKEvent_PaymentSent_meth = NULL;
1005 static jclass LDKEvent_PaymentFailed_class = NULL;
1006 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
1007 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
1008 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
1009 static jclass LDKEvent_SpendableOutputs_class = NULL;
1010 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
1011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
1012 LDKEvent_FundingGenerationReady_class =
1013 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
1014 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
1015 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
1016 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
1017 LDKEvent_FundingBroadcastSafe_class =
1018 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
1019 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
1020 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
1021 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
1022 LDKEvent_PaymentReceived_class =
1023 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
1024 CHECK(LDKEvent_PaymentReceived_class != NULL);
1025 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
1026 CHECK(LDKEvent_PaymentReceived_meth != NULL);
1027 LDKEvent_PaymentSent_class =
1028 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
1029 CHECK(LDKEvent_PaymentSent_class != NULL);
1030 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
1031 CHECK(LDKEvent_PaymentSent_meth != NULL);
1032 LDKEvent_PaymentFailed_class =
1033 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
1034 CHECK(LDKEvent_PaymentFailed_class != NULL);
1035 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
1036 CHECK(LDKEvent_PaymentFailed_meth != NULL);
1037 LDKEvent_PendingHTLCsForwardable_class =
1038 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
1039 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
1040 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
1041 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
1042 LDKEvent_SpendableOutputs_class =
1043 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
1044 CHECK(LDKEvent_SpendableOutputs_class != NULL);
1045 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
1046 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
1048 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1049 LDKEvent *obj = (LDKEvent*)ptr;
1051 case LDKEvent_FundingGenerationReady: {
1052 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
1053 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
1054 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
1055 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
1056 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
1057 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);
1059 case LDKEvent_FundingBroadcastSafe: {
1060 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
1061 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1062 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1063 long funding_txo_ref = (long)funding_txo_var.inner & ~1;
1064 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
1066 case LDKEvent_PaymentReceived: {
1067 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1068 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
1069 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
1070 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
1071 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
1073 case LDKEvent_PaymentSent: {
1074 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
1075 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
1076 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
1078 case LDKEvent_PaymentFailed: {
1079 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
1080 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
1081 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
1083 case LDKEvent_PendingHTLCsForwardable: {
1084 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
1086 case LDKEvent_SpendableOutputs: {
1087 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
1088 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
1089 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
1090 for (size_t b = 0; b < outputs_var.datalen; b++) {
1091 long arr_conv_27_ref = (long)&outputs_var.data[b];
1092 outputs_arr_ptr[b] = arr_conv_27_ref;
1094 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
1095 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
1100 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
1101 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1102 static jclass LDKErrorAction_IgnoreError_class = NULL;
1103 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1104 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1105 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
1107 LDKErrorAction_DisconnectPeer_class =
1108 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1109 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1110 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1111 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1112 LDKErrorAction_IgnoreError_class =
1113 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1114 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1115 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1116 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1117 LDKErrorAction_SendErrorMessage_class =
1118 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1119 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1120 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1121 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1123 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1124 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1126 case LDKErrorAction_DisconnectPeer: {
1127 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1128 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1129 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1130 long msg_ref = (long)msg_var.inner & ~1;
1131 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1133 case LDKErrorAction_IgnoreError: {
1134 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1136 case LDKErrorAction_SendErrorMessage: {
1137 LDKErrorMessage msg_var = obj->send_error_message.msg;
1138 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1139 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1140 long msg_ref = (long)msg_var.inner & ~1;
1141 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1146 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1147 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1148 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1149 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1150 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1151 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1153 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1154 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1155 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1156 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1157 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1158 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1159 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1160 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1161 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1162 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1163 LDKHTLCFailChannelUpdate_NodeFailure_class =
1164 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1165 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1166 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1167 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1169 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1170 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1172 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1173 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1174 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1175 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1176 long msg_ref = (long)msg_var.inner & ~1;
1177 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1179 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1180 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1182 case LDKHTLCFailChannelUpdate_NodeFailure: {
1183 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1184 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1185 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1190 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1191 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1192 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1193 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1194 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1195 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1196 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1197 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1198 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1199 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1200 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1201 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1202 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1203 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1204 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1205 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1206 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1207 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1208 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1209 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1210 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1211 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1212 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1213 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1214 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1215 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1216 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1217 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1218 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1219 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1220 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1221 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1222 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1223 LDKMessageSendEvent_SendAcceptChannel_class =
1224 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1225 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1226 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1227 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1228 LDKMessageSendEvent_SendOpenChannel_class =
1229 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1230 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1231 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1232 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1233 LDKMessageSendEvent_SendFundingCreated_class =
1234 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1235 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1236 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1237 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1238 LDKMessageSendEvent_SendFundingSigned_class =
1239 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1240 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1241 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1242 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1243 LDKMessageSendEvent_SendFundingLocked_class =
1244 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1245 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1246 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1247 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1248 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1249 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1250 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1251 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1252 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1253 LDKMessageSendEvent_UpdateHTLCs_class =
1254 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1255 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1256 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1257 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1258 LDKMessageSendEvent_SendRevokeAndACK_class =
1259 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1260 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1261 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1262 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1263 LDKMessageSendEvent_SendClosingSigned_class =
1264 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1265 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1266 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1267 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1268 LDKMessageSendEvent_SendShutdown_class =
1269 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1270 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1271 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1272 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1273 LDKMessageSendEvent_SendChannelReestablish_class =
1274 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1275 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1276 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1277 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1278 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1279 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1280 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1281 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1282 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1283 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1284 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1285 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1286 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1287 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1288 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1289 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1290 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1291 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1292 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1293 LDKMessageSendEvent_HandleError_class =
1294 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1295 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1296 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1297 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1298 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1299 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1300 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1301 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1302 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1304 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1305 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1307 case LDKMessageSendEvent_SendAcceptChannel: {
1308 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1309 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1310 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1311 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1312 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1313 long msg_ref = (long)msg_var.inner & ~1;
1314 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1316 case LDKMessageSendEvent_SendOpenChannel: {
1317 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1318 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1319 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1320 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1321 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1322 long msg_ref = (long)msg_var.inner & ~1;
1323 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1325 case LDKMessageSendEvent_SendFundingCreated: {
1326 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1327 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1328 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1329 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1330 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1331 long msg_ref = (long)msg_var.inner & ~1;
1332 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1334 case LDKMessageSendEvent_SendFundingSigned: {
1335 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1336 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1337 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1338 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1339 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1340 long msg_ref = (long)msg_var.inner & ~1;
1341 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1343 case LDKMessageSendEvent_SendFundingLocked: {
1344 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1345 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1346 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1347 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1348 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1349 long msg_ref = (long)msg_var.inner & ~1;
1350 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1352 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1353 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1354 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1355 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1356 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1357 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1358 long msg_ref = (long)msg_var.inner & ~1;
1359 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1361 case LDKMessageSendEvent_UpdateHTLCs: {
1362 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1363 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1364 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1365 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1366 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 long updates_ref = (long)updates_var.inner & ~1;
1368 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1370 case LDKMessageSendEvent_SendRevokeAndACK: {
1371 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1372 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1373 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1374 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1375 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1376 long msg_ref = (long)msg_var.inner & ~1;
1377 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1379 case LDKMessageSendEvent_SendClosingSigned: {
1380 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1381 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1382 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1383 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1384 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1385 long msg_ref = (long)msg_var.inner & ~1;
1386 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1388 case LDKMessageSendEvent_SendShutdown: {
1389 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1390 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1391 LDKShutdown msg_var = obj->send_shutdown.msg;
1392 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1393 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1394 long msg_ref = (long)msg_var.inner & ~1;
1395 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1397 case LDKMessageSendEvent_SendChannelReestablish: {
1398 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1399 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1400 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1401 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1402 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1403 long msg_ref = (long)msg_var.inner & ~1;
1404 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1406 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1407 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1408 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1409 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1410 long msg_ref = (long)msg_var.inner & ~1;
1411 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1412 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1413 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1414 long update_msg_ref = (long)update_msg_var.inner & ~1;
1415 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1417 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1418 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1419 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1420 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1421 long msg_ref = (long)msg_var.inner & ~1;
1422 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1424 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1425 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1426 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1427 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1428 long msg_ref = (long)msg_var.inner & ~1;
1429 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1431 case LDKMessageSendEvent_HandleError: {
1432 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1433 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1434 long action_ref = (long)&obj->handle_error.action;
1435 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1437 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1438 long update_ref = (long)&obj->payment_failure_network_update.update;
1439 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1444 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1445 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1446 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1449 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1450 ret->datalen = (*env)->GetArrayLength(env, elems);
1451 if (ret->datalen == 0) {
1454 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1455 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1456 for (size_t i = 0; i < ret->datalen; i++) {
1457 jlong arr_elem = java_elems[i];
1458 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1459 FREE((void*)arr_elem);
1460 ret->data[i] = arr_elem_conv;
1462 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1466 typedef struct LDKMessageSendEventsProvider_JCalls {
1467 atomic_size_t refcnt;
1470 jmethodID get_and_clear_pending_msg_events_meth;
1471 } LDKMessageSendEventsProvider_JCalls;
1472 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1473 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1475 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1476 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1478 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1479 LDKCVec_MessageSendEventZ arg_constr;
1480 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1481 if (arg_constr.datalen > 0)
1482 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1484 arg_constr.data = NULL;
1485 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1486 for (size_t s = 0; s < arg_constr.datalen; s++) {
1487 long arr_conv_18 = arg_vals[s];
1488 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1489 FREE((void*)arr_conv_18);
1490 arg_constr.data[s] = arr_conv_18_conv;
1492 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1495 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1496 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1497 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1499 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1500 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1504 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1505 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1506 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1507 return (void*) this_arg;
1509 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1510 jclass c = (*env)->GetObjectClass(env, o);
1512 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1513 atomic_init(&calls->refcnt, 1);
1514 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1515 calls->o = (*env)->NewWeakGlobalRef(env, o);
1516 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1517 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1519 LDKMessageSendEventsProvider ret = {
1520 .this_arg = (void*) calls,
1521 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1522 .free = LDKMessageSendEventsProvider_JCalls_free,
1526 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1527 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1528 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1529 return (long)res_ptr;
1531 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1532 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1536 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1537 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1538 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1539 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1540 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1541 for (size_t s = 0; s < ret_var.datalen; s++) {
1542 LDKMessageSendEvent *arr_conv_18_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
1543 *arr_conv_18_copy = MessageSendEvent_clone(&ret_var.data[s]);
1544 long arr_conv_18_ref = (long)arr_conv_18_copy;
1545 ret_arr_ptr[s] = arr_conv_18_ref;
1547 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1548 CVec_MessageSendEventZ_free(ret_var);
1552 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1553 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1554 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1557 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1558 ret->datalen = (*env)->GetArrayLength(env, elems);
1559 if (ret->datalen == 0) {
1562 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1563 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1564 for (size_t i = 0; i < ret->datalen; i++) {
1565 jlong arr_elem = java_elems[i];
1566 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1567 FREE((void*)arr_elem);
1568 ret->data[i] = arr_elem_conv;
1570 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1574 typedef struct LDKEventsProvider_JCalls {
1575 atomic_size_t refcnt;
1578 jmethodID get_and_clear_pending_events_meth;
1579 } LDKEventsProvider_JCalls;
1580 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1581 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1583 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1584 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1586 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1587 LDKCVec_EventZ arg_constr;
1588 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
1589 if (arg_constr.datalen > 0)
1590 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1592 arg_constr.data = NULL;
1593 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
1594 for (size_t h = 0; h < arg_constr.datalen; h++) {
1595 long arr_conv_7 = arg_vals[h];
1596 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1597 FREE((void*)arr_conv_7);
1598 arg_constr.data[h] = arr_conv_7_conv;
1600 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
1603 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1604 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1605 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1607 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1608 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1612 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1613 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1614 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1615 return (void*) this_arg;
1617 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1618 jclass c = (*env)->GetObjectClass(env, o);
1620 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1621 atomic_init(&calls->refcnt, 1);
1622 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1623 calls->o = (*env)->NewWeakGlobalRef(env, o);
1624 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1625 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1627 LDKEventsProvider ret = {
1628 .this_arg = (void*) calls,
1629 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1630 .free = LDKEventsProvider_JCalls_free,
1634 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1635 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1636 *res_ptr = LDKEventsProvider_init(env, _a, o);
1637 return (long)res_ptr;
1639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1640 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1644 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1645 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1646 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1647 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1648 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1649 for (size_t h = 0; h < ret_var.datalen; h++) {
1650 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
1651 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
1652 long arr_conv_7_ref = (long)arr_conv_7_copy;
1653 ret_arr_ptr[h] = arr_conv_7_ref;
1655 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1656 CVec_EventZ_free(ret_var);
1660 typedef struct LDKLogger_JCalls {
1661 atomic_size_t refcnt;
1666 void log_jcall(const void* this_arg, const char *record) {
1667 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1669 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1670 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1671 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1673 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1675 static void LDKLogger_JCalls_free(void* this_arg) {
1676 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1677 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1679 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1680 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1684 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1685 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1686 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1687 return (void*) this_arg;
1689 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1690 jclass c = (*env)->GetObjectClass(env, o);
1692 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1693 atomic_init(&calls->refcnt, 1);
1694 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1695 calls->o = (*env)->NewWeakGlobalRef(env, o);
1696 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1697 CHECK(calls->log_meth != NULL);
1700 .this_arg = (void*) calls,
1702 .free = LDKLogger_JCalls_free,
1706 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1707 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1708 *res_ptr = LDKLogger_init(env, _a, o);
1709 return (long)res_ptr;
1711 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1712 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1716 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1717 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1720 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1721 CHECK(val->result_ok);
1722 long res_ref = (long)&(*val->contents.result);
1725 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1726 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1727 CHECK(!val->result_ok);
1728 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1731 typedef struct LDKAccess_JCalls {
1732 atomic_size_t refcnt;
1735 jmethodID get_utxo_meth;
1737 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1738 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1740 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1741 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1742 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1743 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1745 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1746 LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)ret;
1750 static void LDKAccess_JCalls_free(void* this_arg) {
1751 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1752 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1754 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1755 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1759 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1760 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1761 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1762 return (void*) this_arg;
1764 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1765 jclass c = (*env)->GetObjectClass(env, o);
1767 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1768 atomic_init(&calls->refcnt, 1);
1769 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1770 calls->o = (*env)->NewWeakGlobalRef(env, o);
1771 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1772 CHECK(calls->get_utxo_meth != NULL);
1775 .this_arg = (void*) calls,
1776 .get_utxo = get_utxo_jcall,
1777 .free = LDKAccess_JCalls_free,
1781 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1782 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1783 *res_ptr = LDKAccess_init(env, _a, o);
1784 return (long)res_ptr;
1786 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1787 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1791 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) {
1792 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1793 unsigned char genesis_hash_arr[32];
1794 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1795 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1796 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1797 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1798 *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1799 return (long)ret_conv;
1802 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1803 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1804 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1805 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1806 for (size_t i = 0; i < vec->datalen; i++) {
1807 CHECK((((long)vec->data[i].inner) & 1) == 0);
1808 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1810 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1814 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1815 ret->datalen = (*env)->GetArrayLength(env, elems);
1816 if (ret->datalen == 0) {
1819 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1820 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1821 for (size_t i = 0; i < ret->datalen; i++) {
1822 jlong arr_elem = java_elems[i];
1823 LDKHTLCOutputInCommitment arr_elem_conv;
1824 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1825 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1826 if (arr_elem_conv.inner != NULL)
1827 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1828 ret->data[i] = arr_elem_conv;
1830 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1834 typedef struct LDKChannelKeys_JCalls {
1835 atomic_size_t refcnt;
1838 jmethodID get_per_commitment_point_meth;
1839 jmethodID release_commitment_secret_meth;
1840 jmethodID key_derivation_params_meth;
1841 jmethodID sign_counterparty_commitment_meth;
1842 jmethodID sign_holder_commitment_meth;
1843 jmethodID sign_holder_commitment_htlc_transactions_meth;
1844 jmethodID sign_justice_transaction_meth;
1845 jmethodID sign_counterparty_htlc_transaction_meth;
1846 jmethodID sign_closing_transaction_meth;
1847 jmethodID sign_channel_announcement_meth;
1848 jmethodID on_accept_meth;
1849 } LDKChannelKeys_JCalls;
1850 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1851 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1853 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1854 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1856 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1857 LDKPublicKey arg_ref;
1858 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
1859 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
1862 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1863 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1865 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1866 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1868 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1869 LDKThirtyTwoBytes arg_ref;
1870 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
1871 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
1874 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1875 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1877 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1878 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1880 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1881 LDKC2Tuple_u64u64Z ret_conv = *(LDKC2Tuple_u64u64Z*)ret;
1885 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) {
1886 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1888 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1889 LDKTransaction *commitment_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1890 *commitment_tx_copy = commitment_tx;
1891 long commitment_tx_ref = (long)commitment_tx_copy;
1892 LDKPreCalculatedTxCreationKeys keys_var = *keys;
1893 if (keys->inner != NULL)
1894 keys_var = PreCalculatedTxCreationKeys_clone(keys);
1895 CHECK((((long)keys_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1896 CHECK((((long)&keys_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1897 long keys_ref = (long)keys_var.inner & ~1;
1898 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1899 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1900 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1901 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1902 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1903 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1904 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1905 long arr_conv_24_ref = (long)arr_conv_24_var.inner;
1906 if (arr_conv_24_var.is_owned) {
1907 arr_conv_24_ref |= 1;
1909 htlcs_arr_ptr[y] = arr_conv_24_ref;
1911 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1912 FREE(htlcs_var.data);
1913 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1915 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_commitment_meth, feerate_per_kw, commitment_tx_ref, keys_ref, htlcs_arr);
1916 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)ret;
1920 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1921 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1923 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1924 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1925 if (holder_commitment_tx->inner != NULL)
1926 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1927 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1928 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1929 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
1930 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1932 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx_ref);
1933 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1937 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1938 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1940 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1941 LDKHolderCommitmentTransaction holder_commitment_tx_var = *holder_commitment_tx;
1942 if (holder_commitment_tx->inner != NULL)
1943 holder_commitment_tx_var = HolderCommitmentTransaction_clone(holder_commitment_tx);
1944 CHECK((((long)holder_commitment_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1945 CHECK((((long)&holder_commitment_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1946 long holder_commitment_tx_ref = (long)holder_commitment_tx_var.inner & ~1;
1947 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1949 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx_ref);
1950 LDKCResult_CVec_SignatureZNoneZ ret_conv = *(LDKCResult_CVec_SignatureZNoneZ*)ret;
1954 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) {
1955 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1957 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1958 LDKTransaction *justice_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1959 *justice_tx_copy = justice_tx;
1960 long justice_tx_ref = (long)justice_tx_copy;
1961 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1962 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1963 LDKHTLCOutputInCommitment htlc_var = *htlc;
1964 if (htlc->inner != NULL)
1965 htlc_var = HTLCOutputInCommitment_clone(htlc);
1966 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1967 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1968 long htlc_ref = (long)htlc_var.inner & ~1;
1969 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1971 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_justice_transaction_meth, justice_tx_ref, input, amount, per_commitment_key_arr, htlc_ref);
1972 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1976 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) {
1977 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1979 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1980 LDKTransaction *htlc_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
1981 *htlc_tx_copy = htlc_tx;
1982 long htlc_tx_ref = (long)htlc_tx_copy;
1983 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1984 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1985 LDKHTLCOutputInCommitment htlc_var = *htlc;
1986 if (htlc->inner != NULL)
1987 htlc_var = HTLCOutputInCommitment_clone(htlc);
1988 CHECK((((long)htlc_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1989 CHECK((((long)&htlc_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1990 long htlc_ref = (long)htlc_var.inner & ~1;
1991 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1993 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_ref, input, amount, per_commitment_point_arr, htlc_ref);
1994 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
1998 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1999 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2001 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2002 LDKTransaction *closing_tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2003 *closing_tx_copy = closing_tx;
2004 long closing_tx_ref = (long)closing_tx_copy;
2005 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2007 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
2008 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2012 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
2013 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2015 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2016 LDKUnsignedChannelAnnouncement msg_var = *msg;
2017 if (msg->inner != NULL)
2018 msg_var = UnsignedChannelAnnouncement_clone(msg);
2019 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2020 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2021 long msg_ref = (long)msg_var.inner & ~1;
2022 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2024 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg_ref);
2025 LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)ret;
2029 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
2030 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2032 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2033 LDKChannelPublicKeys channel_points_var = *channel_points;
2034 if (channel_points->inner != NULL)
2035 channel_points_var = ChannelPublicKeys_clone(channel_points);
2036 CHECK((((long)channel_points_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2037 CHECK((((long)&channel_points_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2038 long channel_points_ref = (long)channel_points_var.inner & ~1;
2039 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2041 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points_ref, counterparty_selected_contest_delay, holder_selected_contest_delay);
2043 static void LDKChannelKeys_JCalls_free(void* this_arg) {
2044 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2045 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2047 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2048 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2052 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
2053 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
2054 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2055 return (void*) this_arg;
2057 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2058 jclass c = (*env)->GetObjectClass(env, o);
2060 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
2061 atomic_init(&calls->refcnt, 1);
2062 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2063 calls->o = (*env)->NewWeakGlobalRef(env, o);
2064 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
2065 CHECK(calls->get_per_commitment_point_meth != NULL);
2066 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2067 CHECK(calls->release_commitment_secret_meth != NULL);
2068 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2069 CHECK(calls->key_derivation_params_meth != NULL);
2070 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
2071 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2072 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2073 CHECK(calls->sign_holder_commitment_meth != NULL);
2074 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2075 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2076 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
2077 CHECK(calls->sign_justice_transaction_meth != NULL);
2078 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
2079 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2080 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2081 CHECK(calls->sign_closing_transaction_meth != NULL);
2082 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2083 CHECK(calls->sign_channel_announcement_meth != NULL);
2084 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2085 CHECK(calls->on_accept_meth != NULL);
2087 LDKChannelPublicKeys pubkeys_conv;
2088 pubkeys_conv.inner = (void*)(pubkeys & (~1));
2089 pubkeys_conv.is_owned = (pubkeys & 1) || (pubkeys == 0);
2090 if (pubkeys_conv.inner != NULL)
2091 pubkeys_conv = ChannelPublicKeys_clone(&pubkeys_conv);
2093 LDKChannelKeys ret = {
2094 .this_arg = (void*) calls,
2095 .get_per_commitment_point = get_per_commitment_point_jcall,
2096 .release_commitment_secret = release_commitment_secret_jcall,
2097 .key_derivation_params = key_derivation_params_jcall,
2098 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2099 .sign_holder_commitment = sign_holder_commitment_jcall,
2100 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2101 .sign_justice_transaction = sign_justice_transaction_jcall,
2102 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2103 .sign_closing_transaction = sign_closing_transaction_jcall,
2104 .sign_channel_announcement = sign_channel_announcement_jcall,
2105 .on_accept = on_accept_jcall,
2106 .clone = LDKChannelKeys_JCalls_clone,
2107 .free = LDKChannelKeys_JCalls_free,
2108 .pubkeys = pubkeys_conv,
2109 .set_pubkeys = NULL,
2113 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o, jlong pubkeys) {
2114 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2115 *res_ptr = LDKChannelKeys_init(env, _a, o, pubkeys);
2116 return (long)res_ptr;
2118 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2119 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2123 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2124 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2125 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2126 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2130 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2131 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2132 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2133 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2137 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2138 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2139 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2140 *ret_ref = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2141 return (long)ret_ref;
2144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jint feerate_per_kw, jlong commitment_tx, jlong keys, jlongArray htlcs) {
2145 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2146 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
2147 LDKPreCalculatedTxCreationKeys keys_conv;
2148 keys_conv.inner = (void*)(keys & (~1));
2149 keys_conv.is_owned = (keys & 1) || (keys == 0);
2150 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2151 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2152 if (htlcs_constr.datalen > 0)
2153 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2155 htlcs_constr.data = NULL;
2156 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2157 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2158 long arr_conv_24 = htlcs_vals[y];
2159 LDKHTLCOutputInCommitment arr_conv_24_conv;
2160 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2161 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2162 if (arr_conv_24_conv.inner != NULL)
2163 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2164 htlcs_constr.data[y] = arr_conv_24_conv;
2166 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2167 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2168 *ret_conv = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
2169 return (long)ret_conv;
2172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2173 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2174 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2175 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2176 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2177 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2178 *ret_conv = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2179 return (long)ret_conv;
2182 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) {
2183 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2184 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2185 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2186 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2187 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2188 *ret_conv = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2189 return (long)ret_conv;
2192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1justice_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong justice_tx, jlong input, jlong amount, jbyteArray per_commitment_key, jlong htlc) {
2193 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2194 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2195 unsigned char per_commitment_key_arr[32];
2196 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2197 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2198 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2199 LDKHTLCOutputInCommitment htlc_conv;
2200 htlc_conv.inner = (void*)(htlc & (~1));
2201 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2202 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2203 *ret_conv = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2204 return (long)ret_conv;
2207 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1counterparty_1htlc_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong htlc_tx, jlong input, jlong amount, jbyteArray per_commitment_point, jlong htlc) {
2208 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2209 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2210 LDKPublicKey per_commitment_point_ref;
2211 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2212 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2213 LDKHTLCOutputInCommitment htlc_conv;
2214 htlc_conv.inner = (void*)(htlc & (~1));
2215 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2216 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2217 *ret_conv = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2218 return (long)ret_conv;
2221 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2222 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2223 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2224 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2225 *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2226 return (long)ret_conv;
2229 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2230 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2231 LDKUnsignedChannelAnnouncement msg_conv;
2232 msg_conv.inner = (void*)(msg & (~1));
2233 msg_conv.is_owned = (msg & 1) || (msg == 0);
2234 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2235 *ret_conv = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2236 return (long)ret_conv;
2239 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) {
2240 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2241 LDKChannelPublicKeys channel_points_conv;
2242 channel_points_conv.inner = (void*)(channel_points & (~1));
2243 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2244 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2247 LDKChannelPublicKeys LDKChannelKeys_set_get_pubkeys(LDKChannelKeys* this_arg) {
2248 if (this_arg->set_pubkeys != NULL)
2249 this_arg->set_pubkeys(this_arg);
2250 return this_arg->pubkeys;
2252 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2253 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2254 LDKChannelPublicKeys ret_var = LDKChannelKeys_set_get_pubkeys(this_arg_conv);
2255 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2256 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2257 long ret_ref = (long)ret_var.inner;
2258 if (ret_var.is_owned) {
2264 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2265 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2266 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2267 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2268 for (size_t i = 0; i < vec->datalen; i++) {
2269 CHECK((((long)vec->data[i].inner) & 1) == 0);
2270 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2272 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2276 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2277 ret->datalen = (*env)->GetArrayLength(env, elems);
2278 if (ret->datalen == 0) {
2281 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2282 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2283 for (size_t i = 0; i < ret->datalen; i++) {
2284 jlong arr_elem = java_elems[i];
2285 LDKMonitorEvent arr_elem_conv;
2286 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2287 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2288 if (arr_elem_conv.inner != NULL)
2289 arr_elem_conv = MonitorEvent_clone(&arr_elem_conv);
2290 ret->data[i] = arr_elem_conv;
2292 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2296 typedef struct LDKWatch_JCalls {
2297 atomic_size_t refcnt;
2300 jmethodID watch_channel_meth;
2301 jmethodID update_channel_meth;
2302 jmethodID release_pending_monitor_events_meth;
2304 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2305 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2307 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2308 LDKOutPoint funding_txo_var = funding_txo;
2309 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2310 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2311 long funding_txo_ref = (long)funding_txo_var.inner;
2312 if (funding_txo_var.is_owned) {
2313 funding_txo_ref |= 1;
2315 LDKChannelMonitor monitor_var = monitor;
2316 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2317 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2318 long monitor_ref = (long)monitor_var.inner;
2319 if (monitor_var.is_owned) {
2322 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2324 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2325 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2329 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2330 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2332 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2333 LDKOutPoint funding_txo_var = funding_txo;
2334 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2335 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2336 long funding_txo_ref = (long)funding_txo_var.inner;
2337 if (funding_txo_var.is_owned) {
2338 funding_txo_ref |= 1;
2340 LDKChannelMonitorUpdate update_var = update;
2341 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2342 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2343 long update_ref = (long)update_var.inner;
2344 if (update_var.is_owned) {
2347 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2349 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2350 LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)ret;
2354 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2355 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2357 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2358 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2360 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2361 LDKCVec_MonitorEventZ arg_constr;
2362 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
2363 if (arg_constr.datalen > 0)
2364 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2366 arg_constr.data = NULL;
2367 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
2368 for (size_t o = 0; o < arg_constr.datalen; o++) {
2369 long arr_conv_14 = arg_vals[o];
2370 LDKMonitorEvent arr_conv_14_conv;
2371 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2372 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2373 if (arr_conv_14_conv.inner != NULL)
2374 arr_conv_14_conv = MonitorEvent_clone(&arr_conv_14_conv);
2375 arg_constr.data[o] = arr_conv_14_conv;
2377 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
2380 static void LDKWatch_JCalls_free(void* this_arg) {
2381 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2382 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2384 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2385 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2389 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2390 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2391 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2392 return (void*) this_arg;
2394 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2395 jclass c = (*env)->GetObjectClass(env, o);
2397 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2398 atomic_init(&calls->refcnt, 1);
2399 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2400 calls->o = (*env)->NewWeakGlobalRef(env, o);
2401 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2402 CHECK(calls->watch_channel_meth != NULL);
2403 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2404 CHECK(calls->update_channel_meth != NULL);
2405 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2406 CHECK(calls->release_pending_monitor_events_meth != NULL);
2409 .this_arg = (void*) calls,
2410 .watch_channel = watch_channel_jcall,
2411 .update_channel = update_channel_jcall,
2412 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2413 .free = LDKWatch_JCalls_free,
2417 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2418 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2419 *res_ptr = LDKWatch_init(env, _a, o);
2420 return (long)res_ptr;
2422 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2423 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2428 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2429 LDKOutPoint funding_txo_conv;
2430 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2431 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2432 if (funding_txo_conv.inner != NULL)
2433 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2434 LDKChannelMonitor monitor_conv;
2435 monitor_conv.inner = (void*)(monitor & (~1));
2436 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2437 // Warning: we may need a move here but can't clone!
2438 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2439 *ret_conv = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2440 return (long)ret_conv;
2443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2444 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2445 LDKOutPoint funding_txo_conv;
2446 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2447 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2448 if (funding_txo_conv.inner != NULL)
2449 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2450 LDKChannelMonitorUpdate update_conv;
2451 update_conv.inner = (void*)(update & (~1));
2452 update_conv.is_owned = (update & 1) || (update == 0);
2453 if (update_conv.inner != NULL)
2454 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2455 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2456 *ret_conv = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2457 return (long)ret_conv;
2460 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2461 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2462 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2463 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2464 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2465 for (size_t o = 0; o < ret_var.datalen; o++) {
2466 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2467 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2468 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2469 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
2470 if (arr_conv_14_var.is_owned) {
2471 arr_conv_14_ref |= 1;
2473 ret_arr_ptr[o] = arr_conv_14_ref;
2475 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2480 typedef struct LDKFilter_JCalls {
2481 atomic_size_t refcnt;
2484 jmethodID register_tx_meth;
2485 jmethodID register_output_meth;
2487 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2488 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2490 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2491 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2492 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2493 LDKu8slice script_pubkey_var = script_pubkey;
2494 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2495 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2496 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2498 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2500 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2501 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2503 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2504 LDKOutPoint outpoint_var = *outpoint;
2505 if (outpoint->inner != NULL)
2506 outpoint_var = OutPoint_clone(outpoint);
2507 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2508 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2509 long outpoint_ref = (long)outpoint_var.inner & ~1;
2510 LDKu8slice script_pubkey_var = script_pubkey;
2511 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2512 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2513 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2515 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint_ref, script_pubkey_arr);
2517 static void LDKFilter_JCalls_free(void* this_arg) {
2518 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2519 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2521 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2522 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2526 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2527 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2528 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2529 return (void*) this_arg;
2531 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2532 jclass c = (*env)->GetObjectClass(env, o);
2534 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2535 atomic_init(&calls->refcnt, 1);
2536 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2537 calls->o = (*env)->NewWeakGlobalRef(env, o);
2538 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2539 CHECK(calls->register_tx_meth != NULL);
2540 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2541 CHECK(calls->register_output_meth != NULL);
2544 .this_arg = (void*) calls,
2545 .register_tx = register_tx_jcall,
2546 .register_output = register_output_jcall,
2547 .free = LDKFilter_JCalls_free,
2551 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2552 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2553 *res_ptr = LDKFilter_init(env, _a, o);
2554 return (long)res_ptr;
2556 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2557 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2561 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2562 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2563 unsigned char txid_arr[32];
2564 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2565 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2566 unsigned char (*txid_ref)[32] = &txid_arr;
2567 LDKu8slice script_pubkey_ref;
2568 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2569 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2570 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2571 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2575 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2576 LDKOutPoint outpoint_conv;
2577 outpoint_conv.inner = (void*)(outpoint & (~1));
2578 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2579 LDKu8slice script_pubkey_ref;
2580 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2581 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2582 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2583 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2586 typedef struct LDKBroadcasterInterface_JCalls {
2587 atomic_size_t refcnt;
2590 jmethodID broadcast_transaction_meth;
2591 } LDKBroadcasterInterface_JCalls;
2592 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2593 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2595 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2596 LDKTransaction *tx_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
2598 long tx_ref = (long)tx_copy;
2599 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2601 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2603 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2604 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2605 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2607 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2608 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2612 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2613 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2614 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2615 return (void*) this_arg;
2617 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2618 jclass c = (*env)->GetObjectClass(env, o);
2620 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2621 atomic_init(&calls->refcnt, 1);
2622 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2623 calls->o = (*env)->NewWeakGlobalRef(env, o);
2624 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2625 CHECK(calls->broadcast_transaction_meth != NULL);
2627 LDKBroadcasterInterface ret = {
2628 .this_arg = (void*) calls,
2629 .broadcast_transaction = broadcast_transaction_jcall,
2630 .free = LDKBroadcasterInterface_JCalls_free,
2634 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2635 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2636 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2637 return (long)res_ptr;
2639 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2640 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2645 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2646 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2647 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2650 typedef struct LDKFeeEstimator_JCalls {
2651 atomic_size_t refcnt;
2654 jmethodID get_est_sat_per_1000_weight_meth;
2655 } LDKFeeEstimator_JCalls;
2656 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2657 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2659 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2660 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2661 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2663 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2665 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2666 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2667 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2669 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2670 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2674 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2675 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2676 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2677 return (void*) this_arg;
2679 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2680 jclass c = (*env)->GetObjectClass(env, o);
2682 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2683 atomic_init(&calls->refcnt, 1);
2684 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2685 calls->o = (*env)->NewWeakGlobalRef(env, o);
2686 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2687 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2689 LDKFeeEstimator ret = {
2690 .this_arg = (void*) calls,
2691 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2692 .free = LDKFeeEstimator_JCalls_free,
2696 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2697 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2698 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2699 return (long)res_ptr;
2701 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2702 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2706 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) {
2707 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2708 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2709 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2713 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2714 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2715 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2717 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2718 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2719 ret->datalen = (*env)->GetArrayLength(env, elems);
2720 if (ret->datalen == 0) {
2723 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2724 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2725 for (size_t i = 0; i < ret->datalen; i++) {
2726 jlong arr_elem = java_elems[i];
2727 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2728 FREE((void*)arr_elem);
2729 ret->data[i] = arr_elem_conv;
2731 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2735 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2736 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2737 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2739 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2740 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2741 ret->datalen = (*env)->GetArrayLength(env, elems);
2742 if (ret->datalen == 0) {
2745 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2746 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2747 for (size_t i = 0; i < ret->datalen; i++) {
2748 jlong arr_elem = java_elems[i];
2749 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2750 ret->data[i] = arr_elem_conv;
2752 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2756 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2757 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2758 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2761 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2762 ret->datalen = (*env)->GetArrayLength(env, elems);
2763 if (ret->datalen == 0) {
2766 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2767 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2768 for (size_t i = 0; i < ret->datalen; i++) {
2769 jlong arr_elem = java_elems[i];
2770 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2771 FREE((void*)arr_elem);
2772 ret->data[i] = arr_elem_conv;
2774 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2778 typedef struct LDKKeysInterface_JCalls {
2779 atomic_size_t refcnt;
2782 jmethodID get_node_secret_meth;
2783 jmethodID get_destination_script_meth;
2784 jmethodID get_shutdown_pubkey_meth;
2785 jmethodID get_channel_keys_meth;
2786 jmethodID get_secure_random_bytes_meth;
2787 } LDKKeysInterface_JCalls;
2788 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2789 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2791 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2792 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2794 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2795 LDKSecretKey arg_ref;
2796 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2797 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
2800 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2801 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2803 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2804 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2806 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2807 LDKCVec_u8Z arg_ref;
2808 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
2809 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
2812 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2813 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2815 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2816 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2818 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2819 LDKPublicKey arg_ref;
2820 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
2821 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
2824 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2825 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2827 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2828 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2830 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2831 LDKChannelKeys ret_conv = *(LDKChannelKeys*)ret;
2832 if (ret_conv.free == LDKChannelKeys_JCalls_free) {
2833 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
2834 LDKChannelKeys_JCalls_clone(ret_conv.this_arg);
2838 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2839 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2841 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2842 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2844 jbyteArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2845 LDKThirtyTwoBytes arg_ref;
2846 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
2847 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.data);
2850 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2851 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2852 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2854 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2855 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2859 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2860 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2861 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2862 return (void*) this_arg;
2864 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2865 jclass c = (*env)->GetObjectClass(env, o);
2867 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2868 atomic_init(&calls->refcnt, 1);
2869 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2870 calls->o = (*env)->NewWeakGlobalRef(env, o);
2871 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2872 CHECK(calls->get_node_secret_meth != NULL);
2873 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2874 CHECK(calls->get_destination_script_meth != NULL);
2875 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2876 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2877 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2878 CHECK(calls->get_channel_keys_meth != NULL);
2879 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2880 CHECK(calls->get_secure_random_bytes_meth != NULL);
2882 LDKKeysInterface ret = {
2883 .this_arg = (void*) calls,
2884 .get_node_secret = get_node_secret_jcall,
2885 .get_destination_script = get_destination_script_jcall,
2886 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2887 .get_channel_keys = get_channel_keys_jcall,
2888 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2889 .free = LDKKeysInterface_JCalls_free,
2893 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2894 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2895 *res_ptr = LDKKeysInterface_init(env, _a, o);
2896 return (long)res_ptr;
2898 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2899 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2903 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2904 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2905 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2906 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2910 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2911 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2912 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2913 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2914 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2915 CVec_u8Z_free(arg_var);
2919 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2920 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2921 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2922 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2926 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) {
2927 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2928 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2929 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2933 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2934 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2935 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2936 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2940 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2941 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2942 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2943 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2944 for (size_t i = 0; i < vec->datalen; i++) {
2945 CHECK((((long)vec->data[i].inner) & 1) == 0);
2946 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2948 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2952 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2953 ret->datalen = (*env)->GetArrayLength(env, elems);
2954 if (ret->datalen == 0) {
2957 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2958 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2959 for (size_t i = 0; i < ret->datalen; i++) {
2960 jlong arr_elem = java_elems[i];
2961 LDKChannelDetails arr_elem_conv;
2962 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2963 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2964 if (arr_elem_conv.inner != NULL)
2965 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2966 ret->data[i] = arr_elem_conv;
2968 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2972 static jclass LDKNetAddress_IPv4_class = NULL;
2973 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2974 static jclass LDKNetAddress_IPv6_class = NULL;
2975 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2976 static jclass LDKNetAddress_OnionV2_class = NULL;
2977 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2978 static jclass LDKNetAddress_OnionV3_class = NULL;
2979 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2981 LDKNetAddress_IPv4_class =
2982 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2983 CHECK(LDKNetAddress_IPv4_class != NULL);
2984 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2985 CHECK(LDKNetAddress_IPv4_meth != NULL);
2986 LDKNetAddress_IPv6_class =
2987 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2988 CHECK(LDKNetAddress_IPv6_class != NULL);
2989 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2990 CHECK(LDKNetAddress_IPv6_meth != NULL);
2991 LDKNetAddress_OnionV2_class =
2992 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2993 CHECK(LDKNetAddress_OnionV2_class != NULL);
2994 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2995 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2996 LDKNetAddress_OnionV3_class =
2997 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2998 CHECK(LDKNetAddress_OnionV3_class != NULL);
2999 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
3000 CHECK(LDKNetAddress_OnionV3_meth != NULL);
3002 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
3003 LDKNetAddress *obj = (LDKNetAddress*)ptr;
3005 case LDKNetAddress_IPv4: {
3006 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
3007 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
3008 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
3010 case LDKNetAddress_IPv6: {
3011 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
3012 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
3013 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
3015 case LDKNetAddress_OnionV2: {
3016 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
3017 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
3018 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
3020 case LDKNetAddress_OnionV3: {
3021 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
3022 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
3023 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);
3028 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3029 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
3030 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
3032 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
3033 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
3034 ret->datalen = (*env)->GetArrayLength(env, elems);
3035 if (ret->datalen == 0) {
3038 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
3039 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3040 for (size_t i = 0; i < ret->datalen; i++) {
3041 jlong arr_elem = java_elems[i];
3042 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
3043 FREE((void*)arr_elem);
3044 ret->data[i] = arr_elem_conv;
3046 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3050 typedef struct LDKChannelMessageHandler_JCalls {
3051 atomic_size_t refcnt;
3054 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
3055 jmethodID handle_open_channel_meth;
3056 jmethodID handle_accept_channel_meth;
3057 jmethodID handle_funding_created_meth;
3058 jmethodID handle_funding_signed_meth;
3059 jmethodID handle_funding_locked_meth;
3060 jmethodID handle_shutdown_meth;
3061 jmethodID handle_closing_signed_meth;
3062 jmethodID handle_update_add_htlc_meth;
3063 jmethodID handle_update_fulfill_htlc_meth;
3064 jmethodID handle_update_fail_htlc_meth;
3065 jmethodID handle_update_fail_malformed_htlc_meth;
3066 jmethodID handle_commitment_signed_meth;
3067 jmethodID handle_revoke_and_ack_meth;
3068 jmethodID handle_update_fee_meth;
3069 jmethodID handle_announcement_signatures_meth;
3070 jmethodID peer_disconnected_meth;
3071 jmethodID peer_connected_meth;
3072 jmethodID handle_channel_reestablish_meth;
3073 jmethodID handle_error_meth;
3074 } LDKChannelMessageHandler_JCalls;
3075 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
3076 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3078 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3079 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3080 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3081 LDKInitFeatures their_features_var = their_features;
3082 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3083 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3084 long their_features_ref = (long)their_features_var.inner;
3085 if (their_features_var.is_owned) {
3086 their_features_ref |= 1;
3088 LDKOpenChannel msg_var = *msg;
3089 if (msg->inner != NULL)
3090 msg_var = OpenChannel_clone(msg);
3091 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3092 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3093 long msg_ref = (long)msg_var.inner & ~1;
3094 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3096 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3098 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3099 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3101 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3102 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3103 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3104 LDKInitFeatures their_features_var = their_features;
3105 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3106 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3107 long their_features_ref = (long)their_features_var.inner;
3108 if (their_features_var.is_owned) {
3109 their_features_ref |= 1;
3111 LDKAcceptChannel msg_var = *msg;
3112 if (msg->inner != NULL)
3113 msg_var = AcceptChannel_clone(msg);
3114 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3115 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3116 long msg_ref = (long)msg_var.inner & ~1;
3117 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3119 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref);
3121 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3122 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3124 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3125 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3126 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3127 LDKFundingCreated msg_var = *msg;
3128 if (msg->inner != NULL)
3129 msg_var = FundingCreated_clone(msg);
3130 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3131 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3132 long msg_ref = (long)msg_var.inner & ~1;
3133 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3135 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref);
3137 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3138 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3140 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3141 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3142 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3143 LDKFundingSigned msg_var = *msg;
3144 if (msg->inner != NULL)
3145 msg_var = FundingSigned_clone(msg);
3146 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3147 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3148 long msg_ref = (long)msg_var.inner & ~1;
3149 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3151 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref);
3153 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3154 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3156 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3157 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3158 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3159 LDKFundingLocked msg_var = *msg;
3160 if (msg->inner != NULL)
3161 msg_var = FundingLocked_clone(msg);
3162 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3163 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3164 long msg_ref = (long)msg_var.inner & ~1;
3165 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3167 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref);
3169 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3170 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3172 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3173 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3174 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3175 LDKShutdown msg_var = *msg;
3176 if (msg->inner != NULL)
3177 msg_var = Shutdown_clone(msg);
3178 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3179 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3180 long msg_ref = (long)msg_var.inner & ~1;
3181 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3183 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg_ref);
3185 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3186 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3188 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3189 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3190 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3191 LDKClosingSigned msg_var = *msg;
3192 if (msg->inner != NULL)
3193 msg_var = ClosingSigned_clone(msg);
3194 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3195 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3196 long msg_ref = (long)msg_var.inner & ~1;
3197 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3199 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref);
3201 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3202 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3204 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3205 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3206 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3207 LDKUpdateAddHTLC msg_var = *msg;
3208 if (msg->inner != NULL)
3209 msg_var = UpdateAddHTLC_clone(msg);
3210 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3211 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3212 long msg_ref = (long)msg_var.inner & ~1;
3213 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3215 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref);
3217 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3218 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3220 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3221 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3222 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3223 LDKUpdateFulfillHTLC msg_var = *msg;
3224 if (msg->inner != NULL)
3225 msg_var = UpdateFulfillHTLC_clone(msg);
3226 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3227 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3228 long msg_ref = (long)msg_var.inner & ~1;
3229 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3231 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref);
3233 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3234 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3236 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3237 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3238 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3239 LDKUpdateFailHTLC msg_var = *msg;
3240 if (msg->inner != NULL)
3241 msg_var = UpdateFailHTLC_clone(msg);
3242 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3243 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3244 long msg_ref = (long)msg_var.inner & ~1;
3245 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3247 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref);
3249 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3250 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3252 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3253 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3254 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3255 LDKUpdateFailMalformedHTLC msg_var = *msg;
3256 if (msg->inner != NULL)
3257 msg_var = UpdateFailMalformedHTLC_clone(msg);
3258 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3259 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3260 long msg_ref = (long)msg_var.inner & ~1;
3261 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3263 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref);
3265 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3266 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3268 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3269 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3270 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3271 LDKCommitmentSigned msg_var = *msg;
3272 if (msg->inner != NULL)
3273 msg_var = CommitmentSigned_clone(msg);
3274 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3275 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3276 long msg_ref = (long)msg_var.inner & ~1;
3277 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3279 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref);
3281 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3282 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3284 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3285 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3286 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3287 LDKRevokeAndACK msg_var = *msg;
3288 if (msg->inner != NULL)
3289 msg_var = RevokeAndACK_clone(msg);
3290 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3291 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3292 long msg_ref = (long)msg_var.inner & ~1;
3293 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3295 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref);
3297 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3298 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3300 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3301 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3302 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3303 LDKUpdateFee msg_var = *msg;
3304 if (msg->inner != NULL)
3305 msg_var = UpdateFee_clone(msg);
3306 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3307 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3308 long msg_ref = (long)msg_var.inner & ~1;
3309 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3311 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref);
3313 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3314 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3316 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3317 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3318 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3319 LDKAnnouncementSignatures msg_var = *msg;
3320 if (msg->inner != NULL)
3321 msg_var = AnnouncementSignatures_clone(msg);
3322 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3323 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3324 long msg_ref = (long)msg_var.inner & ~1;
3325 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3327 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref);
3329 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3330 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3332 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3333 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3334 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3335 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3337 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3339 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3340 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3342 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3343 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3344 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3345 LDKInit msg_var = *msg;
3346 if (msg->inner != NULL)
3347 msg_var = Init_clone(msg);
3348 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3349 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3350 long msg_ref = (long)msg_var.inner & ~1;
3351 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3353 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref);
3355 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3356 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3358 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3359 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3360 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3361 LDKChannelReestablish msg_var = *msg;
3362 if (msg->inner != NULL)
3363 msg_var = ChannelReestablish_clone(msg);
3364 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3365 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3366 long msg_ref = (long)msg_var.inner & ~1;
3367 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3369 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref);
3371 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *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 LDKErrorMessage msg_var = *msg;
3378 if (msg->inner != NULL)
3379 msg_var = ErrorMessage_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 & ~1;
3383 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3385 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref);
3387 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3388 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3389 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3391 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3392 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3396 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3397 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3398 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3399 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3400 return (void*) this_arg;
3402 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3403 jclass c = (*env)->GetObjectClass(env, o);
3405 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3406 atomic_init(&calls->refcnt, 1);
3407 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3408 calls->o = (*env)->NewWeakGlobalRef(env, o);
3409 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3410 CHECK(calls->handle_open_channel_meth != NULL);
3411 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3412 CHECK(calls->handle_accept_channel_meth != NULL);
3413 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3414 CHECK(calls->handle_funding_created_meth != NULL);
3415 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3416 CHECK(calls->handle_funding_signed_meth != NULL);
3417 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3418 CHECK(calls->handle_funding_locked_meth != NULL);
3419 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3420 CHECK(calls->handle_shutdown_meth != NULL);
3421 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3422 CHECK(calls->handle_closing_signed_meth != NULL);
3423 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3424 CHECK(calls->handle_update_add_htlc_meth != NULL);
3425 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3426 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3427 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3428 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3429 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3430 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3431 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3432 CHECK(calls->handle_commitment_signed_meth != NULL);
3433 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3434 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3435 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3436 CHECK(calls->handle_update_fee_meth != NULL);
3437 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3438 CHECK(calls->handle_announcement_signatures_meth != NULL);
3439 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3440 CHECK(calls->peer_disconnected_meth != NULL);
3441 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3442 CHECK(calls->peer_connected_meth != NULL);
3443 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3444 CHECK(calls->handle_channel_reestablish_meth != NULL);
3445 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3446 CHECK(calls->handle_error_meth != NULL);
3448 LDKChannelMessageHandler ret = {
3449 .this_arg = (void*) calls,
3450 .handle_open_channel = handle_open_channel_jcall,
3451 .handle_accept_channel = handle_accept_channel_jcall,
3452 .handle_funding_created = handle_funding_created_jcall,
3453 .handle_funding_signed = handle_funding_signed_jcall,
3454 .handle_funding_locked = handle_funding_locked_jcall,
3455 .handle_shutdown = handle_shutdown_jcall,
3456 .handle_closing_signed = handle_closing_signed_jcall,
3457 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3458 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3459 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3460 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3461 .handle_commitment_signed = handle_commitment_signed_jcall,
3462 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3463 .handle_update_fee = handle_update_fee_jcall,
3464 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3465 .peer_disconnected = peer_disconnected_jcall,
3466 .peer_connected = peer_connected_jcall,
3467 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3468 .handle_error = handle_error_jcall,
3469 .free = LDKChannelMessageHandler_JCalls_free,
3470 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3472 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3475 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3476 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3477 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3478 return (long)res_ptr;
3480 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3481 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3485 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) {
3486 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3487 LDKPublicKey their_node_id_ref;
3488 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3489 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3490 LDKInitFeatures their_features_conv;
3491 their_features_conv.inner = (void*)(their_features & (~1));
3492 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3493 // Warning: we may need a move here but can't clone!
3494 LDKOpenChannel msg_conv;
3495 msg_conv.inner = (void*)(msg & (~1));
3496 msg_conv.is_owned = (msg & 1) || (msg == 0);
3497 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3500 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) {
3501 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3502 LDKPublicKey their_node_id_ref;
3503 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3504 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3505 LDKInitFeatures their_features_conv;
3506 their_features_conv.inner = (void*)(their_features & (~1));
3507 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3508 // Warning: we may need a move here but can't clone!
3509 LDKAcceptChannel msg_conv;
3510 msg_conv.inner = (void*)(msg & (~1));
3511 msg_conv.is_owned = (msg & 1) || (msg == 0);
3512 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3515 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) {
3516 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3517 LDKPublicKey their_node_id_ref;
3518 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3519 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3520 LDKFundingCreated msg_conv;
3521 msg_conv.inner = (void*)(msg & (~1));
3522 msg_conv.is_owned = (msg & 1) || (msg == 0);
3523 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3526 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) {
3527 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3528 LDKPublicKey their_node_id_ref;
3529 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3530 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3531 LDKFundingSigned msg_conv;
3532 msg_conv.inner = (void*)(msg & (~1));
3533 msg_conv.is_owned = (msg & 1) || (msg == 0);
3534 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3537 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) {
3538 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3539 LDKPublicKey their_node_id_ref;
3540 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3541 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3542 LDKFundingLocked msg_conv;
3543 msg_conv.inner = (void*)(msg & (~1));
3544 msg_conv.is_owned = (msg & 1) || (msg == 0);
3545 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3549 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3550 LDKPublicKey their_node_id_ref;
3551 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3552 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3553 LDKShutdown msg_conv;
3554 msg_conv.inner = (void*)(msg & (~1));
3555 msg_conv.is_owned = (msg & 1) || (msg == 0);
3556 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3559 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) {
3560 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3561 LDKPublicKey their_node_id_ref;
3562 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3563 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3564 LDKClosingSigned msg_conv;
3565 msg_conv.inner = (void*)(msg & (~1));
3566 msg_conv.is_owned = (msg & 1) || (msg == 0);
3567 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3570 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) {
3571 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3572 LDKPublicKey their_node_id_ref;
3573 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3574 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3575 LDKUpdateAddHTLC msg_conv;
3576 msg_conv.inner = (void*)(msg & (~1));
3577 msg_conv.is_owned = (msg & 1) || (msg == 0);
3578 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3581 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) {
3582 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3583 LDKPublicKey their_node_id_ref;
3584 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3585 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3586 LDKUpdateFulfillHTLC msg_conv;
3587 msg_conv.inner = (void*)(msg & (~1));
3588 msg_conv.is_owned = (msg & 1) || (msg == 0);
3589 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3592 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) {
3593 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3594 LDKPublicKey their_node_id_ref;
3595 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3596 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3597 LDKUpdateFailHTLC msg_conv;
3598 msg_conv.inner = (void*)(msg & (~1));
3599 msg_conv.is_owned = (msg & 1) || (msg == 0);
3600 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3603 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) {
3604 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3605 LDKPublicKey their_node_id_ref;
3606 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3607 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3608 LDKUpdateFailMalformedHTLC msg_conv;
3609 msg_conv.inner = (void*)(msg & (~1));
3610 msg_conv.is_owned = (msg & 1) || (msg == 0);
3611 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3614 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) {
3615 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3616 LDKPublicKey their_node_id_ref;
3617 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3618 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3619 LDKCommitmentSigned msg_conv;
3620 msg_conv.inner = (void*)(msg & (~1));
3621 msg_conv.is_owned = (msg & 1) || (msg == 0);
3622 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3625 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) {
3626 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3627 LDKPublicKey their_node_id_ref;
3628 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3629 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3630 LDKRevokeAndACK msg_conv;
3631 msg_conv.inner = (void*)(msg & (~1));
3632 msg_conv.is_owned = (msg & 1) || (msg == 0);
3633 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3636 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) {
3637 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3638 LDKPublicKey their_node_id_ref;
3639 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3640 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3641 LDKUpdateFee msg_conv;
3642 msg_conv.inner = (void*)(msg & (~1));
3643 msg_conv.is_owned = (msg & 1) || (msg == 0);
3644 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3647 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) {
3648 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3649 LDKPublicKey their_node_id_ref;
3650 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3651 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3652 LDKAnnouncementSignatures msg_conv;
3653 msg_conv.inner = (void*)(msg & (~1));
3654 msg_conv.is_owned = (msg & 1) || (msg == 0);
3655 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3658 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) {
3659 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3660 LDKPublicKey their_node_id_ref;
3661 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3662 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3663 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3667 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3668 LDKPublicKey their_node_id_ref;
3669 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3670 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3672 msg_conv.inner = (void*)(msg & (~1));
3673 msg_conv.is_owned = (msg & 1) || (msg == 0);
3674 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3677 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) {
3678 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3679 LDKPublicKey their_node_id_ref;
3680 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3681 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3682 LDKChannelReestablish msg_conv;
3683 msg_conv.inner = (void*)(msg & (~1));
3684 msg_conv.is_owned = (msg & 1) || (msg == 0);
3685 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3689 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3690 LDKPublicKey their_node_id_ref;
3691 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3692 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3693 LDKErrorMessage msg_conv;
3694 msg_conv.inner = (void*)(msg & (~1));
3695 msg_conv.is_owned = (msg & 1) || (msg == 0);
3696 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3699 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3700 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3701 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3702 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3703 for (size_t i = 0; i < vec->datalen; i++) {
3704 CHECK((((long)vec->data[i].inner) & 1) == 0);
3705 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3707 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3711 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3712 ret->datalen = (*env)->GetArrayLength(env, elems);
3713 if (ret->datalen == 0) {
3716 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3717 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3718 for (size_t i = 0; i < ret->datalen; i++) {
3719 jlong arr_elem = java_elems[i];
3720 LDKChannelMonitor arr_elem_conv;
3721 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3722 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3723 // Warning: we may need a move here but can't clone!
3724 ret->data[i] = arr_elem_conv;
3726 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3730 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3731 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3732 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3735 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3736 ret->datalen = (*env)->GetArrayLength(env, elems);
3737 if (ret->datalen == 0) {
3740 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3741 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3742 for (size_t i = 0; i < ret->datalen; i++) {
3743 ret->data[i] = java_elems[i];
3745 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3749 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3750 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3751 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3752 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3753 for (size_t i = 0; i < vec->datalen; i++) {
3754 CHECK((((long)vec->data[i].inner) & 1) == 0);
3755 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3757 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3760 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3761 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3762 ret->datalen = (*env)->GetArrayLength(env, elems);
3763 if (ret->datalen == 0) {
3766 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3767 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3768 for (size_t i = 0; i < ret->datalen; i++) {
3769 jlong arr_elem = java_elems[i];
3770 LDKUpdateAddHTLC arr_elem_conv;
3771 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3772 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3773 if (arr_elem_conv.inner != NULL)
3774 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3775 ret->data[i] = arr_elem_conv;
3777 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3781 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3782 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3783 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3784 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3785 for (size_t i = 0; i < vec->datalen; i++) {
3786 CHECK((((long)vec->data[i].inner) & 1) == 0);
3787 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3789 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3792 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3793 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3794 ret->datalen = (*env)->GetArrayLength(env, elems);
3795 if (ret->datalen == 0) {
3798 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3799 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3800 for (size_t i = 0; i < ret->datalen; i++) {
3801 jlong arr_elem = java_elems[i];
3802 LDKUpdateFulfillHTLC arr_elem_conv;
3803 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3804 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3805 if (arr_elem_conv.inner != NULL)
3806 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3807 ret->data[i] = arr_elem_conv;
3809 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3813 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3814 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3815 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3816 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3817 for (size_t i = 0; i < vec->datalen; i++) {
3818 CHECK((((long)vec->data[i].inner) & 1) == 0);
3819 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3821 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3825 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3826 ret->datalen = (*env)->GetArrayLength(env, elems);
3827 if (ret->datalen == 0) {
3830 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3831 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3832 for (size_t i = 0; i < ret->datalen; i++) {
3833 jlong arr_elem = java_elems[i];
3834 LDKUpdateFailHTLC arr_elem_conv;
3835 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3836 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3837 if (arr_elem_conv.inner != NULL)
3838 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3839 ret->data[i] = arr_elem_conv;
3841 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3845 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3846 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3847 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3848 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3849 for (size_t i = 0; i < vec->datalen; i++) {
3850 CHECK((((long)vec->data[i].inner) & 1) == 0);
3851 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3853 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3856 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3857 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3858 ret->datalen = (*env)->GetArrayLength(env, elems);
3859 if (ret->datalen == 0) {
3862 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3863 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3864 for (size_t i = 0; i < ret->datalen; i++) {
3865 jlong arr_elem = java_elems[i];
3866 LDKUpdateFailMalformedHTLC arr_elem_conv;
3867 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3868 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3869 if (arr_elem_conv.inner != NULL)
3870 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3871 ret->data[i] = arr_elem_conv;
3873 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3877 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3878 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3880 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3881 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3882 CHECK(val->result_ok);
3883 return *val->contents.result;
3885 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3886 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3887 CHECK(!val->result_ok);
3888 LDKLightningError err_var = (*val->contents.err);
3889 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3890 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3891 long err_ref = (long)err_var.inner & ~1;
3894 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3895 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3896 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3899 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3900 ret->datalen = (*env)->GetArrayLength(env, elems);
3901 if (ret->datalen == 0) {
3904 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3905 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3906 for (size_t i = 0; i < ret->datalen; i++) {
3907 jlong arr_elem = java_elems[i];
3908 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3909 FREE((void*)arr_elem);
3910 ret->data[i] = arr_elem_conv;
3912 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3916 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3917 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3918 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3919 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3920 for (size_t i = 0; i < vec->datalen; i++) {
3921 CHECK((((long)vec->data[i].inner) & 1) == 0);
3922 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3924 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3928 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3929 ret->datalen = (*env)->GetArrayLength(env, elems);
3930 if (ret->datalen == 0) {
3933 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3934 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3935 for (size_t i = 0; i < ret->datalen; i++) {
3936 jlong arr_elem = java_elems[i];
3937 LDKNodeAnnouncement arr_elem_conv;
3938 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3939 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3940 if (arr_elem_conv.inner != NULL)
3941 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3942 ret->data[i] = arr_elem_conv;
3944 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3948 typedef struct LDKRoutingMessageHandler_JCalls {
3949 atomic_size_t refcnt;
3952 jmethodID handle_node_announcement_meth;
3953 jmethodID handle_channel_announcement_meth;
3954 jmethodID handle_channel_update_meth;
3955 jmethodID handle_htlc_fail_channel_update_meth;
3956 jmethodID get_next_channel_announcements_meth;
3957 jmethodID get_next_node_announcements_meth;
3958 jmethodID should_request_full_sync_meth;
3959 } LDKRoutingMessageHandler_JCalls;
3960 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3961 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3963 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3964 LDKNodeAnnouncement msg_var = *msg;
3965 if (msg->inner != NULL)
3966 msg_var = NodeAnnouncement_clone(msg);
3967 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3968 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3969 long msg_ref = (long)msg_var.inner & ~1;
3970 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3972 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg_ref);
3973 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3977 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3978 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3980 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3981 LDKChannelAnnouncement msg_var = *msg;
3982 if (msg->inner != NULL)
3983 msg_var = ChannelAnnouncement_clone(msg);
3984 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3985 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3986 long msg_ref = (long)msg_var.inner & ~1;
3987 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3989 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg_ref);
3990 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
3994 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3995 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3997 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3998 LDKChannelUpdate msg_var = *msg;
3999 if (msg->inner != NULL)
4000 msg_var = ChannelUpdate_clone(msg);
4001 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4002 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4003 long msg_ref = (long)msg_var.inner & ~1;
4004 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4006 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg_ref);
4007 LDKCResult_boolLightningErrorZ ret_conv = *(LDKCResult_boolLightningErrorZ*)ret;
4011 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
4012 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4014 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4015 long ret_update = (long)update;
4016 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4018 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
4020 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
4021 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4023 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4024 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4026 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
4027 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4028 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4029 if (arg_constr.datalen > 0)
4030 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4032 arg_constr.data = NULL;
4033 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4034 for (size_t l = 0; l < arg_constr.datalen; l++) {
4035 long arr_conv_63 = arg_vals[l];
4036 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4037 FREE((void*)arr_conv_63);
4038 arg_constr.data[l] = arr_conv_63_conv;
4040 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4043 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
4044 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4046 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4047 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
4048 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
4049 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4051 jlongArray arg = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
4052 LDKCVec_NodeAnnouncementZ arg_constr;
4053 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4054 if (arg_constr.datalen > 0)
4055 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4057 arg_constr.data = NULL;
4058 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4059 for (size_t s = 0; s < arg_constr.datalen; s++) {
4060 long arr_conv_18 = arg_vals[s];
4061 LDKNodeAnnouncement arr_conv_18_conv;
4062 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4063 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4064 if (arr_conv_18_conv.inner != NULL)
4065 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
4066 arg_constr.data[s] = arr_conv_18_conv;
4068 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4071 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
4072 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4074 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4075 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
4076 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
4077 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4079 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
4081 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
4082 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4083 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4085 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4086 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4090 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
4091 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
4092 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4093 return (void*) this_arg;
4095 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
4096 jclass c = (*env)->GetObjectClass(env, o);
4098 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
4099 atomic_init(&calls->refcnt, 1);
4100 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4101 calls->o = (*env)->NewWeakGlobalRef(env, o);
4102 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
4103 CHECK(calls->handle_node_announcement_meth != NULL);
4104 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
4105 CHECK(calls->handle_channel_announcement_meth != NULL);
4106 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
4107 CHECK(calls->handle_channel_update_meth != NULL);
4108 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
4109 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
4110 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
4111 CHECK(calls->get_next_channel_announcements_meth != NULL);
4112 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
4113 CHECK(calls->get_next_node_announcements_meth != NULL);
4114 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
4115 CHECK(calls->should_request_full_sync_meth != NULL);
4117 LDKRoutingMessageHandler ret = {
4118 .this_arg = (void*) calls,
4119 .handle_node_announcement = handle_node_announcement_jcall,
4120 .handle_channel_announcement = handle_channel_announcement_jcall,
4121 .handle_channel_update = handle_channel_update_jcall,
4122 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
4123 .get_next_channel_announcements = get_next_channel_announcements_jcall,
4124 .get_next_node_announcements = get_next_node_announcements_jcall,
4125 .should_request_full_sync = should_request_full_sync_jcall,
4126 .free = LDKRoutingMessageHandler_JCalls_free,
4130 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
4131 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
4132 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
4133 return (long)res_ptr;
4135 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4136 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
4140 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4141 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4142 LDKNodeAnnouncement msg_conv;
4143 msg_conv.inner = (void*)(msg & (~1));
4144 msg_conv.is_owned = (msg & 1) || (msg == 0);
4145 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4146 *ret_conv = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
4147 return (long)ret_conv;
4150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4151 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4152 LDKChannelAnnouncement msg_conv;
4153 msg_conv.inner = (void*)(msg & (~1));
4154 msg_conv.is_owned = (msg & 1) || (msg == 0);
4155 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4156 *ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
4157 return (long)ret_conv;
4160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
4161 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4162 LDKChannelUpdate msg_conv;
4163 msg_conv.inner = (void*)(msg & (~1));
4164 msg_conv.is_owned = (msg & 1) || (msg == 0);
4165 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4166 *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
4167 return (long)ret_conv;
4170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
4171 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4172 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
4173 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
4176 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) {
4177 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4178 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
4179 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4180 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4181 for (size_t l = 0; l < ret_var.datalen; l++) {
4182 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* arr_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4183 *arr_conv_63_ref = ret_var.data[l];
4184 ret_arr_ptr[l] = (long)arr_conv_63_ref;
4186 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4187 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(ret_var);
4191 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) {
4192 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4193 LDKPublicKey starting_point_ref;
4194 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
4195 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
4196 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
4197 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
4198 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
4199 for (size_t s = 0; s < ret_var.datalen; s++) {
4200 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
4201 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4202 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4203 long arr_conv_18_ref = (long)arr_conv_18_var.inner;
4204 if (arr_conv_18_var.is_owned) {
4205 arr_conv_18_ref |= 1;
4207 ret_arr_ptr[s] = arr_conv_18_ref;
4209 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4214 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4215 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4216 LDKPublicKey node_id_ref;
4217 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4218 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4219 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4223 typedef struct LDKSocketDescriptor_JCalls {
4224 atomic_size_t refcnt;
4227 jmethodID send_data_meth;
4228 jmethodID disconnect_socket_meth;
4230 jmethodID hash_meth;
4231 } LDKSocketDescriptor_JCalls;
4232 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4233 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4235 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4236 LDKu8slice data_var = data;
4237 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4238 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4239 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4241 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4243 void disconnect_socket_jcall(void* this_arg) {
4244 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4246 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4247 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4249 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4251 bool eq_jcall(const void* this_arg, const void *other_arg) {
4252 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4254 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4255 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4257 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4259 uint64_t hash_jcall(const void* this_arg) {
4260 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4262 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4263 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4265 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4267 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4268 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4269 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4271 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4272 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4276 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4277 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4278 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4279 return (void*) this_arg;
4281 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4282 jclass c = (*env)->GetObjectClass(env, o);
4284 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4285 atomic_init(&calls->refcnt, 1);
4286 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4287 calls->o = (*env)->NewWeakGlobalRef(env, o);
4288 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4289 CHECK(calls->send_data_meth != NULL);
4290 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4291 CHECK(calls->disconnect_socket_meth != NULL);
4292 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4293 CHECK(calls->eq_meth != NULL);
4294 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4295 CHECK(calls->hash_meth != NULL);
4297 LDKSocketDescriptor ret = {
4298 .this_arg = (void*) calls,
4299 .send_data = send_data_jcall,
4300 .disconnect_socket = disconnect_socket_jcall,
4303 .clone = LDKSocketDescriptor_JCalls_clone,
4304 .free = LDKSocketDescriptor_JCalls_free,
4308 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4309 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4310 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4311 return (long)res_ptr;
4313 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4314 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4319 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4320 LDKu8slice data_ref;
4321 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4322 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4323 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4324 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4329 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4330 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4334 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4335 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4339 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4340 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4341 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4343 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4344 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4346 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4347 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4348 CHECK(val->result_ok);
4349 LDKCVecTempl_u8 res_var = (*val->contents.result);
4350 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4351 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4355 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4356 CHECK(!val->result_ok);
4357 LDKPeerHandleError err_var = (*val->contents.err);
4358 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4359 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4360 long err_ref = (long)err_var.inner & ~1;
4363 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4364 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4366 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4367 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4368 CHECK(val->result_ok);
4369 return *val->contents.result;
4371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4372 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4373 CHECK(!val->result_ok);
4374 LDKPeerHandleError err_var = (*val->contents.err);
4375 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4376 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4377 long err_ref = (long)err_var.inner & ~1;
4380 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4381 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4383 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4384 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4385 CHECK(val->result_ok);
4386 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4387 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4390 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4391 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4392 CHECK(!val->result_ok);
4393 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4396 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4397 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4399 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4400 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4401 CHECK(val->result_ok);
4402 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4403 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4406 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4407 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4408 CHECK(!val->result_ok);
4409 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4412 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4413 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4416 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4417 CHECK(val->result_ok);
4418 LDKTxCreationKeys res_var = (*val->contents.result);
4419 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4420 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4421 long res_ref = (long)res_var.inner & ~1;
4424 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4425 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4426 CHECK(!val->result_ok);
4427 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4430 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4431 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4432 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4435 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4436 ret->datalen = (*env)->GetArrayLength(env, elems);
4437 if (ret->datalen == 0) {
4440 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4441 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4442 for (size_t i = 0; i < ret->datalen; i++) {
4443 jlong arr_elem = java_elems[i];
4444 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4445 FREE((void*)arr_elem);
4446 ret->data[i] = arr_elem_conv;
4448 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4452 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4453 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4454 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4455 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4456 for (size_t i = 0; i < vec->datalen; i++) {
4457 CHECK((((long)vec->data[i].inner) & 1) == 0);
4458 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4460 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4464 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4465 ret->datalen = (*env)->GetArrayLength(env, elems);
4466 if (ret->datalen == 0) {
4469 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4470 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4471 for (size_t i = 0; i < ret->datalen; i++) {
4472 jlong arr_elem = java_elems[i];
4473 LDKRouteHop arr_elem_conv;
4474 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4475 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4476 if (arr_elem_conv.inner != NULL)
4477 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4478 ret->data[i] = arr_elem_conv;
4480 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4484 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4485 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4486 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4488 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4489 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4492 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4493 CHECK(val->result_ok);
4494 LDKRoute res_var = (*val->contents.result);
4495 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4496 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4497 long res_ref = (long)res_var.inner & ~1;
4500 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4501 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4502 CHECK(!val->result_ok);
4503 LDKLightningError err_var = (*val->contents.err);
4504 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4505 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4506 long err_ref = (long)err_var.inner & ~1;
4509 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4510 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4511 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4512 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4513 for (size_t i = 0; i < vec->datalen; i++) {
4514 CHECK((((long)vec->data[i].inner) & 1) == 0);
4515 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4517 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4521 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4522 ret->datalen = (*env)->GetArrayLength(env, elems);
4523 if (ret->datalen == 0) {
4526 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4527 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4528 for (size_t i = 0; i < ret->datalen; i++) {
4529 jlong arr_elem = java_elems[i];
4530 LDKRouteHint arr_elem_conv;
4531 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4532 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4533 if (arr_elem_conv.inner != NULL)
4534 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4535 ret->data[i] = arr_elem_conv;
4537 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4542 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4544 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4548 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4550 C2Tuple_OutPointScriptZ_free(arg_conv);
4553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4554 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4556 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4560 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4562 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4566 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4568 C2Tuple_u64u64Z_free(arg_conv);
4571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4572 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4574 C2Tuple_usizeTransactionZ_free(arg_conv);
4577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4578 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4580 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4584 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4586 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4589 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4590 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4592 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4593 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4594 return (long)ret_conv;
4597 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4598 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4600 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4604 LDKCVec_SignatureZ arg_constr;
4605 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4606 if (arg_constr.datalen > 0)
4607 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4609 arg_constr.data = NULL;
4610 for (size_t i = 0; i < arg_constr.datalen; i++) {
4611 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4612 LDKSignature arr_conv_8_ref;
4613 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4614 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4615 arg_constr.data[i] = arr_conv_8_ref;
4617 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4618 *ret_conv = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4619 return (long)ret_conv;
4622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4623 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4625 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4626 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4627 return (long)ret_conv;
4630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4631 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4633 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4637 LDKCVec_u8Z arg_ref;
4638 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4639 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4640 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4641 *ret_conv = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4642 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4643 return (long)ret_conv;
4646 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4647 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4649 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4650 *ret_conv = CResult_NoneAPIErrorZ_err(arg_conv);
4651 return (long)ret_conv;
4654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4655 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4657 CResult_NoneAPIErrorZ_free(arg_conv);
4660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4661 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4663 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4664 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4665 return (long)ret_conv;
4668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4669 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4671 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4675 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4677 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4678 *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4679 return (long)ret_conv;
4682 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4683 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4685 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4688 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4689 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4691 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4692 *ret_conv = CResult_NonePaymentSendFailureZ_err(arg_conv);
4693 return (long)ret_conv;
4696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4697 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4699 CResult_NonePaymentSendFailureZ_free(arg_conv);
4702 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4703 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4705 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4706 *ret_conv = CResult_NonePeerHandleErrorZ_err(arg_conv);
4707 return (long)ret_conv;
4710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4711 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4713 CResult_NonePeerHandleErrorZ_free(arg_conv);
4716 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4717 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4719 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4720 *ret_conv = CResult_PublicKeySecpErrorZ_err(arg_conv);
4721 return (long)ret_conv;
4724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4725 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4727 CResult_PublicKeySecpErrorZ_free(arg_conv);
4730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4731 LDKPublicKey arg_ref;
4732 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4733 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4734 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4735 *ret_conv = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4736 return (long)ret_conv;
4739 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4740 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4742 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4743 *ret_conv = CResult_RouteLightningErrorZ_err(arg_conv);
4744 return (long)ret_conv;
4747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4748 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4750 CResult_RouteLightningErrorZ_free(arg_conv);
4753 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4754 LDKRoute arg_conv = *(LDKRoute*)arg;
4756 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4757 *ret_conv = CResult_RouteLightningErrorZ_ok(arg_conv);
4758 return (long)ret_conv;
4761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4762 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4764 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4765 *ret_conv = CResult_SecretKeySecpErrorZ_err(arg_conv);
4766 return (long)ret_conv;
4769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4770 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4772 CResult_SecretKeySecpErrorZ_free(arg_conv);
4775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4776 LDKSecretKey arg_ref;
4777 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4778 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4779 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4780 *ret_conv = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4781 return (long)ret_conv;
4784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4785 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4787 CResult_SignatureNoneZ_free(arg_conv);
4790 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4791 LDKSignature arg_ref;
4792 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4793 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4794 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4795 *ret_conv = CResult_SignatureNoneZ_ok(arg_ref);
4796 return (long)ret_conv;
4799 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4800 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4802 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4803 *ret_conv = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4804 return (long)ret_conv;
4807 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4808 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4810 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4814 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4816 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4817 *ret_conv = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4818 return (long)ret_conv;
4821 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4822 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4824 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4825 *ret_conv = CResult_TxOutAccessErrorZ_err(arg_conv);
4826 return (long)ret_conv;
4829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4830 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4832 CResult_TxOutAccessErrorZ_free(arg_conv);
4835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4836 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4838 LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4839 *ret_conv = CResult_TxOutAccessErrorZ_ok(arg_conv);
4840 return (long)ret_conv;
4843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4844 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4846 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4847 *ret_conv = CResult_boolLightningErrorZ_err(arg_conv);
4848 return (long)ret_conv;
4851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4852 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4854 CResult_boolLightningErrorZ_free(arg_conv);
4857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4858 LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4859 *ret_conv = CResult_boolLightningErrorZ_ok(arg);
4860 return (long)ret_conv;
4863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4864 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4866 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4867 *ret_conv = CResult_boolPeerHandleErrorZ_err(arg_conv);
4868 return (long)ret_conv;
4871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4872 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4874 CResult_boolPeerHandleErrorZ_free(arg_conv);
4877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4878 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4879 *ret_conv = CResult_boolPeerHandleErrorZ_ok(arg);
4880 return (long)ret_conv;
4883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4884 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4885 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4886 if (arg_constr.datalen > 0)
4887 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4889 arg_constr.data = NULL;
4890 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4891 for (size_t q = 0; q < arg_constr.datalen; q++) {
4892 long arr_conv_42 = arg_vals[q];
4893 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4894 FREE((void*)arr_conv_42);
4895 arg_constr.data[q] = arr_conv_42_conv;
4897 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4898 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4901 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4902 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4903 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4904 if (arg_constr.datalen > 0)
4905 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4907 arg_constr.data = NULL;
4908 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4909 for (size_t b = 0; b < arg_constr.datalen; b++) {
4910 long arr_conv_27 = arg_vals[b];
4911 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4912 FREE((void*)arr_conv_27);
4913 arg_constr.data[b] = arr_conv_27_conv;
4915 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4916 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4919 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4920 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4921 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4922 if (arg_constr.datalen > 0)
4923 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4925 arg_constr.data = NULL;
4926 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4927 for (size_t d = 0; d < arg_constr.datalen; d++) {
4928 long arr_conv_29 = arg_vals[d];
4929 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4930 FREE((void*)arr_conv_29);
4931 arg_constr.data[d] = arr_conv_29_conv;
4933 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4934 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4938 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4939 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4940 if (arg_constr.datalen > 0)
4941 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4943 arg_constr.data = NULL;
4944 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4945 for (size_t l = 0; l < arg_constr.datalen; l++) {
4946 long arr_conv_63 = arg_vals[l];
4947 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4948 FREE((void*)arr_conv_63);
4949 arg_constr.data[l] = arr_conv_63_conv;
4951 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4952 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4955 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4956 LDKCVec_CVec_RouteHopZZ arg_constr;
4957 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4958 if (arg_constr.datalen > 0)
4959 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4961 arg_constr.data = NULL;
4962 for (size_t m = 0; m < arg_constr.datalen; m++) {
4963 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4964 LDKCVec_RouteHopZ arr_conv_12_constr;
4965 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4966 if (arr_conv_12_constr.datalen > 0)
4967 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4969 arr_conv_12_constr.data = NULL;
4970 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4971 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4972 long arr_conv_10 = arr_conv_12_vals[k];
4973 LDKRouteHop arr_conv_10_conv;
4974 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4975 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4976 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4978 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4979 arg_constr.data[m] = arr_conv_12_constr;
4981 CVec_CVec_RouteHopZZ_free(arg_constr);
4984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4985 LDKCVec_ChannelDetailsZ arg_constr;
4986 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4987 if (arg_constr.datalen > 0)
4988 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4990 arg_constr.data = NULL;
4991 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4992 for (size_t q = 0; q < arg_constr.datalen; q++) {
4993 long arr_conv_16 = arg_vals[q];
4994 LDKChannelDetails arr_conv_16_conv;
4995 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4996 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4997 arg_constr.data[q] = arr_conv_16_conv;
4999 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5000 CVec_ChannelDetailsZ_free(arg_constr);
5003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5004 LDKCVec_ChannelMonitorZ arg_constr;
5005 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5006 if (arg_constr.datalen > 0)
5007 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
5009 arg_constr.data = NULL;
5010 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5011 for (size_t q = 0; q < arg_constr.datalen; q++) {
5012 long arr_conv_16 = arg_vals[q];
5013 LDKChannelMonitor arr_conv_16_conv;
5014 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5015 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5016 arg_constr.data[q] = arr_conv_16_conv;
5018 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5019 CVec_ChannelMonitorZ_free(arg_constr);
5022 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5023 LDKCVec_EventZ arg_constr;
5024 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5025 if (arg_constr.datalen > 0)
5026 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
5028 arg_constr.data = NULL;
5029 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5030 for (size_t h = 0; h < arg_constr.datalen; h++) {
5031 long arr_conv_7 = arg_vals[h];
5032 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
5033 FREE((void*)arr_conv_7);
5034 arg_constr.data[h] = arr_conv_7_conv;
5036 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5037 CVec_EventZ_free(arg_constr);
5040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5041 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
5042 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5043 if (arg_constr.datalen > 0)
5044 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
5046 arg_constr.data = NULL;
5047 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5048 for (size_t y = 0; y < arg_constr.datalen; y++) {
5049 long arr_conv_24 = arg_vals[y];
5050 LDKHTLCOutputInCommitment arr_conv_24_conv;
5051 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
5052 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
5053 arg_constr.data[y] = arr_conv_24_conv;
5055 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5056 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
5059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5060 LDKCVec_MessageSendEventZ arg_constr;
5061 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5062 if (arg_constr.datalen > 0)
5063 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
5065 arg_constr.data = NULL;
5066 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5067 for (size_t s = 0; s < arg_constr.datalen; s++) {
5068 long arr_conv_18 = arg_vals[s];
5069 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
5070 FREE((void*)arr_conv_18);
5071 arg_constr.data[s] = arr_conv_18_conv;
5073 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5074 CVec_MessageSendEventZ_free(arg_constr);
5077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5078 LDKCVec_MonitorEventZ arg_constr;
5079 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5080 if (arg_constr.datalen > 0)
5081 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
5083 arg_constr.data = NULL;
5084 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5085 for (size_t o = 0; o < arg_constr.datalen; o++) {
5086 long arr_conv_14 = arg_vals[o];
5087 LDKMonitorEvent arr_conv_14_conv;
5088 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
5089 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
5090 arg_constr.data[o] = arr_conv_14_conv;
5092 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5093 CVec_MonitorEventZ_free(arg_constr);
5096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5097 LDKCVec_NetAddressZ arg_constr;
5098 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5099 if (arg_constr.datalen > 0)
5100 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
5102 arg_constr.data = NULL;
5103 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5104 for (size_t m = 0; m < arg_constr.datalen; m++) {
5105 long arr_conv_12 = arg_vals[m];
5106 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
5107 FREE((void*)arr_conv_12);
5108 arg_constr.data[m] = arr_conv_12_conv;
5110 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5111 CVec_NetAddressZ_free(arg_constr);
5114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5115 LDKCVec_NodeAnnouncementZ arg_constr;
5116 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5117 if (arg_constr.datalen > 0)
5118 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
5120 arg_constr.data = NULL;
5121 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5122 for (size_t s = 0; s < arg_constr.datalen; s++) {
5123 long arr_conv_18 = arg_vals[s];
5124 LDKNodeAnnouncement arr_conv_18_conv;
5125 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
5126 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
5127 arg_constr.data[s] = arr_conv_18_conv;
5129 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5130 CVec_NodeAnnouncementZ_free(arg_constr);
5133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5134 LDKCVec_PublicKeyZ arg_constr;
5135 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5136 if (arg_constr.datalen > 0)
5137 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
5139 arg_constr.data = NULL;
5140 for (size_t i = 0; i < arg_constr.datalen; i++) {
5141 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5142 LDKPublicKey arr_conv_8_ref;
5143 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
5144 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
5145 arg_constr.data[i] = arr_conv_8_ref;
5147 CVec_PublicKeyZ_free(arg_constr);
5150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5151 LDKCVec_RouteHintZ arg_constr;
5152 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5153 if (arg_constr.datalen > 0)
5154 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
5156 arg_constr.data = NULL;
5157 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5158 for (size_t l = 0; l < arg_constr.datalen; l++) {
5159 long arr_conv_11 = arg_vals[l];
5160 LDKRouteHint arr_conv_11_conv;
5161 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
5162 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
5163 arg_constr.data[l] = arr_conv_11_conv;
5165 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5166 CVec_RouteHintZ_free(arg_constr);
5169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5170 LDKCVec_RouteHopZ arg_constr;
5171 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5172 if (arg_constr.datalen > 0)
5173 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
5175 arg_constr.data = NULL;
5176 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5177 for (size_t k = 0; k < arg_constr.datalen; k++) {
5178 long arr_conv_10 = arg_vals[k];
5179 LDKRouteHop arr_conv_10_conv;
5180 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
5181 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5182 arg_constr.data[k] = arr_conv_10_conv;
5184 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5185 CVec_RouteHopZ_free(arg_constr);
5188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5189 LDKCVec_SignatureZ arg_constr;
5190 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5191 if (arg_constr.datalen > 0)
5192 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5194 arg_constr.data = NULL;
5195 for (size_t i = 0; i < arg_constr.datalen; i++) {
5196 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5197 LDKSignature arr_conv_8_ref;
5198 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5199 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5200 arg_constr.data[i] = arr_conv_8_ref;
5202 CVec_SignatureZ_free(arg_constr);
5205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5206 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5207 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5208 if (arg_constr.datalen > 0)
5209 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5211 arg_constr.data = NULL;
5212 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5213 for (size_t b = 0; b < arg_constr.datalen; b++) {
5214 long arr_conv_27 = arg_vals[b];
5215 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5216 FREE((void*)arr_conv_27);
5217 arg_constr.data[b] = arr_conv_27_conv;
5219 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5220 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5224 LDKCVec_TransactionZ arg_constr;
5225 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5226 if (arg_constr.datalen > 0)
5227 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5229 arg_constr.data = NULL;
5230 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5231 for (size_t n = 0; n < arg_constr.datalen; n++) {
5232 long arr_conv_13 = arg_vals[n];
5233 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
5234 arg_constr.data[n] = arr_conv_13_conv;
5236 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5237 CVec_TransactionZ_free(arg_constr);
5240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5241 LDKCVec_TxOutZ arg_constr;
5242 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5243 if (arg_constr.datalen > 0)
5244 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5246 arg_constr.data = NULL;
5247 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5248 for (size_t h = 0; h < arg_constr.datalen; h++) {
5249 long arr_conv_7 = arg_vals[h];
5250 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5251 FREE((void*)arr_conv_7);
5252 arg_constr.data[h] = arr_conv_7_conv;
5254 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5255 CVec_TxOutZ_free(arg_constr);
5258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5259 LDKCVec_UpdateAddHTLCZ arg_constr;
5260 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5261 if (arg_constr.datalen > 0)
5262 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5264 arg_constr.data = NULL;
5265 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5266 for (size_t p = 0; p < arg_constr.datalen; p++) {
5267 long arr_conv_15 = arg_vals[p];
5268 LDKUpdateAddHTLC arr_conv_15_conv;
5269 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5270 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5271 arg_constr.data[p] = arr_conv_15_conv;
5273 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5274 CVec_UpdateAddHTLCZ_free(arg_constr);
5277 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5278 LDKCVec_UpdateFailHTLCZ arg_constr;
5279 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5280 if (arg_constr.datalen > 0)
5281 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5283 arg_constr.data = NULL;
5284 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5285 for (size_t q = 0; q < arg_constr.datalen; q++) {
5286 long arr_conv_16 = arg_vals[q];
5287 LDKUpdateFailHTLC arr_conv_16_conv;
5288 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5289 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5290 arg_constr.data[q] = arr_conv_16_conv;
5292 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5293 CVec_UpdateFailHTLCZ_free(arg_constr);
5296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5297 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5298 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5299 if (arg_constr.datalen > 0)
5300 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5302 arg_constr.data = NULL;
5303 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5304 for (size_t z = 0; z < arg_constr.datalen; z++) {
5305 long arr_conv_25 = arg_vals[z];
5306 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5307 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5308 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5309 arg_constr.data[z] = arr_conv_25_conv;
5311 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5312 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5316 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5317 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5318 if (arg_constr.datalen > 0)
5319 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5321 arg_constr.data = NULL;
5322 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5323 for (size_t t = 0; t < arg_constr.datalen; t++) {
5324 long arr_conv_19 = arg_vals[t];
5325 LDKUpdateFulfillHTLC arr_conv_19_conv;
5326 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5327 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5328 arg_constr.data[t] = arr_conv_19_conv;
5330 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5331 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5335 LDKCVec_u64Z arg_constr;
5336 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5337 if (arg_constr.datalen > 0)
5338 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5340 arg_constr.data = NULL;
5341 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5342 for (size_t g = 0; g < arg_constr.datalen; g++) {
5343 long arr_conv_6 = arg_vals[g];
5344 arg_constr.data[g] = arr_conv_6;
5346 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5347 CVec_u64Z_free(arg_constr);
5350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5351 LDKCVec_u8Z arg_ref;
5352 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5353 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5354 CVec_u8Z_free(arg_ref);
5355 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5359 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5360 Transaction_free(_res_conv);
5363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5364 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5366 TxOut_free(_res_conv);
5369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5370 LDKTransaction b_conv = *(LDKTransaction*)b;
5371 LDKC2Tuple_usizeTransactionZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5372 *ret_ref = C2Tuple_usizeTransactionZ_new(a, b_conv);
5373 return (long)ret_ref;
5376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5377 LDKCResult_NoneChannelMonitorUpdateErrZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5378 *ret_conv = CResult_NoneChannelMonitorUpdateErrZ_ok();
5379 return (long)ret_conv;
5382 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5383 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5384 *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok();
5385 return (long)ret_conv;
5388 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5390 a_conv.inner = (void*)(a & (~1));
5391 a_conv.is_owned = (a & 1) || (a == 0);
5392 if (a_conv.inner != NULL)
5393 a_conv = OutPoint_clone(&a_conv);
5395 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5396 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5397 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5398 *ret_ref = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5399 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5400 return (long)ret_ref;
5403 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5404 LDKThirtyTwoBytes a_ref;
5405 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5406 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5407 LDKCVec_TxOutZ b_constr;
5408 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5409 if (b_constr.datalen > 0)
5410 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5412 b_constr.data = NULL;
5413 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5414 for (size_t h = 0; h < b_constr.datalen; h++) {
5415 long arr_conv_7 = b_vals[h];
5416 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5417 FREE((void*)arr_conv_7);
5418 b_constr.data[h] = arr_conv_7_conv;
5420 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5421 LDKC2Tuple_TxidCVec_TxOutZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5422 *ret_ref = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5423 return (long)ret_ref;
5426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5427 LDKC2Tuple_u64u64Z* ret_ref = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5428 *ret_ref = C2Tuple_u64u64Z_new(a, b);
5429 return (long)ret_ref;
5432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5434 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5435 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5436 LDKCVec_SignatureZ b_constr;
5437 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5438 if (b_constr.datalen > 0)
5439 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5441 b_constr.data = NULL;
5442 for (size_t i = 0; i < b_constr.datalen; i++) {
5443 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5444 LDKSignature arr_conv_8_ref;
5445 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5446 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5447 b_constr.data[i] = arr_conv_8_ref;
5449 LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5450 *ret_ref = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5451 return (long)ret_ref;
5454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5455 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5456 *ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5457 return (long)ret_conv;
5460 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5461 LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5462 *ret_conv = CResult_SignatureNoneZ_err();
5463 return (long)ret_conv;
5466 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5467 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5468 *ret_conv = CResult_CVec_SignatureZNoneZ_err();
5469 return (long)ret_conv;
5472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5473 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5474 *ret_conv = CResult_NoneAPIErrorZ_ok();
5475 return (long)ret_conv;
5478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5479 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5480 *ret_conv = CResult_NonePaymentSendFailureZ_ok();
5481 return (long)ret_conv;
5484 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5485 LDKChannelAnnouncement a_conv;
5486 a_conv.inner = (void*)(a & (~1));
5487 a_conv.is_owned = (a & 1) || (a == 0);
5488 if (a_conv.inner != NULL)
5489 a_conv = ChannelAnnouncement_clone(&a_conv);
5490 LDKChannelUpdate b_conv;
5491 b_conv.inner = (void*)(b & (~1));
5492 b_conv.is_owned = (b & 1) || (b == 0);
5493 if (b_conv.inner != NULL)
5494 b_conv = ChannelUpdate_clone(&b_conv);
5495 LDKChannelUpdate c_conv;
5496 c_conv.inner = (void*)(c & (~1));
5497 c_conv.is_owned = (c & 1) || (c == 0);
5498 if (c_conv.inner != NULL)
5499 c_conv = ChannelUpdate_clone(&c_conv);
5500 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5501 *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5502 return (long)ret_ref;
5505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5506 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5507 *ret_conv = CResult_NonePeerHandleErrorZ_ok();
5508 return (long)ret_conv;
5511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5512 LDKHTLCOutputInCommitment a_conv;
5513 a_conv.inner = (void*)(a & (~1));
5514 a_conv.is_owned = (a & 1) || (a == 0);
5515 if (a_conv.inner != NULL)
5516 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5518 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5519 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5520 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5521 *ret_ref = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5522 return (long)ret_ref;
5525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5526 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5527 FREE((void*)this_ptr);
5528 Event_free(this_ptr_conv);
5531 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5532 LDKEvent* orig_conv = (LDKEvent*)orig;
5533 LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
5534 *ret_copy = Event_clone(orig_conv);
5535 long ret_ref = (long)ret_copy;
5539 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5540 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5541 FREE((void*)this_ptr);
5542 MessageSendEvent_free(this_ptr_conv);
5545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5546 LDKMessageSendEvent* orig_conv = (LDKMessageSendEvent*)orig;
5547 LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
5548 *ret_copy = MessageSendEvent_clone(orig_conv);
5549 long ret_ref = (long)ret_copy;
5553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5554 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5555 FREE((void*)this_ptr);
5556 MessageSendEventsProvider_free(this_ptr_conv);
5559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5560 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5561 FREE((void*)this_ptr);
5562 EventsProvider_free(this_ptr_conv);
5565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5566 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5567 FREE((void*)this_ptr);
5568 APIError_free(this_ptr_conv);
5571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_APIError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5572 LDKAPIError* orig_conv = (LDKAPIError*)orig;
5573 LDKAPIError *ret_copy = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
5574 *ret_copy = APIError_clone(orig_conv);
5575 long ret_ref = (long)ret_copy;
5579 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5580 LDKLevel* orig_conv = (LDKLevel*)orig;
5581 jclass ret_conv = LDKLevel_to_java(_env, Level_clone(orig_conv));
5585 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5586 jclass ret_conv = LDKLevel_to_java(_env, Level_max());
5590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5591 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5592 FREE((void*)this_ptr);
5593 Logger_free(this_ptr_conv);
5596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5597 LDKChannelHandshakeConfig this_ptr_conv;
5598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5600 ChannelHandshakeConfig_free(this_ptr_conv);
5603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5604 LDKChannelHandshakeConfig orig_conv;
5605 orig_conv.inner = (void*)(orig & (~1));
5606 orig_conv.is_owned = (orig & 1) || (orig == 0);
5607 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_clone(&orig_conv);
5608 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5609 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5610 long ret_ref = (long)ret_var.inner;
5611 if (ret_var.is_owned) {
5617 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5618 LDKChannelHandshakeConfig this_ptr_conv;
5619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5620 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5621 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5626 LDKChannelHandshakeConfig this_ptr_conv;
5627 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5628 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5629 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5632 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5633 LDKChannelHandshakeConfig this_ptr_conv;
5634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5636 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5640 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5641 LDKChannelHandshakeConfig this_ptr_conv;
5642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5644 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5648 LDKChannelHandshakeConfig this_ptr_conv;
5649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5651 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5656 LDKChannelHandshakeConfig this_ptr_conv;
5657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5659 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5662 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) {
5663 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5664 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5665 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5666 long ret_ref = (long)ret_var.inner;
5667 if (ret_var.is_owned) {
5673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5674 LDKChannelHandshakeConfig ret_var = ChannelHandshakeConfig_default();
5675 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5676 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5677 long ret_ref = (long)ret_var.inner;
5678 if (ret_var.is_owned) {
5684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5685 LDKChannelHandshakeLimits this_ptr_conv;
5686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5688 ChannelHandshakeLimits_free(this_ptr_conv);
5691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5692 LDKChannelHandshakeLimits orig_conv;
5693 orig_conv.inner = (void*)(orig & (~1));
5694 orig_conv.is_owned = (orig & 1) || (orig == 0);
5695 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_clone(&orig_conv);
5696 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5697 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5698 long ret_ref = (long)ret_var.inner;
5699 if (ret_var.is_owned) {
5705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5706 LDKChannelHandshakeLimits this_ptr_conv;
5707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5709 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5713 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5714 LDKChannelHandshakeLimits this_ptr_conv;
5715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5717 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5720 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5721 LDKChannelHandshakeLimits this_ptr_conv;
5722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5724 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5729 LDKChannelHandshakeLimits this_ptr_conv;
5730 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5731 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5732 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5736 LDKChannelHandshakeLimits this_ptr_conv;
5737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5739 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5743 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) {
5744 LDKChannelHandshakeLimits this_ptr_conv;
5745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5747 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5751 LDKChannelHandshakeLimits this_ptr_conv;
5752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5753 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5754 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5759 LDKChannelHandshakeLimits this_ptr_conv;
5760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5762 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5765 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5766 LDKChannelHandshakeLimits this_ptr_conv;
5767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5769 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5774 LDKChannelHandshakeLimits this_ptr_conv;
5775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5777 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5781 LDKChannelHandshakeLimits this_ptr_conv;
5782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5784 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5789 LDKChannelHandshakeLimits this_ptr_conv;
5790 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5791 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5792 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5796 LDKChannelHandshakeLimits this_ptr_conv;
5797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5799 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5804 LDKChannelHandshakeLimits this_ptr_conv;
5805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5807 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5810 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5811 LDKChannelHandshakeLimits this_ptr_conv;
5812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5814 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5819 LDKChannelHandshakeLimits this_ptr_conv;
5820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5822 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5825 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5826 LDKChannelHandshakeLimits this_ptr_conv;
5827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5829 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5834 LDKChannelHandshakeLimits this_ptr_conv;
5835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5837 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5840 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5841 LDKChannelHandshakeLimits this_ptr_conv;
5842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5844 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5849 LDKChannelHandshakeLimits this_ptr_conv;
5850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5852 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5855 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) {
5856 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);
5857 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5858 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5859 long ret_ref = (long)ret_var.inner;
5860 if (ret_var.is_owned) {
5866 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5867 LDKChannelHandshakeLimits ret_var = ChannelHandshakeLimits_default();
5868 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5869 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5870 long ret_ref = (long)ret_var.inner;
5871 if (ret_var.is_owned) {
5877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5878 LDKChannelConfig this_ptr_conv;
5879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5881 ChannelConfig_free(this_ptr_conv);
5884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5885 LDKChannelConfig orig_conv;
5886 orig_conv.inner = (void*)(orig & (~1));
5887 orig_conv.is_owned = (orig & 1) || (orig == 0);
5888 LDKChannelConfig ret_var = ChannelConfig_clone(&orig_conv);
5889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5891 long ret_ref = (long)ret_var.inner;
5892 if (ret_var.is_owned) {
5898 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5899 LDKChannelConfig this_ptr_conv;
5900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5902 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5907 LDKChannelConfig this_ptr_conv;
5908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5909 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5910 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5913 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5914 LDKChannelConfig this_ptr_conv;
5915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5917 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5922 LDKChannelConfig this_ptr_conv;
5923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5925 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5928 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5929 LDKChannelConfig this_ptr_conv;
5930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5931 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5932 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5937 LDKChannelConfig this_ptr_conv;
5938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5940 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5943 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) {
5944 LDKChannelConfig ret_var = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5945 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5946 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5947 long ret_ref = (long)ret_var.inner;
5948 if (ret_var.is_owned) {
5954 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5955 LDKChannelConfig ret_var = ChannelConfig_default();
5956 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5957 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5958 long ret_ref = (long)ret_var.inner;
5959 if (ret_var.is_owned) {
5965 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5966 LDKChannelConfig obj_conv;
5967 obj_conv.inner = (void*)(obj & (~1));
5968 obj_conv.is_owned = (obj & 1) || (obj == 0);
5969 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5970 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5971 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5972 CVec_u8Z_free(arg_var);
5976 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5978 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5979 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5980 LDKChannelConfig ret_var = ChannelConfig_read(ser_ref);
5981 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
5982 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
5983 long ret_ref = (long)ret_var.inner;
5984 if (ret_var.is_owned) {
5987 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5992 LDKUserConfig this_ptr_conv;
5993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5995 UserConfig_free(this_ptr_conv);
5998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5999 LDKUserConfig orig_conv;
6000 orig_conv.inner = (void*)(orig & (~1));
6001 orig_conv.is_owned = (orig & 1) || (orig == 0);
6002 LDKUserConfig ret_var = UserConfig_clone(&orig_conv);
6003 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6004 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6005 long ret_ref = (long)ret_var.inner;
6006 if (ret_var.is_owned) {
6012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6013 LDKUserConfig this_ptr_conv;
6014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6016 LDKChannelHandshakeConfig ret_var = UserConfig_get_own_channel_config(&this_ptr_conv);
6017 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6018 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6019 long ret_ref = (long)ret_var.inner;
6020 if (ret_var.is_owned) {
6026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6027 LDKUserConfig this_ptr_conv;
6028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6030 LDKChannelHandshakeConfig val_conv;
6031 val_conv.inner = (void*)(val & (~1));
6032 val_conv.is_owned = (val & 1) || (val == 0);
6033 if (val_conv.inner != NULL)
6034 val_conv = ChannelHandshakeConfig_clone(&val_conv);
6035 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
6038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
6039 LDKUserConfig this_ptr_conv;
6040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6042 LDKChannelHandshakeLimits ret_var = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
6043 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6044 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6045 long ret_ref = (long)ret_var.inner;
6046 if (ret_var.is_owned) {
6052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6053 LDKUserConfig this_ptr_conv;
6054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6056 LDKChannelHandshakeLimits val_conv;
6057 val_conv.inner = (void*)(val & (~1));
6058 val_conv.is_owned = (val & 1) || (val == 0);
6059 if (val_conv.inner != NULL)
6060 val_conv = ChannelHandshakeLimits_clone(&val_conv);
6061 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
6064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
6065 LDKUserConfig this_ptr_conv;
6066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6068 LDKChannelConfig ret_var = UserConfig_get_channel_options(&this_ptr_conv);
6069 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6070 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6071 long ret_ref = (long)ret_var.inner;
6072 if (ret_var.is_owned) {
6078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6079 LDKUserConfig this_ptr_conv;
6080 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6081 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6082 LDKChannelConfig val_conv;
6083 val_conv.inner = (void*)(val & (~1));
6084 val_conv.is_owned = (val & 1) || (val == 0);
6085 if (val_conv.inner != NULL)
6086 val_conv = ChannelConfig_clone(&val_conv);
6087 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
6090 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) {
6091 LDKChannelHandshakeConfig own_channel_config_arg_conv;
6092 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
6093 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
6094 if (own_channel_config_arg_conv.inner != NULL)
6095 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
6096 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
6097 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
6098 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
6099 if (peer_channel_config_limits_arg_conv.inner != NULL)
6100 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
6101 LDKChannelConfig channel_options_arg_conv;
6102 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
6103 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
6104 if (channel_options_arg_conv.inner != NULL)
6105 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
6106 LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
6107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6109 long ret_ref = (long)ret_var.inner;
6110 if (ret_var.is_owned) {
6116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
6117 LDKUserConfig ret_var = UserConfig_default();
6118 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6119 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6120 long ret_ref = (long)ret_var.inner;
6121 if (ret_var.is_owned) {
6127 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_AccessError_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6128 LDKAccessError* orig_conv = (LDKAccessError*)orig;
6129 jclass ret_conv = LDKAccessError_to_java(_env, AccessError_clone(orig_conv));
6133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6134 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
6135 FREE((void*)this_ptr);
6136 Access_free(this_ptr_conv);
6139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6140 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
6141 FREE((void*)this_ptr);
6142 Watch_free(this_ptr_conv);
6145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6146 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
6147 FREE((void*)this_ptr);
6148 Filter_free(this_ptr_conv);
6151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6152 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
6153 FREE((void*)this_ptr);
6154 BroadcasterInterface_free(this_ptr_conv);
6157 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ConfirmationTarget_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6158 LDKConfirmationTarget* orig_conv = (LDKConfirmationTarget*)orig;
6159 jclass ret_conv = LDKConfirmationTarget_to_java(_env, ConfirmationTarget_clone(orig_conv));
6163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6164 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
6165 FREE((void*)this_ptr);
6166 FeeEstimator_free(this_ptr_conv);
6169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6170 LDKChainMonitor this_ptr_conv;
6171 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6172 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6173 ChainMonitor_free(this_ptr_conv);
6176 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6177 LDKChainMonitor this_arg_conv;
6178 this_arg_conv.inner = (void*)(this_arg & (~1));
6179 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6180 unsigned char header_arr[80];
6181 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6182 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6183 unsigned char (*header_ref)[80] = &header_arr;
6184 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6185 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6186 if (txdata_constr.datalen > 0)
6187 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6189 txdata_constr.data = NULL;
6190 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6191 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6192 long arr_conv_29 = txdata_vals[d];
6193 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6194 FREE((void*)arr_conv_29);
6195 txdata_constr.data[d] = arr_conv_29_conv;
6197 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6198 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
6201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
6202 LDKChainMonitor this_arg_conv;
6203 this_arg_conv.inner = (void*)(this_arg & (~1));
6204 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6205 unsigned char header_arr[80];
6206 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6207 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6208 unsigned char (*header_ref)[80] = &header_arr;
6209 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
6212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
6213 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
6214 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6215 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6216 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6217 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6219 LDKLogger logger_conv = *(LDKLogger*)logger;
6220 if (logger_conv.free == LDKLogger_JCalls_free) {
6221 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6222 LDKLogger_JCalls_clone(logger_conv.this_arg);
6224 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
6225 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
6226 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6227 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
6229 LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
6230 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6231 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6232 long ret_ref = (long)ret_var.inner;
6233 if (ret_var.is_owned) {
6239 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
6240 LDKChainMonitor this_arg_conv;
6241 this_arg_conv.inner = (void*)(this_arg & (~1));
6242 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6243 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
6244 *ret = ChainMonitor_as_Watch(&this_arg_conv);
6248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6249 LDKChainMonitor this_arg_conv;
6250 this_arg_conv.inner = (void*)(this_arg & (~1));
6251 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6252 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6253 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
6257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6258 LDKChannelMonitorUpdate this_ptr_conv;
6259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6261 ChannelMonitorUpdate_free(this_ptr_conv);
6264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6265 LDKChannelMonitorUpdate orig_conv;
6266 orig_conv.inner = (void*)(orig & (~1));
6267 orig_conv.is_owned = (orig & 1) || (orig == 0);
6268 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_clone(&orig_conv);
6269 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6270 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6271 long ret_ref = (long)ret_var.inner;
6272 if (ret_var.is_owned) {
6278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6279 LDKChannelMonitorUpdate this_ptr_conv;
6280 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6281 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6282 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
6286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6287 LDKChannelMonitorUpdate this_ptr_conv;
6288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6290 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
6293 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6294 LDKChannelMonitorUpdate obj_conv;
6295 obj_conv.inner = (void*)(obj & (~1));
6296 obj_conv.is_owned = (obj & 1) || (obj == 0);
6297 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
6298 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6299 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6300 CVec_u8Z_free(arg_var);
6304 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6306 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6307 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6308 LDKChannelMonitorUpdate ret_var = ChannelMonitorUpdate_read(ser_ref);
6309 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6310 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6311 long ret_ref = (long)ret_var.inner;
6312 if (ret_var.is_owned) {
6315 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6319 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdateErr_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6320 LDKChannelMonitorUpdateErr* orig_conv = (LDKChannelMonitorUpdateErr*)orig;
6321 jclass ret_conv = LDKChannelMonitorUpdateErr_to_java(_env, ChannelMonitorUpdateErr_clone(orig_conv));
6325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6326 LDKMonitorUpdateError this_ptr_conv;
6327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6329 MonitorUpdateError_free(this_ptr_conv);
6332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6333 LDKMonitorEvent this_ptr_conv;
6334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6336 MonitorEvent_free(this_ptr_conv);
6339 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6340 LDKMonitorEvent orig_conv;
6341 orig_conv.inner = (void*)(orig & (~1));
6342 orig_conv.is_owned = (orig & 1) || (orig == 0);
6343 LDKMonitorEvent ret_var = MonitorEvent_clone(&orig_conv);
6344 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6345 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6346 long ret_ref = (long)ret_var.inner;
6347 if (ret_var.is_owned) {
6353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6354 LDKHTLCUpdate this_ptr_conv;
6355 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6356 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6357 HTLCUpdate_free(this_ptr_conv);
6360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6361 LDKHTLCUpdate orig_conv;
6362 orig_conv.inner = (void*)(orig & (~1));
6363 orig_conv.is_owned = (orig & 1) || (orig == 0);
6364 LDKHTLCUpdate ret_var = HTLCUpdate_clone(&orig_conv);
6365 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6366 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6367 long ret_ref = (long)ret_var.inner;
6368 if (ret_var.is_owned) {
6374 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6375 LDKHTLCUpdate obj_conv;
6376 obj_conv.inner = (void*)(obj & (~1));
6377 obj_conv.is_owned = (obj & 1) || (obj == 0);
6378 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6379 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6380 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6381 CVec_u8Z_free(arg_var);
6385 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6387 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6388 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6389 LDKHTLCUpdate ret_var = HTLCUpdate_read(ser_ref);
6390 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6391 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6392 long ret_ref = (long)ret_var.inner;
6393 if (ret_var.is_owned) {
6396 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6401 LDKChannelMonitor this_ptr_conv;
6402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6404 ChannelMonitor_free(this_ptr_conv);
6407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6408 LDKChannelMonitor this_arg_conv;
6409 this_arg_conv.inner = (void*)(this_arg & (~1));
6410 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6411 LDKChannelMonitorUpdate updates_conv;
6412 updates_conv.inner = (void*)(updates & (~1));
6413 updates_conv.is_owned = (updates & 1) || (updates == 0);
6414 if (updates_conv.inner != NULL)
6415 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6416 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6417 LDKLogger* logger_conv = (LDKLogger*)logger;
6418 LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6419 *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6420 return (long)ret_conv;
6423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6424 LDKChannelMonitor this_arg_conv;
6425 this_arg_conv.inner = (void*)(this_arg & (~1));
6426 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6427 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6432 LDKChannelMonitor this_arg_conv;
6433 this_arg_conv.inner = (void*)(this_arg & (~1));
6434 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6435 LDKC2Tuple_OutPointScriptZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6436 *ret_ref = ChannelMonitor_get_funding_txo(&this_arg_conv);
6437 return (long)ret_ref;
6440 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6441 LDKChannelMonitor this_arg_conv;
6442 this_arg_conv.inner = (void*)(this_arg & (~1));
6443 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6444 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6445 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6446 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6447 for (size_t o = 0; o < ret_var.datalen; o++) {
6448 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6449 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6450 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6451 long arr_conv_14_ref = (long)arr_conv_14_var.inner;
6452 if (arr_conv_14_var.is_owned) {
6453 arr_conv_14_ref |= 1;
6455 ret_arr_ptr[o] = arr_conv_14_ref;
6457 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6462 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6463 LDKChannelMonitor this_arg_conv;
6464 this_arg_conv.inner = (void*)(this_arg & (~1));
6465 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6466 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6467 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6468 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6469 for (size_t h = 0; h < ret_var.datalen; h++) {
6470 LDKEvent *arr_conv_7_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
6471 *arr_conv_7_copy = Event_clone(&ret_var.data[h]);
6472 long arr_conv_7_ref = (long)arr_conv_7_copy;
6473 ret_arr_ptr[h] = arr_conv_7_ref;
6475 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6476 CVec_EventZ_free(ret_var);
6480 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6481 LDKChannelMonitor this_arg_conv;
6482 this_arg_conv.inner = (void*)(this_arg & (~1));
6483 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6484 LDKLogger* logger_conv = (LDKLogger*)logger;
6485 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6486 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6487 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6488 for (size_t n = 0; n < ret_var.datalen; n++) {
6489 LDKTransaction *arr_conv_13_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
6490 *arr_conv_13_copy = ret_var.data[n];
6491 long arr_conv_13_ref = (long)arr_conv_13_copy;
6492 ret_arr_ptr[n] = arr_conv_13_ref;
6494 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6495 CVec_TransactionZ_free(ret_var);
6499 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) {
6500 LDKChannelMonitor this_arg_conv;
6501 this_arg_conv.inner = (void*)(this_arg & (~1));
6502 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6503 unsigned char header_arr[80];
6504 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6505 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6506 unsigned char (*header_ref)[80] = &header_arr;
6507 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6508 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6509 if (txdata_constr.datalen > 0)
6510 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6512 txdata_constr.data = NULL;
6513 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6514 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6515 long arr_conv_29 = txdata_vals[d];
6516 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6517 FREE((void*)arr_conv_29);
6518 txdata_constr.data[d] = arr_conv_29_conv;
6520 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6521 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6522 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6523 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6524 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6526 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6527 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6528 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6529 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6531 LDKLogger logger_conv = *(LDKLogger*)logger;
6532 if (logger_conv.free == LDKLogger_JCalls_free) {
6533 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6534 LDKLogger_JCalls_clone(logger_conv.this_arg);
6536 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6537 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6538 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6539 for (size_t b = 0; b < ret_var.datalen; b++) {
6540 LDKC2Tuple_TxidCVec_TxOutZZ* arr_conv_27_ref = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
6541 *arr_conv_27_ref = ret_var.data[b];
6542 ret_arr_ptr[b] = (long)arr_conv_27_ref;
6544 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6545 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(ret_var);
6549 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) {
6550 LDKChannelMonitor this_arg_conv;
6551 this_arg_conv.inner = (void*)(this_arg & (~1));
6552 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6553 unsigned char header_arr[80];
6554 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6555 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6556 unsigned char (*header_ref)[80] = &header_arr;
6557 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6558 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6559 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6560 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6562 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6563 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6564 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6565 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6567 LDKLogger logger_conv = *(LDKLogger*)logger;
6568 if (logger_conv.free == LDKLogger_JCalls_free) {
6569 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6570 LDKLogger_JCalls_clone(logger_conv.this_arg);
6572 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6576 LDKOutPoint this_ptr_conv;
6577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6579 OutPoint_free(this_ptr_conv);
6582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6583 LDKOutPoint orig_conv;
6584 orig_conv.inner = (void*)(orig & (~1));
6585 orig_conv.is_owned = (orig & 1) || (orig == 0);
6586 LDKOutPoint ret_var = OutPoint_clone(&orig_conv);
6587 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6588 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6589 long ret_ref = (long)ret_var.inner;
6590 if (ret_var.is_owned) {
6596 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6597 LDKOutPoint this_ptr_conv;
6598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6600 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6601 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6606 LDKOutPoint this_ptr_conv;
6607 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6608 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6609 LDKThirtyTwoBytes val_ref;
6610 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6611 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6612 OutPoint_set_txid(&this_ptr_conv, val_ref);
6615 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6616 LDKOutPoint this_ptr_conv;
6617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6619 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6624 LDKOutPoint this_ptr_conv;
6625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6627 OutPoint_set_index(&this_ptr_conv, val);
6630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6631 LDKThirtyTwoBytes txid_arg_ref;
6632 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6633 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6634 LDKOutPoint ret_var = OutPoint_new(txid_arg_ref, index_arg);
6635 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6636 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6637 long ret_ref = (long)ret_var.inner;
6638 if (ret_var.is_owned) {
6644 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6645 LDKOutPoint this_arg_conv;
6646 this_arg_conv.inner = (void*)(this_arg & (~1));
6647 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6648 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6649 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6653 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6654 LDKOutPoint obj_conv;
6655 obj_conv.inner = (void*)(obj & (~1));
6656 obj_conv.is_owned = (obj & 1) || (obj == 0);
6657 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6658 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6659 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6660 CVec_u8Z_free(arg_var);
6664 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6666 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6667 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6668 LDKOutPoint ret_var = OutPoint_read(ser_ref);
6669 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6670 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6671 long ret_ref = (long)ret_var.inner;
6672 if (ret_var.is_owned) {
6675 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6680 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6681 FREE((void*)this_ptr);
6682 SpendableOutputDescriptor_free(this_ptr_conv);
6685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6686 LDKSpendableOutputDescriptor* orig_conv = (LDKSpendableOutputDescriptor*)orig;
6687 LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
6688 *ret_copy = SpendableOutputDescriptor_clone(orig_conv);
6689 long ret_ref = (long)ret_copy;
6693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6694 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6695 FREE((void*)this_ptr);
6696 ChannelKeys_free(this_ptr_conv);
6699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6700 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6701 FREE((void*)this_ptr);
6702 KeysInterface_free(this_ptr_conv);
6705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6706 LDKInMemoryChannelKeys this_ptr_conv;
6707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6709 InMemoryChannelKeys_free(this_ptr_conv);
6712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6713 LDKInMemoryChannelKeys orig_conv;
6714 orig_conv.inner = (void*)(orig & (~1));
6715 orig_conv.is_owned = (orig & 1) || (orig == 0);
6716 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_clone(&orig_conv);
6717 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6718 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6719 long ret_ref = (long)ret_var.inner;
6720 if (ret_var.is_owned) {
6726 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6727 LDKInMemoryChannelKeys this_ptr_conv;
6728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6730 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6731 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6736 LDKInMemoryChannelKeys this_ptr_conv;
6737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6739 LDKSecretKey val_ref;
6740 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6741 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6742 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6745 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6746 LDKInMemoryChannelKeys this_ptr_conv;
6747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6749 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6750 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6755 LDKInMemoryChannelKeys this_ptr_conv;
6756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6758 LDKSecretKey val_ref;
6759 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6760 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6761 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6764 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6765 LDKInMemoryChannelKeys this_ptr_conv;
6766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6768 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6769 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6774 LDKInMemoryChannelKeys this_ptr_conv;
6775 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6776 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6777 LDKSecretKey val_ref;
6778 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6779 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6780 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6783 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6784 LDKInMemoryChannelKeys this_ptr_conv;
6785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6786 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6787 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6788 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6792 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6793 LDKInMemoryChannelKeys this_ptr_conv;
6794 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6795 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6796 LDKSecretKey val_ref;
6797 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6798 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6799 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6802 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6803 LDKInMemoryChannelKeys this_ptr_conv;
6804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6806 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6807 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6811 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6812 LDKInMemoryChannelKeys this_ptr_conv;
6813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6815 LDKSecretKey val_ref;
6816 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6817 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6818 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6821 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6826 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6830 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6831 LDKInMemoryChannelKeys this_ptr_conv;
6832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6834 LDKThirtyTwoBytes val_ref;
6835 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6836 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6837 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6840 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) {
6841 LDKSecretKey funding_key_ref;
6842 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6843 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6844 LDKSecretKey revocation_base_key_ref;
6845 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6846 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6847 LDKSecretKey payment_key_ref;
6848 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6849 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6850 LDKSecretKey delayed_payment_base_key_ref;
6851 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6852 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6853 LDKSecretKey htlc_base_key_ref;
6854 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6855 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6856 LDKThirtyTwoBytes commitment_seed_ref;
6857 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6858 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6859 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6860 FREE((void*)key_derivation_params);
6861 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);
6862 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6863 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6864 long ret_ref = (long)ret_var.inner;
6865 if (ret_var.is_owned) {
6871 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6872 LDKInMemoryChannelKeys this_arg_conv;
6873 this_arg_conv.inner = (void*)(this_arg & (~1));
6874 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6875 LDKChannelPublicKeys ret_var = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6876 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6877 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6878 long ret_ref = (long)ret_var.inner;
6879 if (ret_var.is_owned) {
6885 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6886 LDKInMemoryChannelKeys this_arg_conv;
6887 this_arg_conv.inner = (void*)(this_arg & (~1));
6888 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6889 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6893 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6894 LDKInMemoryChannelKeys this_arg_conv;
6895 this_arg_conv.inner = (void*)(this_arg & (~1));
6896 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6897 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6902 LDKInMemoryChannelKeys this_arg_conv;
6903 this_arg_conv.inner = (void*)(this_arg & (~1));
6904 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6905 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6906 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6910 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6911 LDKInMemoryChannelKeys obj_conv;
6912 obj_conv.inner = (void*)(obj & (~1));
6913 obj_conv.is_owned = (obj & 1) || (obj == 0);
6914 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6915 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6916 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6917 CVec_u8Z_free(arg_var);
6921 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6923 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6924 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6925 LDKInMemoryChannelKeys ret_var = InMemoryChannelKeys_read(ser_ref);
6926 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6927 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6928 long ret_ref = (long)ret_var.inner;
6929 if (ret_var.is_owned) {
6932 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6937 LDKKeysManager this_ptr_conv;
6938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6940 KeysManager_free(this_ptr_conv);
6943 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) {
6944 unsigned char seed_arr[32];
6945 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6946 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6947 unsigned char (*seed_ref)[32] = &seed_arr;
6948 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6949 LDKKeysManager ret_var = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6950 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6951 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6952 long ret_ref = (long)ret_var.inner;
6953 if (ret_var.is_owned) {
6959 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) {
6960 LDKKeysManager this_arg_conv;
6961 this_arg_conv.inner = (void*)(this_arg & (~1));
6962 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6963 LDKInMemoryChannelKeys ret_var = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6964 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6965 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6966 long ret_ref = (long)ret_var.inner;
6967 if (ret_var.is_owned) {
6973 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6974 LDKKeysManager this_arg_conv;
6975 this_arg_conv.inner = (void*)(this_arg & (~1));
6976 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6977 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6978 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6983 LDKChannelManager this_ptr_conv;
6984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6986 ChannelManager_free(this_ptr_conv);
6989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6990 LDKChannelDetails this_ptr_conv;
6991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6993 ChannelDetails_free(this_ptr_conv);
6996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6997 LDKChannelDetails orig_conv;
6998 orig_conv.inner = (void*)(orig & (~1));
6999 orig_conv.is_owned = (orig & 1) || (orig == 0);
7000 LDKChannelDetails ret_var = ChannelDetails_clone(&orig_conv);
7001 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7002 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7003 long ret_ref = (long)ret_var.inner;
7004 if (ret_var.is_owned) {
7010 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7011 LDKChannelDetails this_ptr_conv;
7012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7014 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7015 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
7019 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7020 LDKChannelDetails this_ptr_conv;
7021 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7022 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7023 LDKThirtyTwoBytes val_ref;
7024 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7025 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7026 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
7029 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7030 LDKChannelDetails this_ptr_conv;
7031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7033 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7034 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
7038 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7039 LDKChannelDetails this_ptr_conv;
7040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7042 LDKPublicKey val_ref;
7043 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7044 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7045 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
7048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
7049 LDKChannelDetails this_ptr_conv;
7050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7052 LDKInitFeatures ret_var = ChannelDetails_get_counterparty_features(&this_ptr_conv);
7053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7055 long ret_ref = (long)ret_var.inner;
7056 if (ret_var.is_owned) {
7062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7063 LDKChannelDetails this_ptr_conv;
7064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7066 LDKInitFeatures val_conv;
7067 val_conv.inner = (void*)(val & (~1));
7068 val_conv.is_owned = (val & 1) || (val == 0);
7069 // Warning: we may need a move here but can't clone!
7070 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
7073 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7074 LDKChannelDetails this_ptr_conv;
7075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7076 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7077 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
7081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7082 LDKChannelDetails this_ptr_conv;
7083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7085 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
7088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7089 LDKChannelDetails this_ptr_conv;
7090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7091 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7092 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
7096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7097 LDKChannelDetails this_ptr_conv;
7098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7100 ChannelDetails_set_user_id(&this_ptr_conv, val);
7103 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7104 LDKChannelDetails this_ptr_conv;
7105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7107 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
7111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7112 LDKChannelDetails this_ptr_conv;
7113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7115 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
7118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7119 LDKChannelDetails this_ptr_conv;
7120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7122 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
7126 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7127 LDKChannelDetails this_ptr_conv;
7128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7129 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7130 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
7133 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
7134 LDKChannelDetails this_ptr_conv;
7135 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7136 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7137 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
7141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
7142 LDKChannelDetails this_ptr_conv;
7143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7145 ChannelDetails_set_is_live(&this_ptr_conv, val);
7148 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7149 LDKPaymentSendFailure this_ptr_conv;
7150 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7151 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7152 PaymentSendFailure_free(this_ptr_conv);
7155 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) {
7156 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
7157 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
7158 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
7159 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7160 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
7162 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7163 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7164 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7165 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7167 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7168 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7169 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7170 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7172 LDKLogger logger_conv = *(LDKLogger*)logger;
7173 if (logger_conv.free == LDKLogger_JCalls_free) {
7174 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7175 LDKLogger_JCalls_clone(logger_conv.this_arg);
7177 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7178 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7179 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7180 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7182 LDKUserConfig config_conv;
7183 config_conv.inner = (void*)(config & (~1));
7184 config_conv.is_owned = (config & 1) || (config == 0);
7185 if (config_conv.inner != NULL)
7186 config_conv = UserConfig_clone(&config_conv);
7187 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);
7188 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7189 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7190 long ret_ref = (long)ret_var.inner;
7191 if (ret_var.is_owned) {
7197 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) {
7198 LDKChannelManager this_arg_conv;
7199 this_arg_conv.inner = (void*)(this_arg & (~1));
7200 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7201 LDKPublicKey their_network_key_ref;
7202 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
7203 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
7204 LDKUserConfig override_config_conv;
7205 override_config_conv.inner = (void*)(override_config & (~1));
7206 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
7207 if (override_config_conv.inner != NULL)
7208 override_config_conv = UserConfig_clone(&override_config_conv);
7209 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7210 *ret_conv = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
7211 return (long)ret_conv;
7214 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7215 LDKChannelManager this_arg_conv;
7216 this_arg_conv.inner = (void*)(this_arg & (~1));
7217 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7218 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
7219 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7220 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7221 for (size_t q = 0; q < ret_var.datalen; q++) {
7222 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7223 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7224 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7225 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7226 if (arr_conv_16_var.is_owned) {
7227 arr_conv_16_ref |= 1;
7229 ret_arr_ptr[q] = arr_conv_16_ref;
7231 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7236 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7237 LDKChannelManager this_arg_conv;
7238 this_arg_conv.inner = (void*)(this_arg & (~1));
7239 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7240 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
7241 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
7242 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
7243 for (size_t q = 0; q < ret_var.datalen; q++) {
7244 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
7245 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7246 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7247 long arr_conv_16_ref = (long)arr_conv_16_var.inner;
7248 if (arr_conv_16_var.is_owned) {
7249 arr_conv_16_ref |= 1;
7251 ret_arr_ptr[q] = arr_conv_16_ref;
7253 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
7258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7259 LDKChannelManager this_arg_conv;
7260 this_arg_conv.inner = (void*)(this_arg & (~1));
7261 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7262 unsigned char channel_id_arr[32];
7263 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7264 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7265 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7266 LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
7267 *ret_conv = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
7268 return (long)ret_conv;
7271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
7272 LDKChannelManager this_arg_conv;
7273 this_arg_conv.inner = (void*)(this_arg & (~1));
7274 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7275 unsigned char channel_id_arr[32];
7276 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
7277 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
7278 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
7279 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
7282 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
7283 LDKChannelManager this_arg_conv;
7284 this_arg_conv.inner = (void*)(this_arg & (~1));
7285 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7286 ChannelManager_force_close_all_channels(&this_arg_conv);
7289 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) {
7290 LDKChannelManager this_arg_conv;
7291 this_arg_conv.inner = (void*)(this_arg & (~1));
7292 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7293 LDKRoute route_conv;
7294 route_conv.inner = (void*)(route & (~1));
7295 route_conv.is_owned = (route & 1) || (route == 0);
7296 LDKThirtyTwoBytes payment_hash_ref;
7297 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7298 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
7299 LDKThirtyTwoBytes payment_secret_ref;
7300 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7301 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7302 LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
7303 *ret_conv = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
7304 return (long)ret_conv;
7307 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) {
7308 LDKChannelManager this_arg_conv;
7309 this_arg_conv.inner = (void*)(this_arg & (~1));
7310 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7311 unsigned char temporary_channel_id_arr[32];
7312 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
7313 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
7314 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
7315 LDKOutPoint funding_txo_conv;
7316 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7317 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7318 if (funding_txo_conv.inner != NULL)
7319 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
7320 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
7323 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) {
7324 LDKChannelManager this_arg_conv;
7325 this_arg_conv.inner = (void*)(this_arg & (~1));
7326 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7327 LDKThreeBytes rgb_ref;
7328 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
7329 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
7330 LDKThirtyTwoBytes alias_ref;
7331 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
7332 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
7333 LDKCVec_NetAddressZ addresses_constr;
7334 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
7335 if (addresses_constr.datalen > 0)
7336 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
7338 addresses_constr.data = NULL;
7339 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
7340 for (size_t m = 0; m < addresses_constr.datalen; m++) {
7341 long arr_conv_12 = addresses_vals[m];
7342 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
7343 FREE((void*)arr_conv_12);
7344 addresses_constr.data[m] = arr_conv_12_conv;
7346 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
7347 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
7350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
7351 LDKChannelManager this_arg_conv;
7352 this_arg_conv.inner = (void*)(this_arg & (~1));
7353 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7354 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
7357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
7358 LDKChannelManager this_arg_conv;
7359 this_arg_conv.inner = (void*)(this_arg & (~1));
7360 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7361 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
7364 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) {
7365 LDKChannelManager this_arg_conv;
7366 this_arg_conv.inner = (void*)(this_arg & (~1));
7367 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7368 unsigned char payment_hash_arr[32];
7369 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
7370 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
7371 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
7372 LDKThirtyTwoBytes payment_secret_ref;
7373 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7374 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7375 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
7379 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) {
7380 LDKChannelManager this_arg_conv;
7381 this_arg_conv.inner = (void*)(this_arg & (~1));
7382 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7383 LDKThirtyTwoBytes payment_preimage_ref;
7384 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
7385 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
7386 LDKThirtyTwoBytes payment_secret_ref;
7387 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
7388 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
7389 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
7393 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
7394 LDKChannelManager this_arg_conv;
7395 this_arg_conv.inner = (void*)(this_arg & (~1));
7396 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7397 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7398 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
7402 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) {
7403 LDKChannelManager this_arg_conv;
7404 this_arg_conv.inner = (void*)(this_arg & (~1));
7405 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7406 LDKOutPoint funding_txo_conv;
7407 funding_txo_conv.inner = (void*)(funding_txo & (~1));
7408 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
7409 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
7412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7413 LDKChannelManager this_arg_conv;
7414 this_arg_conv.inner = (void*)(this_arg & (~1));
7415 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7416 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
7417 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
7421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
7422 LDKChannelManager this_arg_conv;
7423 this_arg_conv.inner = (void*)(this_arg & (~1));
7424 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7425 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
7426 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
7430 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
7431 LDKChannelManager this_arg_conv;
7432 this_arg_conv.inner = (void*)(this_arg & (~1));
7433 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7434 unsigned char header_arr[80];
7435 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7436 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7437 unsigned char (*header_ref)[80] = &header_arr;
7438 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
7439 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
7440 if (txdata_constr.datalen > 0)
7441 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
7443 txdata_constr.data = NULL;
7444 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
7445 for (size_t d = 0; d < txdata_constr.datalen; d++) {
7446 long arr_conv_29 = txdata_vals[d];
7447 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
7448 FREE((void*)arr_conv_29);
7449 txdata_constr.data[d] = arr_conv_29_conv;
7451 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
7452 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7456 LDKChannelManager this_arg_conv;
7457 this_arg_conv.inner = (void*)(this_arg & (~1));
7458 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7459 unsigned char header_arr[80];
7460 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7461 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7462 unsigned char (*header_ref)[80] = &header_arr;
7463 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7466 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(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 = (this_arg & 1) || (this_arg == 0);
7470 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7471 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7476 LDKChannelManagerReadArgs this_ptr_conv;
7477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7478 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7479 ChannelManagerReadArgs_free(this_ptr_conv);
7482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7483 LDKChannelManagerReadArgs this_ptr_conv;
7484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7485 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7486 long ret_ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7491 LDKChannelManagerReadArgs this_ptr_conv;
7492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7494 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7495 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7496 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7497 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7499 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7503 LDKChannelManagerReadArgs this_ptr_conv;
7504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7506 long ret_ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7511 LDKChannelManagerReadArgs this_ptr_conv;
7512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7514 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7515 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7516 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7517 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7519 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7523 LDKChannelManagerReadArgs this_ptr_conv;
7524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7526 long ret_ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7531 LDKChannelManagerReadArgs this_ptr_conv;
7532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7534 LDKWatch val_conv = *(LDKWatch*)val;
7535 if (val_conv.free == LDKWatch_JCalls_free) {
7536 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7537 LDKWatch_JCalls_clone(val_conv.this_arg);
7539 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7543 LDKChannelManagerReadArgs this_ptr_conv;
7544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7546 long ret_ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7551 LDKChannelManagerReadArgs this_ptr_conv;
7552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7554 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7555 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7556 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7557 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7559 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7563 LDKChannelManagerReadArgs this_ptr_conv;
7564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7566 long ret_ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7571 LDKChannelManagerReadArgs this_ptr_conv;
7572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7574 LDKLogger val_conv = *(LDKLogger*)val;
7575 if (val_conv.free == LDKLogger_JCalls_free) {
7576 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7577 LDKLogger_JCalls_clone(val_conv.this_arg);
7579 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7583 LDKChannelManagerReadArgs this_ptr_conv;
7584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7586 LDKUserConfig ret_var = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7587 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7588 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7589 long ret_ref = (long)ret_var.inner;
7590 if (ret_var.is_owned) {
7596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7597 LDKChannelManagerReadArgs this_ptr_conv;
7598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7600 LDKUserConfig val_conv;
7601 val_conv.inner = (void*)(val & (~1));
7602 val_conv.is_owned = (val & 1) || (val == 0);
7603 if (val_conv.inner != NULL)
7604 val_conv = UserConfig_clone(&val_conv);
7605 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7608 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) {
7609 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7610 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7611 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7612 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7614 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7615 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7616 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7617 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7619 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7620 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7621 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7622 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7624 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7625 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7626 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7627 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7629 LDKLogger logger_conv = *(LDKLogger*)logger;
7630 if (logger_conv.free == LDKLogger_JCalls_free) {
7631 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7632 LDKLogger_JCalls_clone(logger_conv.this_arg);
7634 LDKUserConfig default_config_conv;
7635 default_config_conv.inner = (void*)(default_config & (~1));
7636 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7637 if (default_config_conv.inner != NULL)
7638 default_config_conv = UserConfig_clone(&default_config_conv);
7639 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7640 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7641 if (channel_monitors_constr.datalen > 0)
7642 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7644 channel_monitors_constr.data = NULL;
7645 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7646 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7647 long arr_conv_16 = channel_monitors_vals[q];
7648 LDKChannelMonitor arr_conv_16_conv;
7649 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7650 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7651 channel_monitors_constr.data[q] = arr_conv_16_conv;
7653 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7654 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);
7655 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7656 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7657 long ret_ref = (long)ret_var.inner;
7658 if (ret_var.is_owned) {
7664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7665 LDKDecodeError this_ptr_conv;
7666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7668 DecodeError_free(this_ptr_conv);
7671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7672 LDKInit this_ptr_conv;
7673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7675 Init_free(this_ptr_conv);
7678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7680 orig_conv.inner = (void*)(orig & (~1));
7681 orig_conv.is_owned = (orig & 1) || (orig == 0);
7682 LDKInit ret_var = Init_clone(&orig_conv);
7683 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7684 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7685 long ret_ref = (long)ret_var.inner;
7686 if (ret_var.is_owned) {
7692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7693 LDKErrorMessage this_ptr_conv;
7694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7696 ErrorMessage_free(this_ptr_conv);
7699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7700 LDKErrorMessage orig_conv;
7701 orig_conv.inner = (void*)(orig & (~1));
7702 orig_conv.is_owned = (orig & 1) || (orig == 0);
7703 LDKErrorMessage ret_var = ErrorMessage_clone(&orig_conv);
7704 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7705 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7706 long ret_ref = (long)ret_var.inner;
7707 if (ret_var.is_owned) {
7713 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7714 LDKErrorMessage this_ptr_conv;
7715 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7716 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7717 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7718 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7723 LDKErrorMessage this_ptr_conv;
7724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7725 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7726 LDKThirtyTwoBytes val_ref;
7727 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7728 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7729 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7732 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7733 LDKErrorMessage this_ptr_conv;
7734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7736 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7737 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7738 memcpy(_buf, _str.chars, _str.len);
7740 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7746 LDKErrorMessage this_ptr_conv;
7747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7749 LDKCVec_u8Z val_ref;
7750 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7751 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7752 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7753 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7757 LDKThirtyTwoBytes channel_id_arg_ref;
7758 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7759 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7760 LDKCVec_u8Z data_arg_ref;
7761 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7762 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7763 LDKErrorMessage ret_var = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7764 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7765 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7766 long ret_ref = (long)ret_var.inner;
7767 if (ret_var.is_owned) {
7770 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7775 LDKPing this_ptr_conv;
7776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7778 Ping_free(this_ptr_conv);
7781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7783 orig_conv.inner = (void*)(orig & (~1));
7784 orig_conv.is_owned = (orig & 1) || (orig == 0);
7785 LDKPing ret_var = Ping_clone(&orig_conv);
7786 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7787 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7788 long ret_ref = (long)ret_var.inner;
7789 if (ret_var.is_owned) {
7795 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7796 LDKPing this_ptr_conv;
7797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7799 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7804 LDKPing this_ptr_conv;
7805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7807 Ping_set_ponglen(&this_ptr_conv, val);
7810 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7811 LDKPing this_ptr_conv;
7812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7814 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7819 LDKPing this_ptr_conv;
7820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7822 Ping_set_byteslen(&this_ptr_conv, val);
7825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7826 LDKPing ret_var = Ping_new(ponglen_arg, byteslen_arg);
7827 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7828 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7829 long ret_ref = (long)ret_var.inner;
7830 if (ret_var.is_owned) {
7836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7837 LDKPong this_ptr_conv;
7838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7840 Pong_free(this_ptr_conv);
7843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7845 orig_conv.inner = (void*)(orig & (~1));
7846 orig_conv.is_owned = (orig & 1) || (orig == 0);
7847 LDKPong ret_var = Pong_clone(&orig_conv);
7848 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7849 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7850 long ret_ref = (long)ret_var.inner;
7851 if (ret_var.is_owned) {
7857 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7858 LDKPong this_ptr_conv;
7859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7860 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7861 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7865 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7866 LDKPong this_ptr_conv;
7867 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7868 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7869 Pong_set_byteslen(&this_ptr_conv, val);
7872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7873 LDKPong ret_var = Pong_new(byteslen_arg);
7874 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7875 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7876 long ret_ref = (long)ret_var.inner;
7877 if (ret_var.is_owned) {
7883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7884 LDKOpenChannel this_ptr_conv;
7885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7887 OpenChannel_free(this_ptr_conv);
7890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7891 LDKOpenChannel orig_conv;
7892 orig_conv.inner = (void*)(orig & (~1));
7893 orig_conv.is_owned = (orig & 1) || (orig == 0);
7894 LDKOpenChannel ret_var = OpenChannel_clone(&orig_conv);
7895 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
7896 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
7897 long ret_ref = (long)ret_var.inner;
7898 if (ret_var.is_owned) {
7904 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7905 LDKOpenChannel this_ptr_conv;
7906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7908 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7909 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7913 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7914 LDKOpenChannel this_ptr_conv;
7915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7917 LDKThirtyTwoBytes val_ref;
7918 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7919 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7920 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7923 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7924 LDKOpenChannel this_ptr_conv;
7925 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7926 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7927 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7928 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7933 LDKOpenChannel this_ptr_conv;
7934 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7935 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7936 LDKThirtyTwoBytes val_ref;
7937 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7938 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7939 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7943 LDKOpenChannel this_ptr_conv;
7944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7946 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7951 LDKOpenChannel this_ptr_conv;
7952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7954 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7958 LDKOpenChannel this_ptr_conv;
7959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7961 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7966 LDKOpenChannel this_ptr_conv;
7967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7969 OpenChannel_set_push_msat(&this_ptr_conv, val);
7972 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7973 LDKOpenChannel this_ptr_conv;
7974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7976 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7981 LDKOpenChannel this_ptr_conv;
7982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7984 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7988 LDKOpenChannel this_ptr_conv;
7989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7990 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7991 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7995 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) {
7996 LDKOpenChannel this_ptr_conv;
7997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7999 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8003 LDKOpenChannel this_ptr_conv;
8004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8006 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8011 LDKOpenChannel this_ptr_conv;
8012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8014 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8018 LDKOpenChannel this_ptr_conv;
8019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8020 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8021 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
8025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8026 LDKOpenChannel this_ptr_conv;
8027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8029 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8032 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8033 LDKOpenChannel this_ptr_conv;
8034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8035 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8036 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
8040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8041 LDKOpenChannel this_ptr_conv;
8042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8044 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
8047 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8048 LDKOpenChannel this_ptr_conv;
8049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8051 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
8055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8056 LDKOpenChannel this_ptr_conv;
8057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8059 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
8062 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8063 LDKOpenChannel this_ptr_conv;
8064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8066 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
8070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8071 LDKOpenChannel this_ptr_conv;
8072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8074 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8077 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8078 LDKOpenChannel this_ptr_conv;
8079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8081 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8082 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8087 LDKOpenChannel this_ptr_conv;
8088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8090 LDKPublicKey val_ref;
8091 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8092 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8093 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8096 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8097 LDKOpenChannel this_ptr_conv;
8098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8100 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8101 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8105 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8106 LDKOpenChannel this_ptr_conv;
8107 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8108 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8109 LDKPublicKey val_ref;
8110 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8111 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8112 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8115 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8116 LDKOpenChannel this_ptr_conv;
8117 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8118 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8119 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8120 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
8124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8125 LDKOpenChannel this_ptr_conv;
8126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8128 LDKPublicKey val_ref;
8129 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8130 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8131 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
8134 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8135 LDKOpenChannel this_ptr_conv;
8136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8138 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8139 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8144 LDKOpenChannel this_ptr_conv;
8145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8147 LDKPublicKey val_ref;
8148 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8149 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8150 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8153 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8154 LDKOpenChannel this_ptr_conv;
8155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8157 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8158 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8162 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8163 LDKOpenChannel this_ptr_conv;
8164 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8165 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8166 LDKPublicKey val_ref;
8167 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8168 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8169 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8172 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8173 LDKOpenChannel this_ptr_conv;
8174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8176 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8177 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8182 LDKOpenChannel this_ptr_conv;
8183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8184 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8185 LDKPublicKey val_ref;
8186 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8187 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8188 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8191 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8192 LDKOpenChannel this_ptr_conv;
8193 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8194 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8195 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
8199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8200 LDKOpenChannel this_ptr_conv;
8201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8203 OpenChannel_set_channel_flags(&this_ptr_conv, val);
8206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8207 LDKAcceptChannel this_ptr_conv;
8208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8210 AcceptChannel_free(this_ptr_conv);
8213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8214 LDKAcceptChannel orig_conv;
8215 orig_conv.inner = (void*)(orig & (~1));
8216 orig_conv.is_owned = (orig & 1) || (orig == 0);
8217 LDKAcceptChannel ret_var = AcceptChannel_clone(&orig_conv);
8218 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8219 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8220 long ret_ref = (long)ret_var.inner;
8221 if (ret_var.is_owned) {
8227 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8228 LDKAcceptChannel this_ptr_conv;
8229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8231 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8232 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
8236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8237 LDKAcceptChannel this_ptr_conv;
8238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8240 LDKThirtyTwoBytes val_ref;
8241 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8242 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8243 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
8246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8247 LDKAcceptChannel this_ptr_conv;
8248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8250 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
8254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8255 LDKAcceptChannel this_ptr_conv;
8256 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8257 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8258 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
8261 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8262 LDKAcceptChannel this_ptr_conv;
8263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8265 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
8269 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) {
8270 LDKAcceptChannel this_ptr_conv;
8271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8273 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
8276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8277 LDKAcceptChannel this_ptr_conv;
8278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8280 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
8284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8285 LDKAcceptChannel this_ptr_conv;
8286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8288 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
8291 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8292 LDKAcceptChannel this_ptr_conv;
8293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8295 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
8299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8300 LDKAcceptChannel this_ptr_conv;
8301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8303 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
8306 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
8307 LDKAcceptChannel this_ptr_conv;
8308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8310 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
8314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8315 LDKAcceptChannel this_ptr_conv;
8316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8318 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
8321 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
8322 LDKAcceptChannel this_ptr_conv;
8323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8325 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
8329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8330 LDKAcceptChannel this_ptr_conv;
8331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8333 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
8336 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
8337 LDKAcceptChannel this_ptr_conv;
8338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8340 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
8344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8345 LDKAcceptChannel this_ptr_conv;
8346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8348 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
8351 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8352 LDKAcceptChannel this_ptr_conv;
8353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8355 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8356 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
8360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8361 LDKAcceptChannel this_ptr_conv;
8362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8364 LDKPublicKey val_ref;
8365 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8366 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8367 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
8370 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8371 LDKAcceptChannel this_ptr_conv;
8372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8374 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8375 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
8379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8380 LDKAcceptChannel this_ptr_conv;
8381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8383 LDKPublicKey val_ref;
8384 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8385 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8386 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
8389 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8390 LDKAcceptChannel this_ptr_conv;
8391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8393 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8394 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
8398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8399 LDKAcceptChannel this_ptr_conv;
8400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8402 LDKPublicKey val_ref;
8403 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8404 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8405 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
8408 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8409 LDKAcceptChannel this_ptr_conv;
8410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8412 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8413 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
8417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8418 LDKAcceptChannel this_ptr_conv;
8419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8420 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8421 LDKPublicKey val_ref;
8422 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8423 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8424 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
8427 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
8428 LDKAcceptChannel this_ptr_conv;
8429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8431 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8432 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
8436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8437 LDKAcceptChannel this_ptr_conv;
8438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8440 LDKPublicKey val_ref;
8441 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8442 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8443 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
8446 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8447 LDKAcceptChannel this_ptr_conv;
8448 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8449 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8450 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8451 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
8455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8456 LDKAcceptChannel this_ptr_conv;
8457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8459 LDKPublicKey val_ref;
8460 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8461 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8462 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
8465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8466 LDKFundingCreated this_ptr_conv;
8467 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8468 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8469 FundingCreated_free(this_ptr_conv);
8472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8473 LDKFundingCreated orig_conv;
8474 orig_conv.inner = (void*)(orig & (~1));
8475 orig_conv.is_owned = (orig & 1) || (orig == 0);
8476 LDKFundingCreated ret_var = FundingCreated_clone(&orig_conv);
8477 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8478 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8479 long ret_ref = (long)ret_var.inner;
8480 if (ret_var.is_owned) {
8486 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8487 LDKFundingCreated this_ptr_conv;
8488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8490 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8491 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
8495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8496 LDKFundingCreated this_ptr_conv;
8497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8499 LDKThirtyTwoBytes val_ref;
8500 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8501 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8502 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
8505 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
8506 LDKFundingCreated this_ptr_conv;
8507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8509 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8510 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
8514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8515 LDKFundingCreated this_ptr_conv;
8516 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8517 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8518 LDKThirtyTwoBytes val_ref;
8519 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8520 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8521 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
8524 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8525 LDKFundingCreated this_ptr_conv;
8526 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8527 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8528 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8533 LDKFundingCreated this_ptr_conv;
8534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8536 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8539 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8540 LDKFundingCreated this_ptr_conv;
8541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8543 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8544 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8549 LDKFundingCreated this_ptr_conv;
8550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8552 LDKSignature val_ref;
8553 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8554 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8555 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8558 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) {
8559 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8560 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8561 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8562 LDKThirtyTwoBytes funding_txid_arg_ref;
8563 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8564 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8565 LDKSignature signature_arg_ref;
8566 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8567 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8568 LDKFundingCreated ret_var = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8569 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8570 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8571 long ret_ref = (long)ret_var.inner;
8572 if (ret_var.is_owned) {
8578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8579 LDKFundingSigned this_ptr_conv;
8580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8582 FundingSigned_free(this_ptr_conv);
8585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8586 LDKFundingSigned orig_conv;
8587 orig_conv.inner = (void*)(orig & (~1));
8588 orig_conv.is_owned = (orig & 1) || (orig == 0);
8589 LDKFundingSigned ret_var = FundingSigned_clone(&orig_conv);
8590 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8591 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8592 long ret_ref = (long)ret_var.inner;
8593 if (ret_var.is_owned) {
8599 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8600 LDKFundingSigned this_ptr_conv;
8601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8603 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8604 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8609 LDKFundingSigned this_ptr_conv;
8610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8612 LDKThirtyTwoBytes val_ref;
8613 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8614 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8615 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8618 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8619 LDKFundingSigned this_ptr_conv;
8620 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8621 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8622 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8623 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8627 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8628 LDKFundingSigned this_ptr_conv;
8629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8631 LDKSignature val_ref;
8632 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8633 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8634 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8638 LDKThirtyTwoBytes channel_id_arg_ref;
8639 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8640 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8641 LDKSignature signature_arg_ref;
8642 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8643 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8644 LDKFundingSigned ret_var = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8645 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8646 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8647 long ret_ref = (long)ret_var.inner;
8648 if (ret_var.is_owned) {
8654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8655 LDKFundingLocked this_ptr_conv;
8656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8658 FundingLocked_free(this_ptr_conv);
8661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8662 LDKFundingLocked orig_conv;
8663 orig_conv.inner = (void*)(orig & (~1));
8664 orig_conv.is_owned = (orig & 1) || (orig == 0);
8665 LDKFundingLocked ret_var = FundingLocked_clone(&orig_conv);
8666 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8667 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8668 long ret_ref = (long)ret_var.inner;
8669 if (ret_var.is_owned) {
8675 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8676 LDKFundingLocked this_ptr_conv;
8677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8679 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8680 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8685 LDKFundingLocked this_ptr_conv;
8686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8688 LDKThirtyTwoBytes val_ref;
8689 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8690 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8691 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8694 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8695 LDKFundingLocked 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8699 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8704 LDKFundingLocked this_ptr_conv;
8705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8706 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8707 LDKPublicKey val_ref;
8708 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8709 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8710 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8713 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8714 LDKThirtyTwoBytes channel_id_arg_ref;
8715 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8716 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8717 LDKPublicKey next_per_commitment_point_arg_ref;
8718 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8719 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8720 LDKFundingLocked ret_var = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8721 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8722 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8723 long ret_ref = (long)ret_var.inner;
8724 if (ret_var.is_owned) {
8730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8731 LDKShutdown this_ptr_conv;
8732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8734 Shutdown_free(this_ptr_conv);
8737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8738 LDKShutdown orig_conv;
8739 orig_conv.inner = (void*)(orig & (~1));
8740 orig_conv.is_owned = (orig & 1) || (orig == 0);
8741 LDKShutdown ret_var = Shutdown_clone(&orig_conv);
8742 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8743 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8744 long ret_ref = (long)ret_var.inner;
8745 if (ret_var.is_owned) {
8751 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8752 LDKShutdown this_ptr_conv;
8753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8755 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8756 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8760 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8761 LDKShutdown this_ptr_conv;
8762 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8763 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8764 LDKThirtyTwoBytes val_ref;
8765 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8766 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8767 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8770 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8771 LDKShutdown 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 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8775 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8776 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8781 LDKShutdown this_ptr_conv;
8782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8784 LDKCVec_u8Z val_ref;
8785 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8786 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8787 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8788 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8792 LDKThirtyTwoBytes channel_id_arg_ref;
8793 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8794 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8795 LDKCVec_u8Z scriptpubkey_arg_ref;
8796 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8797 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8798 LDKShutdown ret_var = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8799 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8800 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8801 long ret_ref = (long)ret_var.inner;
8802 if (ret_var.is_owned) {
8805 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8810 LDKClosingSigned this_ptr_conv;
8811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8813 ClosingSigned_free(this_ptr_conv);
8816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8817 LDKClosingSigned orig_conv;
8818 orig_conv.inner = (void*)(orig & (~1));
8819 orig_conv.is_owned = (orig & 1) || (orig == 0);
8820 LDKClosingSigned ret_var = ClosingSigned_clone(&orig_conv);
8821 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8822 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8823 long ret_ref = (long)ret_var.inner;
8824 if (ret_var.is_owned) {
8830 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8831 LDKClosingSigned this_ptr_conv;
8832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8834 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8835 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8840 LDKClosingSigned this_ptr_conv;
8841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8843 LDKThirtyTwoBytes val_ref;
8844 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8845 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8846 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8849 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8850 LDKClosingSigned this_ptr_conv;
8851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8853 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8858 LDKClosingSigned this_ptr_conv;
8859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8860 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8861 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8865 LDKClosingSigned this_ptr_conv;
8866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8867 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8868 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8869 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8874 LDKClosingSigned this_ptr_conv;
8875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8877 LDKSignature val_ref;
8878 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8879 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8880 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8883 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) {
8884 LDKThirtyTwoBytes channel_id_arg_ref;
8885 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8886 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8887 LDKSignature signature_arg_ref;
8888 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8889 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8890 LDKClosingSigned ret_var = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8891 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8892 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8893 long ret_ref = (long)ret_var.inner;
8894 if (ret_var.is_owned) {
8900 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8901 LDKUpdateAddHTLC this_ptr_conv;
8902 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8903 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8904 UpdateAddHTLC_free(this_ptr_conv);
8907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8908 LDKUpdateAddHTLC orig_conv;
8909 orig_conv.inner = (void*)(orig & (~1));
8910 orig_conv.is_owned = (orig & 1) || (orig == 0);
8911 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_clone(&orig_conv);
8912 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
8913 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
8914 long ret_ref = (long)ret_var.inner;
8915 if (ret_var.is_owned) {
8921 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8922 LDKUpdateAddHTLC this_ptr_conv;
8923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8925 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8926 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8931 LDKUpdateAddHTLC this_ptr_conv;
8932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8934 LDKThirtyTwoBytes val_ref;
8935 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8936 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8937 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8941 LDKUpdateAddHTLC this_ptr_conv;
8942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8944 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8949 LDKUpdateAddHTLC this_ptr_conv;
8950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8952 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8956 LDKUpdateAddHTLC this_ptr_conv;
8957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8958 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8959 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8964 LDKUpdateAddHTLC this_ptr_conv;
8965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8967 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8970 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8971 LDKUpdateAddHTLC this_ptr_conv;
8972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8974 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8975 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8980 LDKUpdateAddHTLC this_ptr_conv;
8981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8983 LDKThirtyTwoBytes val_ref;
8984 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8985 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8986 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8989 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8990 LDKUpdateAddHTLC this_ptr_conv;
8991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8993 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8998 LDKUpdateAddHTLC this_ptr_conv;
8999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9001 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
9004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9005 LDKUpdateFulfillHTLC this_ptr_conv;
9006 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9007 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9008 UpdateFulfillHTLC_free(this_ptr_conv);
9011 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9012 LDKUpdateFulfillHTLC orig_conv;
9013 orig_conv.inner = (void*)(orig & (~1));
9014 orig_conv.is_owned = (orig & 1) || (orig == 0);
9015 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_clone(&orig_conv);
9016 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9017 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9018 long ret_ref = (long)ret_var.inner;
9019 if (ret_var.is_owned) {
9025 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9026 LDKUpdateFulfillHTLC this_ptr_conv;
9027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9029 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9030 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
9034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9035 LDKUpdateFulfillHTLC this_ptr_conv;
9036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9038 LDKThirtyTwoBytes val_ref;
9039 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9040 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9041 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
9044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9045 LDKUpdateFulfillHTLC this_ptr_conv;
9046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9048 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
9052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9053 LDKUpdateFulfillHTLC this_ptr_conv;
9054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9056 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
9059 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
9060 LDKUpdateFulfillHTLC this_ptr_conv;
9061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9063 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9064 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
9068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9069 LDKUpdateFulfillHTLC this_ptr_conv;
9070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9072 LDKThirtyTwoBytes val_ref;
9073 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9074 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9075 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
9078 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) {
9079 LDKThirtyTwoBytes channel_id_arg_ref;
9080 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9081 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9082 LDKThirtyTwoBytes payment_preimage_arg_ref;
9083 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
9084 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
9085 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
9086 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9087 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9088 long ret_ref = (long)ret_var.inner;
9089 if (ret_var.is_owned) {
9095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9096 LDKUpdateFailHTLC this_ptr_conv;
9097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9099 UpdateFailHTLC_free(this_ptr_conv);
9102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9103 LDKUpdateFailHTLC orig_conv;
9104 orig_conv.inner = (void*)(orig & (~1));
9105 orig_conv.is_owned = (orig & 1) || (orig == 0);
9106 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_clone(&orig_conv);
9107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9109 long ret_ref = (long)ret_var.inner;
9110 if (ret_var.is_owned) {
9116 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9117 LDKUpdateFailHTLC this_ptr_conv;
9118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9120 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9121 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
9125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9126 LDKUpdateFailHTLC this_ptr_conv;
9127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9129 LDKThirtyTwoBytes val_ref;
9130 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9131 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9132 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
9135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9136 LDKUpdateFailHTLC this_ptr_conv;
9137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9139 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
9143 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9144 LDKUpdateFailHTLC this_ptr_conv;
9145 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9146 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9147 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
9150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9151 LDKUpdateFailMalformedHTLC this_ptr_conv;
9152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9154 UpdateFailMalformedHTLC_free(this_ptr_conv);
9157 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9158 LDKUpdateFailMalformedHTLC orig_conv;
9159 orig_conv.inner = (void*)(orig & (~1));
9160 orig_conv.is_owned = (orig & 1) || (orig == 0);
9161 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_clone(&orig_conv);
9162 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9163 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9164 long ret_ref = (long)ret_var.inner;
9165 if (ret_var.is_owned) {
9171 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9172 LDKUpdateFailMalformedHTLC this_ptr_conv;
9173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9175 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9176 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
9180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9181 LDKUpdateFailMalformedHTLC this_ptr_conv;
9182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9184 LDKThirtyTwoBytes val_ref;
9185 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9186 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9187 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
9190 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9191 LDKUpdateFailMalformedHTLC this_ptr_conv;
9192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9194 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
9198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9199 LDKUpdateFailMalformedHTLC this_ptr_conv;
9200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9202 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
9205 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
9206 LDKUpdateFailMalformedHTLC this_ptr_conv;
9207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9208 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9209 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
9213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9214 LDKUpdateFailMalformedHTLC this_ptr_conv;
9215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9216 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9217 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
9220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9221 LDKCommitmentSigned this_ptr_conv;
9222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9224 CommitmentSigned_free(this_ptr_conv);
9227 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9228 LDKCommitmentSigned orig_conv;
9229 orig_conv.inner = (void*)(orig & (~1));
9230 orig_conv.is_owned = (orig & 1) || (orig == 0);
9231 LDKCommitmentSigned ret_var = CommitmentSigned_clone(&orig_conv);
9232 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9233 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9234 long ret_ref = (long)ret_var.inner;
9235 if (ret_var.is_owned) {
9241 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9242 LDKCommitmentSigned this_ptr_conv;
9243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9245 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9246 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
9250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9251 LDKCommitmentSigned this_ptr_conv;
9252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9254 LDKThirtyTwoBytes val_ref;
9255 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9256 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9257 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
9260 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9261 LDKCommitmentSigned this_ptr_conv;
9262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9264 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9265 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
9269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9270 LDKCommitmentSigned this_ptr_conv;
9271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9273 LDKSignature val_ref;
9274 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9275 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9276 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
9279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
9280 LDKCommitmentSigned this_ptr_conv;
9281 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9282 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9283 LDKCVec_SignatureZ val_constr;
9284 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9285 if (val_constr.datalen > 0)
9286 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9288 val_constr.data = NULL;
9289 for (size_t i = 0; i < val_constr.datalen; i++) {
9290 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
9291 LDKSignature arr_conv_8_ref;
9292 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9293 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9294 val_constr.data[i] = arr_conv_8_ref;
9296 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
9299 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) {
9300 LDKThirtyTwoBytes channel_id_arg_ref;
9301 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9302 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9303 LDKSignature signature_arg_ref;
9304 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9305 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9306 LDKCVec_SignatureZ htlc_signatures_arg_constr;
9307 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
9308 if (htlc_signatures_arg_constr.datalen > 0)
9309 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
9311 htlc_signatures_arg_constr.data = NULL;
9312 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
9313 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
9314 LDKSignature arr_conv_8_ref;
9315 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
9316 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
9317 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
9319 LDKCommitmentSigned ret_var = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
9320 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9321 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9322 long ret_ref = (long)ret_var.inner;
9323 if (ret_var.is_owned) {
9329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9330 LDKRevokeAndACK this_ptr_conv;
9331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9333 RevokeAndACK_free(this_ptr_conv);
9336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9337 LDKRevokeAndACK orig_conv;
9338 orig_conv.inner = (void*)(orig & (~1));
9339 orig_conv.is_owned = (orig & 1) || (orig == 0);
9340 LDKRevokeAndACK ret_var = RevokeAndACK_clone(&orig_conv);
9341 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9342 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9343 long ret_ref = (long)ret_var.inner;
9344 if (ret_var.is_owned) {
9350 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9351 LDKRevokeAndACK this_ptr_conv;
9352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9354 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9355 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
9359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9360 LDKRevokeAndACK this_ptr_conv;
9361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9363 LDKThirtyTwoBytes val_ref;
9364 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9365 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9366 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
9369 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9370 LDKRevokeAndACK this_ptr_conv;
9371 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9372 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9373 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9374 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
9378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9379 LDKRevokeAndACK this_ptr_conv;
9380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9382 LDKThirtyTwoBytes val_ref;
9383 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9384 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9385 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
9388 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9389 LDKRevokeAndACK this_ptr_conv;
9390 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9391 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9392 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9393 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
9397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9398 LDKRevokeAndACK this_ptr_conv;
9399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9401 LDKPublicKey val_ref;
9402 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9403 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9404 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
9407 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) {
9408 LDKThirtyTwoBytes channel_id_arg_ref;
9409 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9410 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9411 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
9412 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
9413 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
9414 LDKPublicKey next_per_commitment_point_arg_ref;
9415 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
9416 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
9417 LDKRevokeAndACK ret_var = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
9418 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9419 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9420 long ret_ref = (long)ret_var.inner;
9421 if (ret_var.is_owned) {
9427 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9428 LDKUpdateFee this_ptr_conv;
9429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9431 UpdateFee_free(this_ptr_conv);
9434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9435 LDKUpdateFee orig_conv;
9436 orig_conv.inner = (void*)(orig & (~1));
9437 orig_conv.is_owned = (orig & 1) || (orig == 0);
9438 LDKUpdateFee ret_var = UpdateFee_clone(&orig_conv);
9439 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9440 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9441 long ret_ref = (long)ret_var.inner;
9442 if (ret_var.is_owned) {
9448 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9449 LDKUpdateFee this_ptr_conv;
9450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9452 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9453 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
9457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9458 LDKUpdateFee this_ptr_conv;
9459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9461 LDKThirtyTwoBytes val_ref;
9462 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9463 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9464 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
9467 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
9468 LDKUpdateFee this_ptr_conv;
9469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9471 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
9475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9476 LDKUpdateFee this_ptr_conv;
9477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9478 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9479 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
9482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
9483 LDKThirtyTwoBytes channel_id_arg_ref;
9484 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9485 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9486 LDKUpdateFee ret_var = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
9487 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9488 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9489 long ret_ref = (long)ret_var.inner;
9490 if (ret_var.is_owned) {
9496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9497 LDKDataLossProtect this_ptr_conv;
9498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9500 DataLossProtect_free(this_ptr_conv);
9503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9504 LDKDataLossProtect orig_conv;
9505 orig_conv.inner = (void*)(orig & (~1));
9506 orig_conv.is_owned = (orig & 1) || (orig == 0);
9507 LDKDataLossProtect ret_var = DataLossProtect_clone(&orig_conv);
9508 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9509 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9510 long ret_ref = (long)ret_var.inner;
9511 if (ret_var.is_owned) {
9517 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
9518 LDKDataLossProtect this_ptr_conv;
9519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9520 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9521 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9522 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
9526 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9527 LDKDataLossProtect this_ptr_conv;
9528 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9529 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9530 LDKThirtyTwoBytes val_ref;
9531 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9532 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9533 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
9536 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
9537 LDKDataLossProtect this_ptr_conv;
9538 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9539 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9540 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9541 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
9545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9546 LDKDataLossProtect this_ptr_conv;
9547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9549 LDKPublicKey val_ref;
9550 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9551 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9552 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
9555 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) {
9556 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
9557 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
9558 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
9559 LDKPublicKey my_current_per_commitment_point_arg_ref;
9560 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
9561 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
9562 LDKDataLossProtect ret_var = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
9563 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9564 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9565 long ret_ref = (long)ret_var.inner;
9566 if (ret_var.is_owned) {
9572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9573 LDKChannelReestablish this_ptr_conv;
9574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9576 ChannelReestablish_free(this_ptr_conv);
9579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9580 LDKChannelReestablish orig_conv;
9581 orig_conv.inner = (void*)(orig & (~1));
9582 orig_conv.is_owned = (orig & 1) || (orig == 0);
9583 LDKChannelReestablish ret_var = ChannelReestablish_clone(&orig_conv);
9584 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9585 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9586 long ret_ref = (long)ret_var.inner;
9587 if (ret_var.is_owned) {
9593 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9594 LDKChannelReestablish this_ptr_conv;
9595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9597 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9598 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
9602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9603 LDKChannelReestablish this_ptr_conv;
9604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9606 LDKThirtyTwoBytes val_ref;
9607 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9608 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9609 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
9612 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9613 LDKChannelReestablish 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 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
9620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9621 LDKChannelReestablish this_ptr_conv;
9622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9624 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
9627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
9628 LDKChannelReestablish this_ptr_conv;
9629 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9630 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9631 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
9635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9636 LDKChannelReestablish this_ptr_conv;
9637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9639 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
9642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9643 LDKAnnouncementSignatures this_ptr_conv;
9644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9646 AnnouncementSignatures_free(this_ptr_conv);
9649 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9650 LDKAnnouncementSignatures orig_conv;
9651 orig_conv.inner = (void*)(orig & (~1));
9652 orig_conv.is_owned = (orig & 1) || (orig == 0);
9653 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_clone(&orig_conv);
9654 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9655 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9656 long ret_ref = (long)ret_var.inner;
9657 if (ret_var.is_owned) {
9663 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9664 LDKAnnouncementSignatures this_ptr_conv;
9665 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9666 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9667 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9668 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9673 LDKAnnouncementSignatures this_ptr_conv;
9674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9676 LDKThirtyTwoBytes val_ref;
9677 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9678 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9679 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9683 LDKAnnouncementSignatures this_ptr_conv;
9684 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9685 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9686 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9690 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9691 LDKAnnouncementSignatures this_ptr_conv;
9692 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9693 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9694 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9697 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9698 LDKAnnouncementSignatures this_ptr_conv;
9699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9701 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9702 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9706 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9707 LDKAnnouncementSignatures this_ptr_conv;
9708 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9709 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9710 LDKSignature val_ref;
9711 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9712 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9713 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9716 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9717 LDKAnnouncementSignatures this_ptr_conv;
9718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9720 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9721 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9726 LDKAnnouncementSignatures this_ptr_conv;
9727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9729 LDKSignature val_ref;
9730 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9731 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9732 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9735 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) {
9736 LDKThirtyTwoBytes channel_id_arg_ref;
9737 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9738 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9739 LDKSignature node_signature_arg_ref;
9740 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9741 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9742 LDKSignature bitcoin_signature_arg_ref;
9743 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9744 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9745 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9746 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9747 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9748 long ret_ref = (long)ret_var.inner;
9749 if (ret_var.is_owned) {
9755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9756 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9757 FREE((void*)this_ptr);
9758 NetAddress_free(this_ptr_conv);
9761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9762 LDKNetAddress* orig_conv = (LDKNetAddress*)orig;
9763 LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress");
9764 *ret_copy = NetAddress_clone(orig_conv);
9765 long ret_ref = (long)ret_copy;
9769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9770 LDKUnsignedNodeAnnouncement this_ptr_conv;
9771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9773 UnsignedNodeAnnouncement_free(this_ptr_conv);
9776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9777 LDKUnsignedNodeAnnouncement orig_conv;
9778 orig_conv.inner = (void*)(orig & (~1));
9779 orig_conv.is_owned = (orig & 1) || (orig == 0);
9780 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_clone(&orig_conv);
9781 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9782 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9783 long ret_ref = (long)ret_var.inner;
9784 if (ret_var.is_owned) {
9790 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9791 LDKUnsignedNodeAnnouncement this_ptr_conv;
9792 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9793 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9794 LDKNodeFeatures ret_var = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9795 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9796 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9797 long ret_ref = (long)ret_var.inner;
9798 if (ret_var.is_owned) {
9804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9805 LDKUnsignedNodeAnnouncement this_ptr_conv;
9806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9808 LDKNodeFeatures val_conv;
9809 val_conv.inner = (void*)(val & (~1));
9810 val_conv.is_owned = (val & 1) || (val == 0);
9811 // Warning: we may need a move here but can't clone!
9812 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9815 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9816 LDKUnsignedNodeAnnouncement this_ptr_conv;
9817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9819 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9824 LDKUnsignedNodeAnnouncement this_ptr_conv;
9825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9827 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9830 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9831 LDKUnsignedNodeAnnouncement this_ptr_conv;
9832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9834 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9835 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9840 LDKUnsignedNodeAnnouncement this_ptr_conv;
9841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9843 LDKPublicKey val_ref;
9844 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9845 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9846 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9849 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9850 LDKUnsignedNodeAnnouncement this_ptr_conv;
9851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9853 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
9854 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9859 LDKUnsignedNodeAnnouncement this_ptr_conv;
9860 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9861 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9862 LDKThreeBytes val_ref;
9863 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9864 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9865 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9868 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9869 LDKUnsignedNodeAnnouncement this_ptr_conv;
9870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9872 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9873 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9878 LDKUnsignedNodeAnnouncement this_ptr_conv;
9879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9881 LDKThirtyTwoBytes val_ref;
9882 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9883 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9884 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9888 LDKUnsignedNodeAnnouncement this_ptr_conv;
9889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9891 LDKCVec_NetAddressZ val_constr;
9892 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9893 if (val_constr.datalen > 0)
9894 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9896 val_constr.data = NULL;
9897 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9898 for (size_t m = 0; m < val_constr.datalen; m++) {
9899 long arr_conv_12 = val_vals[m];
9900 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9901 FREE((void*)arr_conv_12);
9902 val_constr.data[m] = arr_conv_12_conv;
9904 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9905 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9909 LDKNodeAnnouncement this_ptr_conv;
9910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9912 NodeAnnouncement_free(this_ptr_conv);
9915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9916 LDKNodeAnnouncement orig_conv;
9917 orig_conv.inner = (void*)(orig & (~1));
9918 orig_conv.is_owned = (orig & 1) || (orig == 0);
9919 LDKNodeAnnouncement ret_var = NodeAnnouncement_clone(&orig_conv);
9920 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9921 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9922 long ret_ref = (long)ret_var.inner;
9923 if (ret_var.is_owned) {
9929 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9930 LDKNodeAnnouncement this_ptr_conv;
9931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9933 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9934 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9938 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9939 LDKNodeAnnouncement this_ptr_conv;
9940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9942 LDKSignature val_ref;
9943 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9944 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9945 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9949 LDKNodeAnnouncement this_ptr_conv;
9950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9952 LDKUnsignedNodeAnnouncement ret_var = NodeAnnouncement_get_contents(&this_ptr_conv);
9953 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9954 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9955 long ret_ref = (long)ret_var.inner;
9956 if (ret_var.is_owned) {
9962 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9963 LDKNodeAnnouncement this_ptr_conv;
9964 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9965 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9966 LDKUnsignedNodeAnnouncement val_conv;
9967 val_conv.inner = (void*)(val & (~1));
9968 val_conv.is_owned = (val & 1) || (val == 0);
9969 if (val_conv.inner != NULL)
9970 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9971 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9975 LDKSignature signature_arg_ref;
9976 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9977 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9978 LDKUnsignedNodeAnnouncement contents_arg_conv;
9979 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9980 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9981 if (contents_arg_conv.inner != NULL)
9982 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9983 LDKNodeAnnouncement ret_var = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9984 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
9985 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
9986 long ret_ref = (long)ret_var.inner;
9987 if (ret_var.is_owned) {
9993 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9994 LDKUnsignedChannelAnnouncement this_ptr_conv;
9995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9997 UnsignedChannelAnnouncement_free(this_ptr_conv);
10000 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10001 LDKUnsignedChannelAnnouncement orig_conv;
10002 orig_conv.inner = (void*)(orig & (~1));
10003 orig_conv.is_owned = (orig & 1) || (orig == 0);
10004 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_clone(&orig_conv);
10005 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10006 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10007 long ret_ref = (long)ret_var.inner;
10008 if (ret_var.is_owned) {
10014 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
10015 LDKUnsignedChannelAnnouncement this_ptr_conv;
10016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10018 LDKChannelFeatures ret_var = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
10019 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10020 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10021 long ret_ref = (long)ret_var.inner;
10022 if (ret_var.is_owned) {
10028 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10029 LDKUnsignedChannelAnnouncement this_ptr_conv;
10030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10032 LDKChannelFeatures val_conv;
10033 val_conv.inner = (void*)(val & (~1));
10034 val_conv.is_owned = (val & 1) || (val == 0);
10035 // Warning: we may need a move here but can't clone!
10036 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
10039 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10040 LDKUnsignedChannelAnnouncement this_ptr_conv;
10041 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10042 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10043 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10044 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
10048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10049 LDKUnsignedChannelAnnouncement this_ptr_conv;
10050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10052 LDKThirtyTwoBytes val_ref;
10053 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10054 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10055 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
10058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10059 LDKUnsignedChannelAnnouncement this_ptr_conv;
10060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10062 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
10066 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10067 LDKUnsignedChannelAnnouncement this_ptr_conv;
10068 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10069 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10070 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
10073 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10074 LDKUnsignedChannelAnnouncement this_ptr_conv;
10075 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10076 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10077 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10078 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
10082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10083 LDKUnsignedChannelAnnouncement this_ptr_conv;
10084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10086 LDKPublicKey val_ref;
10087 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10088 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10089 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
10092 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10093 LDKUnsignedChannelAnnouncement this_ptr_conv;
10094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10096 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10097 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
10101 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10102 LDKUnsignedChannelAnnouncement this_ptr_conv;
10103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10105 LDKPublicKey val_ref;
10106 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10107 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10108 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
10111 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10112 LDKUnsignedChannelAnnouncement this_ptr_conv;
10113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10115 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10116 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
10120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10121 LDKUnsignedChannelAnnouncement this_ptr_conv;
10122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10124 LDKPublicKey val_ref;
10125 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10126 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10127 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
10130 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(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 = (this_ptr & 1) || (this_ptr == 0);
10134 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10135 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
10139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10140 LDKUnsignedChannelAnnouncement this_ptr_conv;
10141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10143 LDKPublicKey val_ref;
10144 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10145 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10146 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
10149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10150 LDKChannelAnnouncement this_ptr_conv;
10151 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10152 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10153 ChannelAnnouncement_free(this_ptr_conv);
10156 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10157 LDKChannelAnnouncement orig_conv;
10158 orig_conv.inner = (void*)(orig & (~1));
10159 orig_conv.is_owned = (orig & 1) || (orig == 0);
10160 LDKChannelAnnouncement ret_var = ChannelAnnouncement_clone(&orig_conv);
10161 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10162 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10163 long ret_ref = (long)ret_var.inner;
10164 if (ret_var.is_owned) {
10170 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10171 LDKChannelAnnouncement this_ptr_conv;
10172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10174 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10175 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
10179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10180 LDKChannelAnnouncement this_ptr_conv;
10181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10183 LDKSignature val_ref;
10184 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10185 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10186 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
10189 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10190 LDKChannelAnnouncement this_ptr_conv;
10191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10193 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10194 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
10198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10199 LDKChannelAnnouncement this_ptr_conv;
10200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10202 LDKSignature val_ref;
10203 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10204 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10205 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
10208 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
10209 LDKChannelAnnouncement this_ptr_conv;
10210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10212 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10213 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
10217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10218 LDKChannelAnnouncement this_ptr_conv;
10219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10221 LDKSignature val_ref;
10222 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10223 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10224 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
10227 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
10228 LDKChannelAnnouncement this_ptr_conv;
10229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10231 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10232 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
10236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10237 LDKChannelAnnouncement this_ptr_conv;
10238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10240 LDKSignature val_ref;
10241 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10242 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10243 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
10246 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10247 LDKChannelAnnouncement this_ptr_conv;
10248 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10249 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10250 LDKUnsignedChannelAnnouncement ret_var = ChannelAnnouncement_get_contents(&this_ptr_conv);
10251 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10252 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10253 long ret_ref = (long)ret_var.inner;
10254 if (ret_var.is_owned) {
10260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10261 LDKChannelAnnouncement this_ptr_conv;
10262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10264 LDKUnsignedChannelAnnouncement val_conv;
10265 val_conv.inner = (void*)(val & (~1));
10266 val_conv.is_owned = (val & 1) || (val == 0);
10267 if (val_conv.inner != NULL)
10268 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
10269 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
10272 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) {
10273 LDKSignature node_signature_1_arg_ref;
10274 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
10275 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
10276 LDKSignature node_signature_2_arg_ref;
10277 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
10278 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
10279 LDKSignature bitcoin_signature_1_arg_ref;
10280 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
10281 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
10282 LDKSignature bitcoin_signature_2_arg_ref;
10283 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
10284 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
10285 LDKUnsignedChannelAnnouncement contents_arg_conv;
10286 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10287 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10288 if (contents_arg_conv.inner != NULL)
10289 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
10290 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);
10291 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10292 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10293 long ret_ref = (long)ret_var.inner;
10294 if (ret_var.is_owned) {
10300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10301 LDKUnsignedChannelUpdate this_ptr_conv;
10302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10304 UnsignedChannelUpdate_free(this_ptr_conv);
10307 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10308 LDKUnsignedChannelUpdate orig_conv;
10309 orig_conv.inner = (void*)(orig & (~1));
10310 orig_conv.is_owned = (orig & 1) || (orig == 0);
10311 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_clone(&orig_conv);
10312 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10313 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10314 long ret_ref = (long)ret_var.inner;
10315 if (ret_var.is_owned) {
10321 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10322 LDKUnsignedChannelUpdate this_ptr_conv;
10323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10325 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10326 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
10330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10331 LDKUnsignedChannelUpdate this_ptr_conv;
10332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10334 LDKThirtyTwoBytes val_ref;
10335 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10336 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10337 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
10340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
10341 LDKUnsignedChannelUpdate this_ptr_conv;
10342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10344 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
10348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10349 LDKUnsignedChannelUpdate this_ptr_conv;
10350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10352 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
10355 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10356 LDKUnsignedChannelUpdate this_ptr_conv;
10357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10359 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
10363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10364 LDKUnsignedChannelUpdate this_ptr_conv;
10365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10367 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
10370 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
10371 LDKUnsignedChannelUpdate this_ptr_conv;
10372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10374 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
10378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
10379 LDKUnsignedChannelUpdate this_ptr_conv;
10380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10382 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
10385 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
10386 LDKUnsignedChannelUpdate this_ptr_conv;
10387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10389 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
10393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
10394 LDKUnsignedChannelUpdate this_ptr_conv;
10395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10397 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
10400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10401 LDKUnsignedChannelUpdate this_ptr_conv;
10402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10404 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
10408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10409 LDKUnsignedChannelUpdate this_ptr_conv;
10410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10412 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
10415 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10416 LDKUnsignedChannelUpdate this_ptr_conv;
10417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10419 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
10423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10424 LDKUnsignedChannelUpdate this_ptr_conv;
10425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10427 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
10430 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
10431 LDKUnsignedChannelUpdate this_ptr_conv;
10432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10433 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10434 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
10438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10439 LDKUnsignedChannelUpdate this_ptr_conv;
10440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10442 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
10445 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10446 LDKChannelUpdate this_ptr_conv;
10447 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10448 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10449 ChannelUpdate_free(this_ptr_conv);
10452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10453 LDKChannelUpdate orig_conv;
10454 orig_conv.inner = (void*)(orig & (~1));
10455 orig_conv.is_owned = (orig & 1) || (orig == 0);
10456 LDKChannelUpdate ret_var = ChannelUpdate_clone(&orig_conv);
10457 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10458 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10459 long ret_ref = (long)ret_var.inner;
10460 if (ret_var.is_owned) {
10466 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
10467 LDKChannelUpdate this_ptr_conv;
10468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10470 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10471 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
10475 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10476 LDKChannelUpdate this_ptr_conv;
10477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10478 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10479 LDKSignature val_ref;
10480 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10481 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10482 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
10485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
10486 LDKChannelUpdate this_ptr_conv;
10487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10489 LDKUnsignedChannelUpdate ret_var = ChannelUpdate_get_contents(&this_ptr_conv);
10490 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10491 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10492 long ret_ref = (long)ret_var.inner;
10493 if (ret_var.is_owned) {
10499 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10500 LDKChannelUpdate this_ptr_conv;
10501 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10502 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10503 LDKUnsignedChannelUpdate val_conv;
10504 val_conv.inner = (void*)(val & (~1));
10505 val_conv.is_owned = (val & 1) || (val == 0);
10506 if (val_conv.inner != NULL)
10507 val_conv = UnsignedChannelUpdate_clone(&val_conv);
10508 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
10511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
10512 LDKSignature signature_arg_ref;
10513 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
10514 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
10515 LDKUnsignedChannelUpdate contents_arg_conv;
10516 contents_arg_conv.inner = (void*)(contents_arg & (~1));
10517 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
10518 if (contents_arg_conv.inner != NULL)
10519 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
10520 LDKChannelUpdate ret_var = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
10521 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10522 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10523 long ret_ref = (long)ret_var.inner;
10524 if (ret_var.is_owned) {
10530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10531 LDKQueryChannelRange this_ptr_conv;
10532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10534 QueryChannelRange_free(this_ptr_conv);
10537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10538 LDKQueryChannelRange orig_conv;
10539 orig_conv.inner = (void*)(orig & (~1));
10540 orig_conv.is_owned = (orig & 1) || (orig == 0);
10541 LDKQueryChannelRange ret_var = QueryChannelRange_clone(&orig_conv);
10542 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10543 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10544 long ret_ref = (long)ret_var.inner;
10545 if (ret_var.is_owned) {
10551 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10552 LDKQueryChannelRange this_ptr_conv;
10553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10555 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10556 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
10560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10561 LDKQueryChannelRange this_ptr_conv;
10562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10564 LDKThirtyTwoBytes val_ref;
10565 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10566 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10567 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10570 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10571 LDKQueryChannelRange this_ptr_conv;
10572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10574 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
10578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10579 LDKQueryChannelRange this_ptr_conv;
10580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10582 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
10585 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10586 LDKQueryChannelRange this_ptr_conv;
10587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10589 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
10593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10594 LDKQueryChannelRange this_ptr_conv;
10595 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10596 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10597 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10600 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) {
10601 LDKThirtyTwoBytes chain_hash_arg_ref;
10602 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10603 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10604 LDKQueryChannelRange ret_var = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
10605 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10606 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10607 long ret_ref = (long)ret_var.inner;
10608 if (ret_var.is_owned) {
10614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10615 LDKReplyChannelRange this_ptr_conv;
10616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10618 ReplyChannelRange_free(this_ptr_conv);
10621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10622 LDKReplyChannelRange orig_conv;
10623 orig_conv.inner = (void*)(orig & (~1));
10624 orig_conv.is_owned = (orig & 1) || (orig == 0);
10625 LDKReplyChannelRange ret_var = ReplyChannelRange_clone(&orig_conv);
10626 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10627 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10628 long ret_ref = (long)ret_var.inner;
10629 if (ret_var.is_owned) {
10635 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10636 LDKReplyChannelRange this_ptr_conv;
10637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10639 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10640 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
10644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10645 LDKReplyChannelRange this_ptr_conv;
10646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10648 LDKThirtyTwoBytes val_ref;
10649 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10650 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10651 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
10654 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
10655 LDKReplyChannelRange this_ptr_conv;
10656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10658 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
10662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10663 LDKReplyChannelRange this_ptr_conv;
10664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10666 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
10669 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
10670 LDKReplyChannelRange this_ptr_conv;
10671 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10672 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10673 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
10677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10678 LDKReplyChannelRange this_ptr_conv;
10679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10681 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
10684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10685 LDKReplyChannelRange this_ptr_conv;
10686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10688 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
10692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10693 LDKReplyChannelRange this_ptr_conv;
10694 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10695 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10696 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
10699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10700 LDKReplyChannelRange this_ptr_conv;
10701 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10702 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10703 LDKCVec_u64Z val_constr;
10704 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10705 if (val_constr.datalen > 0)
10706 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10708 val_constr.data = NULL;
10709 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10710 for (size_t g = 0; g < val_constr.datalen; g++) {
10711 long arr_conv_6 = val_vals[g];
10712 val_constr.data[g] = arr_conv_6;
10714 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10715 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
10718 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) {
10719 LDKThirtyTwoBytes chain_hash_arg_ref;
10720 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10721 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10722 LDKCVec_u64Z short_channel_ids_arg_constr;
10723 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10724 if (short_channel_ids_arg_constr.datalen > 0)
10725 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10727 short_channel_ids_arg_constr.data = NULL;
10728 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10729 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10730 long arr_conv_6 = short_channel_ids_arg_vals[g];
10731 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10733 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10734 LDKReplyChannelRange ret_var = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
10735 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10736 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10737 long ret_ref = (long)ret_var.inner;
10738 if (ret_var.is_owned) {
10744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10745 LDKQueryShortChannelIds this_ptr_conv;
10746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10748 QueryShortChannelIds_free(this_ptr_conv);
10751 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10752 LDKQueryShortChannelIds orig_conv;
10753 orig_conv.inner = (void*)(orig & (~1));
10754 orig_conv.is_owned = (orig & 1) || (orig == 0);
10755 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_clone(&orig_conv);
10756 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10757 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10758 long ret_ref = (long)ret_var.inner;
10759 if (ret_var.is_owned) {
10765 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10766 LDKQueryShortChannelIds this_ptr_conv;
10767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10769 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10770 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
10774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10775 LDKQueryShortChannelIds this_ptr_conv;
10776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10778 LDKThirtyTwoBytes val_ref;
10779 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10780 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10781 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
10784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10785 LDKQueryShortChannelIds this_ptr_conv;
10786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10788 LDKCVec_u64Z val_constr;
10789 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10790 if (val_constr.datalen > 0)
10791 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10793 val_constr.data = NULL;
10794 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10795 for (size_t g = 0; g < val_constr.datalen; g++) {
10796 long arr_conv_6 = val_vals[g];
10797 val_constr.data[g] = arr_conv_6;
10799 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10800 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10804 LDKThirtyTwoBytes chain_hash_arg_ref;
10805 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10806 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10807 LDKCVec_u64Z short_channel_ids_arg_constr;
10808 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10809 if (short_channel_ids_arg_constr.datalen > 0)
10810 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10812 short_channel_ids_arg_constr.data = NULL;
10813 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10814 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10815 long arr_conv_6 = short_channel_ids_arg_vals[g];
10816 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10818 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10819 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10820 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10821 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10822 long ret_ref = (long)ret_var.inner;
10823 if (ret_var.is_owned) {
10829 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10830 LDKReplyShortChannelIdsEnd this_ptr_conv;
10831 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10832 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10833 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10837 LDKReplyShortChannelIdsEnd orig_conv;
10838 orig_conv.inner = (void*)(orig & (~1));
10839 orig_conv.is_owned = (orig & 1) || (orig == 0);
10840 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_clone(&orig_conv);
10841 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10842 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10843 long ret_ref = (long)ret_var.inner;
10844 if (ret_var.is_owned) {
10850 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10851 LDKReplyShortChannelIdsEnd this_ptr_conv;
10852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10854 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10855 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10860 LDKReplyShortChannelIdsEnd this_ptr_conv;
10861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10863 LDKThirtyTwoBytes val_ref;
10864 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10865 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10866 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10869 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10870 LDKReplyShortChannelIdsEnd this_ptr_conv;
10871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10873 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10878 LDKReplyShortChannelIdsEnd this_ptr_conv;
10879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10881 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10884 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10885 LDKThirtyTwoBytes chain_hash_arg_ref;
10886 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10887 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10888 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10889 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10890 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10891 long ret_ref = (long)ret_var.inner;
10892 if (ret_var.is_owned) {
10898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10899 LDKGossipTimestampFilter this_ptr_conv;
10900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10902 GossipTimestampFilter_free(this_ptr_conv);
10905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10906 LDKGossipTimestampFilter orig_conv;
10907 orig_conv.inner = (void*)(orig & (~1));
10908 orig_conv.is_owned = (orig & 1) || (orig == 0);
10909 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_clone(&orig_conv);
10910 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10911 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10912 long ret_ref = (long)ret_var.inner;
10913 if (ret_var.is_owned) {
10919 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10920 LDKGossipTimestampFilter this_ptr_conv;
10921 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10922 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10923 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10924 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10928 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10929 LDKGossipTimestampFilter this_ptr_conv;
10930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10931 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10932 LDKThirtyTwoBytes val_ref;
10933 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10934 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10935 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10938 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10939 LDKGossipTimestampFilter this_ptr_conv;
10940 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10941 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10942 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10947 LDKGossipTimestampFilter this_ptr_conv;
10948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10950 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10953 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10954 LDKGossipTimestampFilter this_ptr_conv;
10955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10956 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10957 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10962 LDKGossipTimestampFilter this_ptr_conv;
10963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10965 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10968 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) {
10969 LDKThirtyTwoBytes chain_hash_arg_ref;
10970 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10971 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10972 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10973 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
10974 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
10975 long ret_ref = (long)ret_var.inner;
10976 if (ret_var.is_owned) {
10982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10983 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10984 FREE((void*)this_ptr);
10985 ErrorAction_free(this_ptr_conv);
10988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10989 LDKErrorAction* orig_conv = (LDKErrorAction*)orig;
10990 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10991 *ret_copy = ErrorAction_clone(orig_conv);
10992 long ret_ref = (long)ret_copy;
10996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10997 LDKLightningError this_ptr_conv;
10998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11000 LightningError_free(this_ptr_conv);
11003 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
11004 LDKLightningError this_ptr_conv;
11005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11007 LDKStr _str = LightningError_get_err(&this_ptr_conv);
11008 char* _buf = MALLOC(_str.len + 1, "str conv buf");
11009 memcpy(_buf, _str.chars, _str.len);
11010 _buf[_str.len] = 0;
11011 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
11016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11017 LDKLightningError this_ptr_conv;
11018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11020 LDKCVec_u8Z val_ref;
11021 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
11022 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
11023 LightningError_set_err(&this_ptr_conv, val_ref);
11024 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
11027 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
11028 LDKLightningError this_ptr_conv;
11029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11031 LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
11032 *ret_copy = LightningError_get_action(&this_ptr_conv);
11033 long ret_ref = (long)ret_copy;
11037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11038 LDKLightningError this_ptr_conv;
11039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11041 LDKErrorAction val_conv = *(LDKErrorAction*)val;
11043 LightningError_set_action(&this_ptr_conv, val_conv);
11046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
11047 LDKCVec_u8Z err_arg_ref;
11048 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
11049 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
11050 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
11051 FREE((void*)action_arg);
11052 LDKLightningError ret_var = LightningError_new(err_arg_ref, action_arg_conv);
11053 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11054 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11055 long ret_ref = (long)ret_var.inner;
11056 if (ret_var.is_owned) {
11059 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
11063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11064 LDKCommitmentUpdate this_ptr_conv;
11065 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11066 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11067 CommitmentUpdate_free(this_ptr_conv);
11070 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11071 LDKCommitmentUpdate orig_conv;
11072 orig_conv.inner = (void*)(orig & (~1));
11073 orig_conv.is_owned = (orig & 1) || (orig == 0);
11074 LDKCommitmentUpdate ret_var = CommitmentUpdate_clone(&orig_conv);
11075 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11076 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11077 long ret_ref = (long)ret_var.inner;
11078 if (ret_var.is_owned) {
11084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11085 LDKCommitmentUpdate this_ptr_conv;
11086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11088 LDKCVec_UpdateAddHTLCZ val_constr;
11089 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11090 if (val_constr.datalen > 0)
11091 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11093 val_constr.data = NULL;
11094 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11095 for (size_t p = 0; p < val_constr.datalen; p++) {
11096 long arr_conv_15 = val_vals[p];
11097 LDKUpdateAddHTLC arr_conv_15_conv;
11098 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11099 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11100 if (arr_conv_15_conv.inner != NULL)
11101 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11102 val_constr.data[p] = arr_conv_15_conv;
11104 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11105 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
11108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11109 LDKCommitmentUpdate this_ptr_conv;
11110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11112 LDKCVec_UpdateFulfillHTLCZ val_constr;
11113 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11114 if (val_constr.datalen > 0)
11115 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11117 val_constr.data = NULL;
11118 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11119 for (size_t t = 0; t < val_constr.datalen; t++) {
11120 long arr_conv_19 = val_vals[t];
11121 LDKUpdateFulfillHTLC arr_conv_19_conv;
11122 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11123 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11124 if (arr_conv_19_conv.inner != NULL)
11125 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11126 val_constr.data[t] = arr_conv_19_conv;
11128 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11129 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
11132 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11133 LDKCommitmentUpdate this_ptr_conv;
11134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11136 LDKCVec_UpdateFailHTLCZ val_constr;
11137 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11138 if (val_constr.datalen > 0)
11139 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11141 val_constr.data = NULL;
11142 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11143 for (size_t q = 0; q < val_constr.datalen; q++) {
11144 long arr_conv_16 = val_vals[q];
11145 LDKUpdateFailHTLC arr_conv_16_conv;
11146 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11147 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11148 if (arr_conv_16_conv.inner != NULL)
11149 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11150 val_constr.data[q] = arr_conv_16_conv;
11152 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11153 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
11156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11157 LDKCommitmentUpdate this_ptr_conv;
11158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11160 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
11161 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11162 if (val_constr.datalen > 0)
11163 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11165 val_constr.data = NULL;
11166 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11167 for (size_t z = 0; z < val_constr.datalen; z++) {
11168 long arr_conv_25 = val_vals[z];
11169 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11170 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11171 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11172 if (arr_conv_25_conv.inner != NULL)
11173 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11174 val_constr.data[z] = arr_conv_25_conv;
11176 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11177 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
11180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
11181 LDKCommitmentUpdate this_ptr_conv;
11182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11184 LDKUpdateFee ret_var = CommitmentUpdate_get_update_fee(&this_ptr_conv);
11185 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11186 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11187 long ret_ref = (long)ret_var.inner;
11188 if (ret_var.is_owned) {
11194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11195 LDKCommitmentUpdate this_ptr_conv;
11196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11197 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11198 LDKUpdateFee val_conv;
11199 val_conv.inner = (void*)(val & (~1));
11200 val_conv.is_owned = (val & 1) || (val == 0);
11201 if (val_conv.inner != NULL)
11202 val_conv = UpdateFee_clone(&val_conv);
11203 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
11206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
11207 LDKCommitmentUpdate this_ptr_conv;
11208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11210 LDKCommitmentSigned ret_var = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
11211 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11212 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11213 long ret_ref = (long)ret_var.inner;
11214 if (ret_var.is_owned) {
11220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11221 LDKCommitmentUpdate this_ptr_conv;
11222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11224 LDKCommitmentSigned val_conv;
11225 val_conv.inner = (void*)(val & (~1));
11226 val_conv.is_owned = (val & 1) || (val == 0);
11227 if (val_conv.inner != NULL)
11228 val_conv = CommitmentSigned_clone(&val_conv);
11229 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
11232 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) {
11233 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
11234 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
11235 if (update_add_htlcs_arg_constr.datalen > 0)
11236 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
11238 update_add_htlcs_arg_constr.data = NULL;
11239 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
11240 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
11241 long arr_conv_15 = update_add_htlcs_arg_vals[p];
11242 LDKUpdateAddHTLC arr_conv_15_conv;
11243 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
11244 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
11245 if (arr_conv_15_conv.inner != NULL)
11246 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
11247 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
11249 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
11250 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
11251 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
11252 if (update_fulfill_htlcs_arg_constr.datalen > 0)
11253 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
11255 update_fulfill_htlcs_arg_constr.data = NULL;
11256 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
11257 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
11258 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
11259 LDKUpdateFulfillHTLC arr_conv_19_conv;
11260 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
11261 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
11262 if (arr_conv_19_conv.inner != NULL)
11263 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
11264 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
11266 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
11267 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
11268 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
11269 if (update_fail_htlcs_arg_constr.datalen > 0)
11270 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
11272 update_fail_htlcs_arg_constr.data = NULL;
11273 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
11274 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
11275 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
11276 LDKUpdateFailHTLC arr_conv_16_conv;
11277 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
11278 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
11279 if (arr_conv_16_conv.inner != NULL)
11280 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
11281 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
11283 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
11284 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
11285 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
11286 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
11287 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
11289 update_fail_malformed_htlcs_arg_constr.data = NULL;
11290 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
11291 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
11292 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
11293 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
11294 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
11295 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
11296 if (arr_conv_25_conv.inner != NULL)
11297 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
11298 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
11300 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
11301 LDKUpdateFee update_fee_arg_conv;
11302 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
11303 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
11304 if (update_fee_arg_conv.inner != NULL)
11305 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
11306 LDKCommitmentSigned commitment_signed_arg_conv;
11307 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
11308 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
11309 if (commitment_signed_arg_conv.inner != NULL)
11310 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
11311 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);
11312 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11313 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11314 long ret_ref = (long)ret_var.inner;
11315 if (ret_var.is_owned) {
11321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11322 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
11323 FREE((void*)this_ptr);
11324 HTLCFailChannelUpdate_free(this_ptr_conv);
11327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11328 LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
11329 LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
11330 *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
11331 long ret_ref = (long)ret_copy;
11335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11336 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
11337 FREE((void*)this_ptr);
11338 ChannelMessageHandler_free(this_ptr_conv);
11341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11342 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
11343 FREE((void*)this_ptr);
11344 RoutingMessageHandler_free(this_ptr_conv);
11347 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11348 LDKAcceptChannel obj_conv;
11349 obj_conv.inner = (void*)(obj & (~1));
11350 obj_conv.is_owned = (obj & 1) || (obj == 0);
11351 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
11352 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11353 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11354 CVec_u8Z_free(arg_var);
11358 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11359 LDKu8slice ser_ref;
11360 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11361 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11362 LDKAcceptChannel ret_var = AcceptChannel_read(ser_ref);
11363 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11364 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11365 long ret_ref = (long)ret_var.inner;
11366 if (ret_var.is_owned) {
11369 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11373 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
11374 LDKAnnouncementSignatures obj_conv;
11375 obj_conv.inner = (void*)(obj & (~1));
11376 obj_conv.is_owned = (obj & 1) || (obj == 0);
11377 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
11378 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11379 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11380 CVec_u8Z_free(arg_var);
11384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11385 LDKu8slice ser_ref;
11386 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11387 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11388 LDKAnnouncementSignatures ret_var = AnnouncementSignatures_read(ser_ref);
11389 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11390 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11391 long ret_ref = (long)ret_var.inner;
11392 if (ret_var.is_owned) {
11395 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11399 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
11400 LDKChannelReestablish obj_conv;
11401 obj_conv.inner = (void*)(obj & (~1));
11402 obj_conv.is_owned = (obj & 1) || (obj == 0);
11403 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
11404 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11405 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11406 CVec_u8Z_free(arg_var);
11410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11411 LDKu8slice ser_ref;
11412 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11413 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11414 LDKChannelReestablish ret_var = ChannelReestablish_read(ser_ref);
11415 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11416 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11417 long ret_ref = (long)ret_var.inner;
11418 if (ret_var.is_owned) {
11421 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11425 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11426 LDKClosingSigned obj_conv;
11427 obj_conv.inner = (void*)(obj & (~1));
11428 obj_conv.is_owned = (obj & 1) || (obj == 0);
11429 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
11430 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11431 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11432 CVec_u8Z_free(arg_var);
11436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11437 LDKu8slice ser_ref;
11438 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11439 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11440 LDKClosingSigned ret_var = ClosingSigned_read(ser_ref);
11441 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11442 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11443 long ret_ref = (long)ret_var.inner;
11444 if (ret_var.is_owned) {
11447 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11451 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11452 LDKCommitmentSigned obj_conv;
11453 obj_conv.inner = (void*)(obj & (~1));
11454 obj_conv.is_owned = (obj & 1) || (obj == 0);
11455 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
11456 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11457 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11458 CVec_u8Z_free(arg_var);
11462 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11463 LDKu8slice ser_ref;
11464 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11465 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11466 LDKCommitmentSigned ret_var = CommitmentSigned_read(ser_ref);
11467 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11468 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11469 long ret_ref = (long)ret_var.inner;
11470 if (ret_var.is_owned) {
11473 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11477 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
11478 LDKFundingCreated obj_conv;
11479 obj_conv.inner = (void*)(obj & (~1));
11480 obj_conv.is_owned = (obj & 1) || (obj == 0);
11481 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
11482 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11483 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11484 CVec_u8Z_free(arg_var);
11488 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11489 LDKu8slice ser_ref;
11490 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11491 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11492 LDKFundingCreated ret_var = FundingCreated_read(ser_ref);
11493 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11494 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11495 long ret_ref = (long)ret_var.inner;
11496 if (ret_var.is_owned) {
11499 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11503 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
11504 LDKFundingSigned obj_conv;
11505 obj_conv.inner = (void*)(obj & (~1));
11506 obj_conv.is_owned = (obj & 1) || (obj == 0);
11507 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
11508 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11509 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11510 CVec_u8Z_free(arg_var);
11514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11515 LDKu8slice ser_ref;
11516 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11517 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11518 LDKFundingSigned ret_var = FundingSigned_read(ser_ref);
11519 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11520 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11521 long ret_ref = (long)ret_var.inner;
11522 if (ret_var.is_owned) {
11525 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11529 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
11530 LDKFundingLocked obj_conv;
11531 obj_conv.inner = (void*)(obj & (~1));
11532 obj_conv.is_owned = (obj & 1) || (obj == 0);
11533 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
11534 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11535 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11536 CVec_u8Z_free(arg_var);
11540 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11541 LDKu8slice ser_ref;
11542 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11543 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11544 LDKFundingLocked ret_var = FundingLocked_read(ser_ref);
11545 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11546 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11547 long ret_ref = (long)ret_var.inner;
11548 if (ret_var.is_owned) {
11551 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11555 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
11557 obj_conv.inner = (void*)(obj & (~1));
11558 obj_conv.is_owned = (obj & 1) || (obj == 0);
11559 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
11560 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11561 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11562 CVec_u8Z_free(arg_var);
11566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11567 LDKu8slice ser_ref;
11568 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11569 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11570 LDKInit ret_var = Init_read(ser_ref);
11571 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11572 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11573 long ret_ref = (long)ret_var.inner;
11574 if (ret_var.is_owned) {
11577 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11581 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
11582 LDKOpenChannel obj_conv;
11583 obj_conv.inner = (void*)(obj & (~1));
11584 obj_conv.is_owned = (obj & 1) || (obj == 0);
11585 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
11586 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11587 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11588 CVec_u8Z_free(arg_var);
11592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11593 LDKu8slice ser_ref;
11594 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11595 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11596 LDKOpenChannel ret_var = OpenChannel_read(ser_ref);
11597 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11598 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11599 long ret_ref = (long)ret_var.inner;
11600 if (ret_var.is_owned) {
11603 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11607 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
11608 LDKRevokeAndACK obj_conv;
11609 obj_conv.inner = (void*)(obj & (~1));
11610 obj_conv.is_owned = (obj & 1) || (obj == 0);
11611 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
11612 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11613 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11614 CVec_u8Z_free(arg_var);
11618 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11619 LDKu8slice ser_ref;
11620 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11621 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11622 LDKRevokeAndACK ret_var = RevokeAndACK_read(ser_ref);
11623 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11624 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11625 long ret_ref = (long)ret_var.inner;
11626 if (ret_var.is_owned) {
11629 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11633 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
11634 LDKShutdown obj_conv;
11635 obj_conv.inner = (void*)(obj & (~1));
11636 obj_conv.is_owned = (obj & 1) || (obj == 0);
11637 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
11638 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11639 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11640 CVec_u8Z_free(arg_var);
11644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11645 LDKu8slice ser_ref;
11646 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11647 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11648 LDKShutdown ret_var = Shutdown_read(ser_ref);
11649 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11650 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11651 long ret_ref = (long)ret_var.inner;
11652 if (ret_var.is_owned) {
11655 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11659 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11660 LDKUpdateFailHTLC obj_conv;
11661 obj_conv.inner = (void*)(obj & (~1));
11662 obj_conv.is_owned = (obj & 1) || (obj == 0);
11663 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
11664 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11665 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11666 CVec_u8Z_free(arg_var);
11670 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11671 LDKu8slice ser_ref;
11672 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11673 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11674 LDKUpdateFailHTLC ret_var = UpdateFailHTLC_read(ser_ref);
11675 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11676 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11677 long ret_ref = (long)ret_var.inner;
11678 if (ret_var.is_owned) {
11681 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11685 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11686 LDKUpdateFailMalformedHTLC obj_conv;
11687 obj_conv.inner = (void*)(obj & (~1));
11688 obj_conv.is_owned = (obj & 1) || (obj == 0);
11689 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
11690 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11691 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11692 CVec_u8Z_free(arg_var);
11696 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11697 LDKu8slice ser_ref;
11698 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11699 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11700 LDKUpdateFailMalformedHTLC ret_var = UpdateFailMalformedHTLC_read(ser_ref);
11701 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11702 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11703 long ret_ref = (long)ret_var.inner;
11704 if (ret_var.is_owned) {
11707 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11711 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
11712 LDKUpdateFee obj_conv;
11713 obj_conv.inner = (void*)(obj & (~1));
11714 obj_conv.is_owned = (obj & 1) || (obj == 0);
11715 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
11716 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11717 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11718 CVec_u8Z_free(arg_var);
11722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11723 LDKu8slice ser_ref;
11724 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11725 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11726 LDKUpdateFee ret_var = UpdateFee_read(ser_ref);
11727 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11728 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11729 long ret_ref = (long)ret_var.inner;
11730 if (ret_var.is_owned) {
11733 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11737 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11738 LDKUpdateFulfillHTLC obj_conv;
11739 obj_conv.inner = (void*)(obj & (~1));
11740 obj_conv.is_owned = (obj & 1) || (obj == 0);
11741 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
11742 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11743 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11744 CVec_u8Z_free(arg_var);
11748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11749 LDKu8slice ser_ref;
11750 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11751 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11752 LDKUpdateFulfillHTLC ret_var = UpdateFulfillHTLC_read(ser_ref);
11753 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11754 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11755 long ret_ref = (long)ret_var.inner;
11756 if (ret_var.is_owned) {
11759 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11763 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
11764 LDKUpdateAddHTLC obj_conv;
11765 obj_conv.inner = (void*)(obj & (~1));
11766 obj_conv.is_owned = (obj & 1) || (obj == 0);
11767 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
11768 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11769 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11770 CVec_u8Z_free(arg_var);
11774 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11775 LDKu8slice ser_ref;
11776 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11777 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11778 LDKUpdateAddHTLC ret_var = UpdateAddHTLC_read(ser_ref);
11779 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11780 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11781 long ret_ref = (long)ret_var.inner;
11782 if (ret_var.is_owned) {
11785 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11789 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
11791 obj_conv.inner = (void*)(obj & (~1));
11792 obj_conv.is_owned = (obj & 1) || (obj == 0);
11793 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
11794 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11795 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11796 CVec_u8Z_free(arg_var);
11800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11801 LDKu8slice ser_ref;
11802 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11803 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11804 LDKPing ret_var = Ping_read(ser_ref);
11805 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11806 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11807 long ret_ref = (long)ret_var.inner;
11808 if (ret_var.is_owned) {
11811 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11815 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
11817 obj_conv.inner = (void*)(obj & (~1));
11818 obj_conv.is_owned = (obj & 1) || (obj == 0);
11819 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
11820 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11821 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11822 CVec_u8Z_free(arg_var);
11826 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11827 LDKu8slice ser_ref;
11828 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11829 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11830 LDKPong ret_var = Pong_read(ser_ref);
11831 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11832 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11833 long ret_ref = (long)ret_var.inner;
11834 if (ret_var.is_owned) {
11837 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11841 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11842 LDKUnsignedChannelAnnouncement obj_conv;
11843 obj_conv.inner = (void*)(obj & (~1));
11844 obj_conv.is_owned = (obj & 1) || (obj == 0);
11845 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
11846 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11847 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11848 CVec_u8Z_free(arg_var);
11852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11853 LDKu8slice ser_ref;
11854 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11855 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11856 LDKUnsignedChannelAnnouncement ret_var = UnsignedChannelAnnouncement_read(ser_ref);
11857 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11858 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11859 long ret_ref = (long)ret_var.inner;
11860 if (ret_var.is_owned) {
11863 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11867 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11868 LDKChannelAnnouncement obj_conv;
11869 obj_conv.inner = (void*)(obj & (~1));
11870 obj_conv.is_owned = (obj & 1) || (obj == 0);
11871 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
11872 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11873 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11874 CVec_u8Z_free(arg_var);
11878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11879 LDKu8slice ser_ref;
11880 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11881 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11882 LDKChannelAnnouncement ret_var = ChannelAnnouncement_read(ser_ref);
11883 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11884 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11885 long ret_ref = (long)ret_var.inner;
11886 if (ret_var.is_owned) {
11889 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11893 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11894 LDKUnsignedChannelUpdate obj_conv;
11895 obj_conv.inner = (void*)(obj & (~1));
11896 obj_conv.is_owned = (obj & 1) || (obj == 0);
11897 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
11898 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11899 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11900 CVec_u8Z_free(arg_var);
11904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11905 LDKu8slice ser_ref;
11906 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11907 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11908 LDKUnsignedChannelUpdate ret_var = UnsignedChannelUpdate_read(ser_ref);
11909 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11910 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11911 long ret_ref = (long)ret_var.inner;
11912 if (ret_var.is_owned) {
11915 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11919 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
11920 LDKChannelUpdate obj_conv;
11921 obj_conv.inner = (void*)(obj & (~1));
11922 obj_conv.is_owned = (obj & 1) || (obj == 0);
11923 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
11924 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11925 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11926 CVec_u8Z_free(arg_var);
11930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11931 LDKu8slice ser_ref;
11932 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11933 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11934 LDKChannelUpdate ret_var = ChannelUpdate_read(ser_ref);
11935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11937 long ret_ref = (long)ret_var.inner;
11938 if (ret_var.is_owned) {
11941 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11945 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
11946 LDKErrorMessage obj_conv;
11947 obj_conv.inner = (void*)(obj & (~1));
11948 obj_conv.is_owned = (obj & 1) || (obj == 0);
11949 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
11950 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11951 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11952 CVec_u8Z_free(arg_var);
11956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11957 LDKu8slice ser_ref;
11958 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11959 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11960 LDKErrorMessage ret_var = ErrorMessage_read(ser_ref);
11961 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11962 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11963 long ret_ref = (long)ret_var.inner;
11964 if (ret_var.is_owned) {
11967 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11971 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11972 LDKUnsignedNodeAnnouncement obj_conv;
11973 obj_conv.inner = (void*)(obj & (~1));
11974 obj_conv.is_owned = (obj & 1) || (obj == 0);
11975 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
11976 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11977 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11978 CVec_u8Z_free(arg_var);
11982 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11983 LDKu8slice ser_ref;
11984 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11985 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11986 LDKUnsignedNodeAnnouncement ret_var = UnsignedNodeAnnouncement_read(ser_ref);
11987 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
11988 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
11989 long ret_ref = (long)ret_var.inner;
11990 if (ret_var.is_owned) {
11993 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11997 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
11998 LDKNodeAnnouncement obj_conv;
11999 obj_conv.inner = (void*)(obj & (~1));
12000 obj_conv.is_owned = (obj & 1) || (obj == 0);
12001 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
12002 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12003 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12004 CVec_u8Z_free(arg_var);
12008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12009 LDKu8slice ser_ref;
12010 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12011 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12012 LDKNodeAnnouncement ret_var = NodeAnnouncement_read(ser_ref);
12013 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12014 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12015 long ret_ref = (long)ret_var.inner;
12016 if (ret_var.is_owned) {
12019 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12024 LDKu8slice ser_ref;
12025 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12026 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12027 LDKQueryShortChannelIds ret_var = QueryShortChannelIds_read(ser_ref);
12028 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12029 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12030 long ret_ref = (long)ret_var.inner;
12031 if (ret_var.is_owned) {
12034 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12038 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
12039 LDKQueryShortChannelIds obj_conv;
12040 obj_conv.inner = (void*)(obj & (~1));
12041 obj_conv.is_owned = (obj & 1) || (obj == 0);
12042 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
12043 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12044 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12045 CVec_u8Z_free(arg_var);
12049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12050 LDKu8slice ser_ref;
12051 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12052 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12053 LDKReplyShortChannelIdsEnd ret_var = ReplyShortChannelIdsEnd_read(ser_ref);
12054 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12055 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12056 long ret_ref = (long)ret_var.inner;
12057 if (ret_var.is_owned) {
12060 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12064 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
12065 LDKReplyShortChannelIdsEnd obj_conv;
12066 obj_conv.inner = (void*)(obj & (~1));
12067 obj_conv.is_owned = (obj & 1) || (obj == 0);
12068 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
12069 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12070 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12071 CVec_u8Z_free(arg_var);
12075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12076 LDKu8slice ser_ref;
12077 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12078 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12079 LDKQueryChannelRange ret_var = QueryChannelRange_read(ser_ref);
12080 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12081 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12082 long ret_ref = (long)ret_var.inner;
12083 if (ret_var.is_owned) {
12086 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12090 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12091 LDKQueryChannelRange obj_conv;
12092 obj_conv.inner = (void*)(obj & (~1));
12093 obj_conv.is_owned = (obj & 1) || (obj == 0);
12094 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
12095 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12096 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12097 CVec_u8Z_free(arg_var);
12101 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12102 LDKu8slice ser_ref;
12103 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12104 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12105 LDKReplyChannelRange ret_var = ReplyChannelRange_read(ser_ref);
12106 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12107 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12108 long ret_ref = (long)ret_var.inner;
12109 if (ret_var.is_owned) {
12112 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12116 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
12117 LDKReplyChannelRange obj_conv;
12118 obj_conv.inner = (void*)(obj & (~1));
12119 obj_conv.is_owned = (obj & 1) || (obj == 0);
12120 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
12121 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12122 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12123 CVec_u8Z_free(arg_var);
12127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12128 LDKu8slice ser_ref;
12129 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12130 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12131 LDKGossipTimestampFilter ret_var = GossipTimestampFilter_read(ser_ref);
12132 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12133 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12134 long ret_ref = (long)ret_var.inner;
12135 if (ret_var.is_owned) {
12138 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12142 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
12143 LDKGossipTimestampFilter obj_conv;
12144 obj_conv.inner = (void*)(obj & (~1));
12145 obj_conv.is_owned = (obj & 1) || (obj == 0);
12146 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
12147 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12148 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12149 CVec_u8Z_free(arg_var);
12153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12154 LDKMessageHandler this_ptr_conv;
12155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12157 MessageHandler_free(this_ptr_conv);
12160 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12161 LDKMessageHandler this_ptr_conv;
12162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12164 long ret_ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
12168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12169 LDKMessageHandler this_ptr_conv;
12170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12171 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12172 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
12173 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
12174 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12175 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
12177 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
12180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
12181 LDKMessageHandler this_ptr_conv;
12182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12184 long ret_ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
12188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12189 LDKMessageHandler this_ptr_conv;
12190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12192 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
12193 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12194 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12195 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
12197 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
12200 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
12201 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
12202 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
12203 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12204 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
12206 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
12207 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
12208 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12209 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
12211 LDKMessageHandler ret_var = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
12212 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12213 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12214 long ret_ref = (long)ret_var.inner;
12215 if (ret_var.is_owned) {
12221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12222 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
12223 FREE((void*)this_ptr);
12224 SocketDescriptor_free(this_ptr_conv);
12227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12228 LDKPeerHandleError this_ptr_conv;
12229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12231 PeerHandleError_free(this_ptr_conv);
12234 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
12235 LDKPeerHandleError this_ptr_conv;
12236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12238 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
12242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12243 LDKPeerHandleError this_ptr_conv;
12244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12245 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12246 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
12249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
12250 LDKPeerHandleError ret_var = PeerHandleError_new(no_connection_possible_arg);
12251 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12252 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12253 long ret_ref = (long)ret_var.inner;
12254 if (ret_var.is_owned) {
12260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12261 LDKPeerManager this_ptr_conv;
12262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12264 PeerManager_free(this_ptr_conv);
12267 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) {
12268 LDKMessageHandler message_handler_conv;
12269 message_handler_conv.inner = (void*)(message_handler & (~1));
12270 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
12271 // Warning: we may need a move here but can't clone!
12272 LDKSecretKey our_node_secret_ref;
12273 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
12274 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
12275 unsigned char ephemeral_random_data_arr[32];
12276 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
12277 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
12278 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
12279 LDKLogger logger_conv = *(LDKLogger*)logger;
12280 if (logger_conv.free == LDKLogger_JCalls_free) {
12281 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12282 LDKLogger_JCalls_clone(logger_conv.this_arg);
12284 LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
12285 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12286 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12287 long ret_ref = (long)ret_var.inner;
12288 if (ret_var.is_owned) {
12294 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
12295 LDKPeerManager this_arg_conv;
12296 this_arg_conv.inner = (void*)(this_arg & (~1));
12297 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12298 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
12299 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, arr_of_B_clz, NULL);
12300 for (size_t i = 0; i < ret_var.datalen; i++) {
12301 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
12302 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
12303 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);
12305 CVec_PublicKeyZ_free(ret_var);
12309 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) {
12310 LDKPeerManager this_arg_conv;
12311 this_arg_conv.inner = (void*)(this_arg & (~1));
12312 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12313 LDKPublicKey their_node_id_ref;
12314 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
12315 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
12316 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12317 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12318 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12319 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12321 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
12322 *ret_conv = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
12323 return (long)ret_conv;
12326 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12327 LDKPeerManager this_arg_conv;
12328 this_arg_conv.inner = (void*)(this_arg & (~1));
12329 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12330 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
12331 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
12332 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12333 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
12335 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12336 *ret_conv = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
12337 return (long)ret_conv;
12340 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12341 LDKPeerManager this_arg_conv;
12342 this_arg_conv.inner = (void*)(this_arg & (~1));
12343 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12344 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12345 LDKCResult_NonePeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
12346 *ret_conv = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
12347 return (long)ret_conv;
12350 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
12351 LDKPeerManager this_arg_conv;
12352 this_arg_conv.inner = (void*)(this_arg & (~1));
12353 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12354 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
12355 LDKu8slice data_ref;
12356 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
12357 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
12358 LDKCResult_boolPeerHandleErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
12359 *ret_conv = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
12360 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
12361 return (long)ret_conv;
12364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
12365 LDKPeerManager this_arg_conv;
12366 this_arg_conv.inner = (void*)(this_arg & (~1));
12367 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12368 PeerManager_process_events(&this_arg_conv);
12371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
12372 LDKPeerManager this_arg_conv;
12373 this_arg_conv.inner = (void*)(this_arg & (~1));
12374 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12375 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
12376 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
12379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
12380 LDKPeerManager this_arg_conv;
12381 this_arg_conv.inner = (void*)(this_arg & (~1));
12382 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12383 PeerManager_timer_tick_occured(&this_arg_conv);
12386 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
12387 unsigned char commitment_seed_arr[32];
12388 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
12389 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
12390 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
12391 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
12392 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
12396 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
12397 LDKPublicKey per_commitment_point_ref;
12398 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12399 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12400 unsigned char base_secret_arr[32];
12401 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
12402 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
12403 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
12404 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12405 *ret_conv = derive_private_key(per_commitment_point_ref, base_secret_ref);
12406 return (long)ret_conv;
12409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
12410 LDKPublicKey per_commitment_point_ref;
12411 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12412 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12413 LDKPublicKey base_point_ref;
12414 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
12415 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
12416 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12417 *ret_conv = derive_public_key(per_commitment_point_ref, base_point_ref);
12418 return (long)ret_conv;
12421 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) {
12422 unsigned char per_commitment_secret_arr[32];
12423 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
12424 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
12425 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
12426 unsigned char countersignatory_revocation_base_secret_arr[32];
12427 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
12428 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
12429 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
12430 LDKCResult_SecretKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
12431 *ret_conv = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
12432 return (long)ret_conv;
12435 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) {
12436 LDKPublicKey per_commitment_point_ref;
12437 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12438 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12439 LDKPublicKey countersignatory_revocation_base_point_ref;
12440 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
12441 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
12442 LDKCResult_PublicKeySecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
12443 *ret_conv = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
12444 return (long)ret_conv;
12447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12448 LDKTxCreationKeys this_ptr_conv;
12449 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12450 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12451 TxCreationKeys_free(this_ptr_conv);
12454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12455 LDKTxCreationKeys orig_conv;
12456 orig_conv.inner = (void*)(orig & (~1));
12457 orig_conv.is_owned = (orig & 1) || (orig == 0);
12458 LDKTxCreationKeys ret_var = TxCreationKeys_clone(&orig_conv);
12459 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12460 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12461 long ret_ref = (long)ret_var.inner;
12462 if (ret_var.is_owned) {
12468 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12469 LDKTxCreationKeys this_ptr_conv;
12470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12472 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12473 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
12477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12478 LDKTxCreationKeys this_ptr_conv;
12479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12481 LDKPublicKey val_ref;
12482 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12483 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12484 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
12487 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12488 LDKTxCreationKeys this_ptr_conv;
12489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12491 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12492 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
12496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12497 LDKTxCreationKeys this_ptr_conv;
12498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12500 LDKPublicKey val_ref;
12501 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12502 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12503 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
12506 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12507 LDKTxCreationKeys this_ptr_conv;
12508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12510 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12511 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
12515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12516 LDKTxCreationKeys this_ptr_conv;
12517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12519 LDKPublicKey val_ref;
12520 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12521 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12522 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
12525 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12526 LDKTxCreationKeys this_ptr_conv;
12527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12529 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12530 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
12534 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12535 LDKTxCreationKeys this_ptr_conv;
12536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12538 LDKPublicKey val_ref;
12539 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12540 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12541 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
12544 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
12545 LDKTxCreationKeys this_ptr_conv;
12546 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12547 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12548 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12549 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
12553 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12554 LDKTxCreationKeys this_ptr_conv;
12555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12557 LDKPublicKey val_ref;
12558 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12559 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12560 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
12563 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) {
12564 LDKPublicKey per_commitment_point_arg_ref;
12565 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
12566 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
12567 LDKPublicKey revocation_key_arg_ref;
12568 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
12569 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
12570 LDKPublicKey broadcaster_htlc_key_arg_ref;
12571 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
12572 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
12573 LDKPublicKey countersignatory_htlc_key_arg_ref;
12574 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
12575 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
12576 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
12577 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
12578 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
12579 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);
12580 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12581 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12582 long ret_ref = (long)ret_var.inner;
12583 if (ret_var.is_owned) {
12589 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12590 LDKTxCreationKeys obj_conv;
12591 obj_conv.inner = (void*)(obj & (~1));
12592 obj_conv.is_owned = (obj & 1) || (obj == 0);
12593 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
12594 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12595 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12596 CVec_u8Z_free(arg_var);
12600 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12601 LDKu8slice ser_ref;
12602 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12603 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12604 LDKTxCreationKeys ret_var = TxCreationKeys_read(ser_ref);
12605 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12606 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12607 long ret_ref = (long)ret_var.inner;
12608 if (ret_var.is_owned) {
12611 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12616 LDKPreCalculatedTxCreationKeys this_ptr_conv;
12617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12619 PreCalculatedTxCreationKeys_free(this_ptr_conv);
12622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12623 LDKPreCalculatedTxCreationKeys orig_conv;
12624 orig_conv.inner = (void*)(orig & (~1));
12625 orig_conv.is_owned = (orig & 1) || (orig == 0);
12626 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_clone(&orig_conv);
12627 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12628 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12629 long ret_ref = (long)ret_var.inner;
12630 if (ret_var.is_owned) {
12636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
12637 LDKTxCreationKeys keys_conv;
12638 keys_conv.inner = (void*)(keys & (~1));
12639 keys_conv.is_owned = (keys & 1) || (keys == 0);
12640 if (keys_conv.inner != NULL)
12641 keys_conv = TxCreationKeys_clone(&keys_conv);
12642 LDKPreCalculatedTxCreationKeys ret_var = PreCalculatedTxCreationKeys_new(keys_conv);
12643 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12644 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12645 long ret_ref = (long)ret_var.inner;
12646 if (ret_var.is_owned) {
12652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
12653 LDKPreCalculatedTxCreationKeys this_arg_conv;
12654 this_arg_conv.inner = (void*)(this_arg & (~1));
12655 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12656 LDKTxCreationKeys ret_var = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
12657 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12658 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12659 long ret_ref = (long)ret_var.inner;
12660 if (ret_var.is_owned) {
12666 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
12667 LDKPreCalculatedTxCreationKeys this_arg_conv;
12668 this_arg_conv.inner = (void*)(this_arg & (~1));
12669 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12670 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12671 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
12675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12676 LDKChannelPublicKeys this_ptr_conv;
12677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12679 ChannelPublicKeys_free(this_ptr_conv);
12682 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12683 LDKChannelPublicKeys orig_conv;
12684 orig_conv.inner = (void*)(orig & (~1));
12685 orig_conv.is_owned = (orig & 1) || (orig == 0);
12686 LDKChannelPublicKeys ret_var = ChannelPublicKeys_clone(&orig_conv);
12687 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12688 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12689 long ret_ref = (long)ret_var.inner;
12690 if (ret_var.is_owned) {
12696 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12697 LDKChannelPublicKeys this_ptr_conv;
12698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12700 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12701 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
12705 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12706 LDKChannelPublicKeys this_ptr_conv;
12707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12709 LDKPublicKey val_ref;
12710 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12711 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12712 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
12715 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12716 LDKChannelPublicKeys this_ptr_conv;
12717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12719 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12720 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
12724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12725 LDKChannelPublicKeys this_ptr_conv;
12726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12728 LDKPublicKey val_ref;
12729 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12730 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12731 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
12734 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
12735 LDKChannelPublicKeys this_ptr_conv;
12736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12738 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12739 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
12743 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12744 LDKChannelPublicKeys this_ptr_conv;
12745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12747 LDKPublicKey val_ref;
12748 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12749 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12750 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
12753 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12754 LDKChannelPublicKeys this_ptr_conv;
12755 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12756 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12757 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12758 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
12762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12763 LDKChannelPublicKeys this_ptr_conv;
12764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12766 LDKPublicKey val_ref;
12767 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12768 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12769 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
12772 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
12773 LDKChannelPublicKeys this_ptr_conv;
12774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12776 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12777 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
12781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12782 LDKChannelPublicKeys this_ptr_conv;
12783 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12784 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12785 LDKPublicKey val_ref;
12786 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12787 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12788 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
12791 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) {
12792 LDKPublicKey funding_pubkey_arg_ref;
12793 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
12794 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
12795 LDKPublicKey revocation_basepoint_arg_ref;
12796 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
12797 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
12798 LDKPublicKey payment_point_arg_ref;
12799 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
12800 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
12801 LDKPublicKey delayed_payment_basepoint_arg_ref;
12802 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
12803 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
12804 LDKPublicKey htlc_basepoint_arg_ref;
12805 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
12806 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
12807 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);
12808 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12809 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12810 long ret_ref = (long)ret_var.inner;
12811 if (ret_var.is_owned) {
12817 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
12818 LDKChannelPublicKeys obj_conv;
12819 obj_conv.inner = (void*)(obj & (~1));
12820 obj_conv.is_owned = (obj & 1) || (obj == 0);
12821 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
12822 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12823 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12824 CVec_u8Z_free(arg_var);
12828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12829 LDKu8slice ser_ref;
12830 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12831 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12832 LDKChannelPublicKeys ret_var = ChannelPublicKeys_read(ser_ref);
12833 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12834 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12835 long ret_ref = (long)ret_var.inner;
12836 if (ret_var.is_owned) {
12839 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12843 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) {
12844 LDKPublicKey per_commitment_point_ref;
12845 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
12846 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
12847 LDKPublicKey broadcaster_delayed_payment_base_ref;
12848 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
12849 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
12850 LDKPublicKey broadcaster_htlc_base_ref;
12851 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
12852 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
12853 LDKPublicKey countersignatory_revocation_base_ref;
12854 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
12855 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
12856 LDKPublicKey countersignatory_htlc_base_ref;
12857 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
12858 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
12859 LDKCResult_TxCreationKeysSecpErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
12860 *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);
12861 return (long)ret_conv;
12864 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) {
12865 LDKPublicKey revocation_key_ref;
12866 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
12867 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
12868 LDKPublicKey broadcaster_delayed_payment_key_ref;
12869 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
12870 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
12871 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
12872 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12873 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12874 CVec_u8Z_free(arg_var);
12878 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12879 LDKHTLCOutputInCommitment this_ptr_conv;
12880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12882 HTLCOutputInCommitment_free(this_ptr_conv);
12885 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12886 LDKHTLCOutputInCommitment orig_conv;
12887 orig_conv.inner = (void*)(orig & (~1));
12888 orig_conv.is_owned = (orig & 1) || (orig == 0);
12889 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_clone(&orig_conv);
12890 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12891 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12892 long ret_ref = (long)ret_var.inner;
12893 if (ret_var.is_owned) {
12899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
12900 LDKHTLCOutputInCommitment this_ptr_conv;
12901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12903 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
12907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12908 LDKHTLCOutputInCommitment this_ptr_conv;
12909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12911 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
12914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12915 LDKHTLCOutputInCommitment this_ptr_conv;
12916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12918 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
12922 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12923 LDKHTLCOutputInCommitment this_ptr_conv;
12924 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12925 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12926 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
12929 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
12930 LDKHTLCOutputInCommitment this_ptr_conv;
12931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12933 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
12937 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12938 LDKHTLCOutputInCommitment this_ptr_conv;
12939 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12940 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12941 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
12944 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
12945 LDKHTLCOutputInCommitment this_ptr_conv;
12946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12948 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12949 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
12953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12954 LDKHTLCOutputInCommitment this_ptr_conv;
12955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12956 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12957 LDKThirtyTwoBytes val_ref;
12958 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12959 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12960 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
12963 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
12964 LDKHTLCOutputInCommitment obj_conv;
12965 obj_conv.inner = (void*)(obj & (~1));
12966 obj_conv.is_owned = (obj & 1) || (obj == 0);
12967 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
12968 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12969 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12970 CVec_u8Z_free(arg_var);
12974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12975 LDKu8slice ser_ref;
12976 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12977 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12978 LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_read(ser_ref);
12979 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
12980 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
12981 long ret_ref = (long)ret_var.inner;
12982 if (ret_var.is_owned) {
12985 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12989 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
12990 LDKHTLCOutputInCommitment htlc_conv;
12991 htlc_conv.inner = (void*)(htlc & (~1));
12992 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
12993 LDKTxCreationKeys keys_conv;
12994 keys_conv.inner = (void*)(keys & (~1));
12995 keys_conv.is_owned = (keys & 1) || (keys == 0);
12996 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
12997 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12998 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12999 CVec_u8Z_free(arg_var);
13003 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
13004 LDKPublicKey broadcaster_ref;
13005 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
13006 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
13007 LDKPublicKey countersignatory_ref;
13008 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
13009 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
13010 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
13011 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13012 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13013 CVec_u8Z_free(arg_var);
13017 JNIEXPORT jlong 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) {
13018 unsigned char prev_hash_arr[32];
13019 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
13020 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
13021 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
13022 LDKHTLCOutputInCommitment htlc_conv;
13023 htlc_conv.inner = (void*)(htlc & (~1));
13024 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
13025 LDKPublicKey broadcaster_delayed_payment_key_ref;
13026 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
13027 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
13028 LDKPublicKey revocation_key_ref;
13029 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
13030 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
13031 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
13032 *ret_copy = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
13033 long ret_ref = (long)ret_copy;
13037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13038 LDKHolderCommitmentTransaction this_ptr_conv;
13039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13041 HolderCommitmentTransaction_free(this_ptr_conv);
13044 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13045 LDKHolderCommitmentTransaction orig_conv;
13046 orig_conv.inner = (void*)(orig & (~1));
13047 orig_conv.is_owned = (orig & 1) || (orig == 0);
13048 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_clone(&orig_conv);
13049 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13050 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13051 long ret_ref = (long)ret_var.inner;
13052 if (ret_var.is_owned) {
13058 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
13059 LDKHolderCommitmentTransaction this_ptr_conv;
13060 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13061 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13062 LDKTransaction *ret_copy = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
13063 *ret_copy = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
13064 long ret_ref = (long)ret_copy;
13068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13069 LDKHolderCommitmentTransaction this_ptr_conv;
13070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13072 LDKTransaction val_conv = *(LDKTransaction*)val;
13073 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
13076 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
13077 LDKHolderCommitmentTransaction this_ptr_conv;
13078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13080 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13081 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
13085 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13086 LDKHolderCommitmentTransaction this_ptr_conv;
13087 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13088 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13089 LDKSignature val_ref;
13090 CHECK((*_env)->GetArrayLength (_env, val) == 64);
13091 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
13092 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
13095 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
13096 LDKHolderCommitmentTransaction this_ptr_conv;
13097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13099 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
13103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13104 LDKHolderCommitmentTransaction this_ptr_conv;
13105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13107 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
13110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13111 LDKHolderCommitmentTransaction this_ptr_conv;
13112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13114 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
13115 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13116 if (val_constr.datalen > 0)
13117 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13119 val_constr.data = NULL;
13120 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13121 for (size_t q = 0; q < val_constr.datalen; q++) {
13122 long arr_conv_42 = val_vals[q];
13123 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13124 FREE((void*)arr_conv_42);
13125 val_constr.data[q] = arr_conv_42_conv;
13127 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13128 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
13131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1new_1missing_1holder_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jbyteArray counterparty_sig, jbyteArray holder_funding_key, jbyteArray counterparty_funding_key, jlong keys, jint feerate_per_kw, jlongArray htlc_data) {
13132 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
13133 LDKSignature counterparty_sig_ref;
13134 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
13135 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
13136 LDKPublicKey holder_funding_key_ref;
13137 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
13138 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
13139 LDKPublicKey counterparty_funding_key_ref;
13140 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
13141 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
13142 LDKTxCreationKeys keys_conv;
13143 keys_conv.inner = (void*)(keys & (~1));
13144 keys_conv.is_owned = (keys & 1) || (keys == 0);
13145 if (keys_conv.inner != NULL)
13146 keys_conv = TxCreationKeys_clone(&keys_conv);
13147 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
13148 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
13149 if (htlc_data_constr.datalen > 0)
13150 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
13152 htlc_data_constr.data = NULL;
13153 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
13154 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
13155 long arr_conv_42 = htlc_data_vals[q];
13156 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
13157 FREE((void*)arr_conv_42);
13158 htlc_data_constr.data[q] = arr_conv_42_conv;
13160 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
13161 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx_conv, counterparty_sig_ref, holder_funding_key_ref, counterparty_funding_key_ref, keys_conv, feerate_per_kw, htlc_data_constr);
13162 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13163 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13164 long ret_ref = (long)ret_var.inner;
13165 if (ret_var.is_owned) {
13171 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
13172 LDKHolderCommitmentTransaction this_arg_conv;
13173 this_arg_conv.inner = (void*)(this_arg & (~1));
13174 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13175 LDKTxCreationKeys ret_var = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
13176 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13177 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13178 long ret_ref = (long)ret_var.inner;
13179 if (ret_var.is_owned) {
13185 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
13186 LDKHolderCommitmentTransaction this_arg_conv;
13187 this_arg_conv.inner = (void*)(this_arg & (~1));
13188 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13189 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
13190 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
13194 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) {
13195 LDKHolderCommitmentTransaction this_arg_conv;
13196 this_arg_conv.inner = (void*)(this_arg & (~1));
13197 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13198 unsigned char funding_key_arr[32];
13199 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
13200 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
13201 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
13202 LDKu8slice funding_redeemscript_ref;
13203 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
13204 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
13205 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
13206 (*_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);
13207 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
13211 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) {
13212 LDKHolderCommitmentTransaction this_arg_conv;
13213 this_arg_conv.inner = (void*)(this_arg & (~1));
13214 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13215 unsigned char htlc_base_key_arr[32];
13216 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
13217 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
13218 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
13219 LDKCResult_CVec_SignatureZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
13220 *ret_conv = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
13221 return (long)ret_conv;
13224 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
13225 LDKHolderCommitmentTransaction obj_conv;
13226 obj_conv.inner = (void*)(obj & (~1));
13227 obj_conv.is_owned = (obj & 1) || (obj == 0);
13228 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
13229 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13230 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13231 CVec_u8Z_free(arg_var);
13235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13236 LDKu8slice ser_ref;
13237 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13238 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13239 LDKHolderCommitmentTransaction ret_var = HolderCommitmentTransaction_read(ser_ref);
13240 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13241 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13242 long ret_ref = (long)ret_var.inner;
13243 if (ret_var.is_owned) {
13246 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13250 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13251 LDKInitFeatures this_ptr_conv;
13252 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13253 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13254 InitFeatures_free(this_ptr_conv);
13257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13258 LDKNodeFeatures this_ptr_conv;
13259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13261 NodeFeatures_free(this_ptr_conv);
13264 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13265 LDKChannelFeatures this_ptr_conv;
13266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13268 ChannelFeatures_free(this_ptr_conv);
13271 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13272 LDKRouteHop this_ptr_conv;
13273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13275 RouteHop_free(this_ptr_conv);
13278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13279 LDKRouteHop orig_conv;
13280 orig_conv.inner = (void*)(orig & (~1));
13281 orig_conv.is_owned = (orig & 1) || (orig == 0);
13282 LDKRouteHop ret_var = RouteHop_clone(&orig_conv);
13283 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13284 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13285 long ret_ref = (long)ret_var.inner;
13286 if (ret_var.is_owned) {
13292 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
13293 LDKRouteHop this_ptr_conv;
13294 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13295 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13296 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13297 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
13301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13302 LDKRouteHop this_ptr_conv;
13303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13305 LDKPublicKey val_ref;
13306 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13307 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13308 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
13311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13312 LDKRouteHop this_ptr_conv;
13313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13315 LDKNodeFeatures ret_var = RouteHop_get_node_features(&this_ptr_conv);
13316 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13317 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13318 long ret_ref = (long)ret_var.inner;
13319 if (ret_var.is_owned) {
13325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13326 LDKRouteHop this_ptr_conv;
13327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13329 LDKNodeFeatures val_conv;
13330 val_conv.inner = (void*)(val & (~1));
13331 val_conv.is_owned = (val & 1) || (val == 0);
13332 // Warning: we may need a move here but can't clone!
13333 RouteHop_set_node_features(&this_ptr_conv, val_conv);
13336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13337 LDKRouteHop this_ptr_conv;
13338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13340 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
13344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13345 LDKRouteHop this_ptr_conv;
13346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13348 RouteHop_set_short_channel_id(&this_ptr_conv, val);
13351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13352 LDKRouteHop this_ptr_conv;
13353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13355 LDKChannelFeatures ret_var = RouteHop_get_channel_features(&this_ptr_conv);
13356 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13357 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13358 long ret_ref = (long)ret_var.inner;
13359 if (ret_var.is_owned) {
13365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13366 LDKRouteHop this_ptr_conv;
13367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13369 LDKChannelFeatures val_conv;
13370 val_conv.inner = (void*)(val & (~1));
13371 val_conv.is_owned = (val & 1) || (val == 0);
13372 // Warning: we may need a move here but can't clone!
13373 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
13376 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13377 LDKRouteHop this_ptr_conv;
13378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13380 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
13384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13385 LDKRouteHop this_ptr_conv;
13386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13388 RouteHop_set_fee_msat(&this_ptr_conv, val);
13391 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13392 LDKRouteHop this_ptr_conv;
13393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13395 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
13399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13400 LDKRouteHop this_ptr_conv;
13401 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13402 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13403 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
13406 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) {
13407 LDKPublicKey pubkey_arg_ref;
13408 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
13409 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
13410 LDKNodeFeatures node_features_arg_conv;
13411 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
13412 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
13413 // Warning: we may need a move here but can't clone!
13414 LDKChannelFeatures channel_features_arg_conv;
13415 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
13416 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
13417 // Warning: we may need a move here but can't clone!
13418 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);
13419 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13420 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13421 long ret_ref = (long)ret_var.inner;
13422 if (ret_var.is_owned) {
13428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13429 LDKRoute this_ptr_conv;
13430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13432 Route_free(this_ptr_conv);
13435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13436 LDKRoute orig_conv;
13437 orig_conv.inner = (void*)(orig & (~1));
13438 orig_conv.is_owned = (orig & 1) || (orig == 0);
13439 LDKRoute ret_var = Route_clone(&orig_conv);
13440 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13441 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13442 long ret_ref = (long)ret_var.inner;
13443 if (ret_var.is_owned) {
13449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
13450 LDKRoute this_ptr_conv;
13451 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13452 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13453 LDKCVec_CVec_RouteHopZZ val_constr;
13454 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13455 if (val_constr.datalen > 0)
13456 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13458 val_constr.data = NULL;
13459 for (size_t m = 0; m < val_constr.datalen; m++) {
13460 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
13461 LDKCVec_RouteHopZ arr_conv_12_constr;
13462 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13463 if (arr_conv_12_constr.datalen > 0)
13464 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13466 arr_conv_12_constr.data = NULL;
13467 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13468 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13469 long arr_conv_10 = arr_conv_12_vals[k];
13470 LDKRouteHop arr_conv_10_conv;
13471 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13472 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13473 if (arr_conv_10_conv.inner != NULL)
13474 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13475 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13477 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13478 val_constr.data[m] = arr_conv_12_constr;
13480 Route_set_paths(&this_ptr_conv, val_constr);
13483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
13484 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
13485 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
13486 if (paths_arg_constr.datalen > 0)
13487 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
13489 paths_arg_constr.data = NULL;
13490 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
13491 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
13492 LDKCVec_RouteHopZ arr_conv_12_constr;
13493 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
13494 if (arr_conv_12_constr.datalen > 0)
13495 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
13497 arr_conv_12_constr.data = NULL;
13498 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
13499 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
13500 long arr_conv_10 = arr_conv_12_vals[k];
13501 LDKRouteHop arr_conv_10_conv;
13502 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
13503 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
13504 if (arr_conv_10_conv.inner != NULL)
13505 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
13506 arr_conv_12_constr.data[k] = arr_conv_10_conv;
13508 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
13509 paths_arg_constr.data[m] = arr_conv_12_constr;
13511 LDKRoute ret_var = Route_new(paths_arg_constr);
13512 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13513 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13514 long ret_ref = (long)ret_var.inner;
13515 if (ret_var.is_owned) {
13521 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
13523 obj_conv.inner = (void*)(obj & (~1));
13524 obj_conv.is_owned = (obj & 1) || (obj == 0);
13525 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
13526 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13527 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13528 CVec_u8Z_free(arg_var);
13532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13533 LDKu8slice ser_ref;
13534 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13535 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13536 LDKRoute ret_var = Route_read(ser_ref);
13537 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13538 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13539 long ret_ref = (long)ret_var.inner;
13540 if (ret_var.is_owned) {
13543 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13548 LDKRouteHint this_ptr_conv;
13549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13551 RouteHint_free(this_ptr_conv);
13554 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
13555 LDKRouteHint orig_conv;
13556 orig_conv.inner = (void*)(orig & (~1));
13557 orig_conv.is_owned = (orig & 1) || (orig == 0);
13558 LDKRouteHint ret_var = RouteHint_clone(&orig_conv);
13559 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13560 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13561 long ret_ref = (long)ret_var.inner;
13562 if (ret_var.is_owned) {
13568 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13569 LDKRouteHint this_ptr_conv;
13570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13572 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13573 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
13577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13578 LDKRouteHint this_ptr_conv;
13579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13581 LDKPublicKey val_ref;
13582 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13583 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13584 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
13587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
13588 LDKRouteHint this_ptr_conv;
13589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13590 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13591 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
13595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13596 LDKRouteHint this_ptr_conv;
13597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13599 RouteHint_set_short_channel_id(&this_ptr_conv, val);
13602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13603 LDKRouteHint this_ptr_conv;
13604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13606 LDKRoutingFees ret_var = RouteHint_get_fees(&this_ptr_conv);
13607 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13608 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13609 long ret_ref = (long)ret_var.inner;
13610 if (ret_var.is_owned) {
13616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13617 LDKRouteHint this_ptr_conv;
13618 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13619 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13620 LDKRoutingFees val_conv;
13621 val_conv.inner = (void*)(val & (~1));
13622 val_conv.is_owned = (val & 1) || (val == 0);
13623 if (val_conv.inner != NULL)
13624 val_conv = RoutingFees_clone(&val_conv);
13625 RouteHint_set_fees(&this_ptr_conv, val_conv);
13628 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13629 LDKRouteHint this_ptr_conv;
13630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13632 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
13636 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13637 LDKRouteHint this_ptr_conv;
13638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13640 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
13643 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13644 LDKRouteHint this_ptr_conv;
13645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13647 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
13651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13652 LDKRouteHint this_ptr_conv;
13653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13655 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
13658 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) {
13659 LDKPublicKey src_node_id_arg_ref;
13660 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
13661 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
13662 LDKRoutingFees fees_arg_conv;
13663 fees_arg_conv.inner = (void*)(fees_arg & (~1));
13664 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
13665 if (fees_arg_conv.inner != NULL)
13666 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
13667 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);
13668 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13669 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13670 long ret_ref = (long)ret_var.inner;
13671 if (ret_var.is_owned) {
13677 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) {
13678 LDKPublicKey our_node_id_ref;
13679 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
13680 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
13681 LDKNetworkGraph network_conv;
13682 network_conv.inner = (void*)(network & (~1));
13683 network_conv.is_owned = (network & 1) || (network == 0);
13684 LDKPublicKey target_ref;
13685 CHECK((*_env)->GetArrayLength (_env, target) == 33);
13686 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
13687 LDKCVec_ChannelDetailsZ first_hops_constr;
13688 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
13689 if (first_hops_constr.datalen > 0)
13690 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
13692 first_hops_constr.data = NULL;
13693 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
13694 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
13695 long arr_conv_16 = first_hops_vals[q];
13696 LDKChannelDetails arr_conv_16_conv;
13697 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
13698 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
13699 first_hops_constr.data[q] = arr_conv_16_conv;
13701 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
13702 LDKCVec_RouteHintZ last_hops_constr;
13703 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
13704 if (last_hops_constr.datalen > 0)
13705 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
13707 last_hops_constr.data = NULL;
13708 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
13709 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
13710 long arr_conv_11 = last_hops_vals[l];
13711 LDKRouteHint arr_conv_11_conv;
13712 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
13713 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
13714 if (arr_conv_11_conv.inner != NULL)
13715 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
13716 last_hops_constr.data[l] = arr_conv_11_conv;
13718 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
13719 LDKLogger logger_conv = *(LDKLogger*)logger;
13720 if (logger_conv.free == LDKLogger_JCalls_free) {
13721 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13722 LDKLogger_JCalls_clone(logger_conv.this_arg);
13724 LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
13725 *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);
13726 FREE(first_hops_constr.data);
13727 return (long)ret_conv;
13730 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13731 LDKNetworkGraph this_ptr_conv;
13732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13734 NetworkGraph_free(this_ptr_conv);
13737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13738 LDKLockedNetworkGraph this_ptr_conv;
13739 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13740 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13741 LockedNetworkGraph_free(this_ptr_conv);
13744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13745 LDKNetGraphMsgHandler this_ptr_conv;
13746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13748 NetGraphMsgHandler_free(this_ptr_conv);
13751 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
13752 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13753 LDKLogger logger_conv = *(LDKLogger*)logger;
13754 if (logger_conv.free == LDKLogger_JCalls_free) {
13755 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13756 LDKLogger_JCalls_clone(logger_conv.this_arg);
13758 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
13759 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13760 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13761 long ret_ref = (long)ret_var.inner;
13762 if (ret_var.is_owned) {
13768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
13769 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
13770 LDKLogger logger_conv = *(LDKLogger*)logger;
13771 if (logger_conv.free == LDKLogger_JCalls_free) {
13772 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
13773 LDKLogger_JCalls_clone(logger_conv.this_arg);
13775 LDKNetworkGraph network_graph_conv;
13776 network_graph_conv.inner = (void*)(network_graph & (~1));
13777 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
13778 // Warning: we may need a move here but can't clone!
13779 LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
13780 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13781 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13782 long ret_ref = (long)ret_var.inner;
13783 if (ret_var.is_owned) {
13789 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13790 LDKNetGraphMsgHandler this_arg_conv;
13791 this_arg_conv.inner = (void*)(this_arg & (~1));
13792 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13793 LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
13794 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13795 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13796 long ret_ref = (long)ret_var.inner;
13797 if (ret_var.is_owned) {
13803 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
13804 LDKLockedNetworkGraph this_arg_conv;
13805 this_arg_conv.inner = (void*)(this_arg & (~1));
13806 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13807 LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
13808 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13809 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13810 long ret_ref = (long)ret_var.inner;
13811 if (ret_var.is_owned) {
13817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
13818 LDKNetGraphMsgHandler this_arg_conv;
13819 this_arg_conv.inner = (void*)(this_arg & (~1));
13820 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13821 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
13822 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
13826 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13827 LDKDirectionalChannelInfo this_ptr_conv;
13828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13830 DirectionalChannelInfo_free(this_ptr_conv);
13833 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
13834 LDKDirectionalChannelInfo this_ptr_conv;
13835 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13836 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13837 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
13841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
13842 LDKDirectionalChannelInfo this_ptr_conv;
13843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13845 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
13848 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
13849 LDKDirectionalChannelInfo this_ptr_conv;
13850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13852 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
13856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
13857 LDKDirectionalChannelInfo this_ptr_conv;
13858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13860 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
13863 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
13864 LDKDirectionalChannelInfo 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 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
13871 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
13872 LDKDirectionalChannelInfo this_ptr_conv;
13873 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13874 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13875 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
13878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
13879 LDKDirectionalChannelInfo this_ptr_conv;
13880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13882 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
13886 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13887 LDKDirectionalChannelInfo this_ptr_conv;
13888 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13889 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13890 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
13893 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
13894 LDKDirectionalChannelInfo this_ptr_conv;
13895 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13896 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13897 LDKChannelUpdate ret_var = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
13898 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13899 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13900 long ret_ref = (long)ret_var.inner;
13901 if (ret_var.is_owned) {
13907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13908 LDKDirectionalChannelInfo this_ptr_conv;
13909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13911 LDKChannelUpdate val_conv;
13912 val_conv.inner = (void*)(val & (~1));
13913 val_conv.is_owned = (val & 1) || (val == 0);
13914 if (val_conv.inner != NULL)
13915 val_conv = ChannelUpdate_clone(&val_conv);
13916 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
13919 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13920 LDKDirectionalChannelInfo obj_conv;
13921 obj_conv.inner = (void*)(obj & (~1));
13922 obj_conv.is_owned = (obj & 1) || (obj == 0);
13923 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
13924 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13925 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13926 CVec_u8Z_free(arg_var);
13930 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13931 LDKu8slice ser_ref;
13932 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13933 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13934 LDKDirectionalChannelInfo ret_var = DirectionalChannelInfo_read(ser_ref);
13935 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13936 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13937 long ret_ref = (long)ret_var.inner;
13938 if (ret_var.is_owned) {
13941 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13946 LDKChannelInfo this_ptr_conv;
13947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13948 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13949 ChannelInfo_free(this_ptr_conv);
13952 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
13953 LDKChannelInfo this_ptr_conv;
13954 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13955 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13956 LDKChannelFeatures ret_var = ChannelInfo_get_features(&this_ptr_conv);
13957 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
13958 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
13959 long ret_ref = (long)ret_var.inner;
13960 if (ret_var.is_owned) {
13966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13967 LDKChannelInfo this_ptr_conv;
13968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13969 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13970 LDKChannelFeatures val_conv;
13971 val_conv.inner = (void*)(val & (~1));
13972 val_conv.is_owned = (val & 1) || (val == 0);
13973 // Warning: we may need a move here but can't clone!
13974 ChannelInfo_set_features(&this_ptr_conv, val_conv);
13977 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
13978 LDKChannelInfo this_ptr_conv;
13979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13981 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
13982 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
13986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
13987 LDKChannelInfo this_ptr_conv;
13988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13990 LDKPublicKey val_ref;
13991 CHECK((*_env)->GetArrayLength (_env, val) == 33);
13992 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
13993 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
13996 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
13997 LDKChannelInfo this_ptr_conv;
13998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14000 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_one_to_two(&this_ptr_conv);
14001 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14002 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14003 long ret_ref = (long)ret_var.inner;
14004 if (ret_var.is_owned) {
14010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14011 LDKChannelInfo this_ptr_conv;
14012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14014 LDKDirectionalChannelInfo val_conv;
14015 val_conv.inner = (void*)(val & (~1));
14016 val_conv.is_owned = (val & 1) || (val == 0);
14017 // Warning: we may need a move here but can't clone!
14018 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
14021 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
14022 LDKChannelInfo this_ptr_conv;
14023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14025 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
14026 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
14030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14031 LDKChannelInfo this_ptr_conv;
14032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14034 LDKPublicKey val_ref;
14035 CHECK((*_env)->GetArrayLength (_env, val) == 33);
14036 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
14037 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
14040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
14041 LDKChannelInfo this_ptr_conv;
14042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14044 LDKDirectionalChannelInfo ret_var = ChannelInfo_get_two_to_one(&this_ptr_conv);
14045 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14046 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14047 long ret_ref = (long)ret_var.inner;
14048 if (ret_var.is_owned) {
14054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14055 LDKChannelInfo this_ptr_conv;
14056 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14057 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14058 LDKDirectionalChannelInfo val_conv;
14059 val_conv.inner = (void*)(val & (~1));
14060 val_conv.is_owned = (val & 1) || (val == 0);
14061 // Warning: we may need a move here but can't clone!
14062 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
14065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14066 LDKChannelInfo this_ptr_conv;
14067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14068 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14069 LDKChannelAnnouncement ret_var = ChannelInfo_get_announcement_message(&this_ptr_conv);
14070 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14071 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14072 long ret_ref = (long)ret_var.inner;
14073 if (ret_var.is_owned) {
14079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14080 LDKChannelInfo this_ptr_conv;
14081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14083 LDKChannelAnnouncement val_conv;
14084 val_conv.inner = (void*)(val & (~1));
14085 val_conv.is_owned = (val & 1) || (val == 0);
14086 if (val_conv.inner != NULL)
14087 val_conv = ChannelAnnouncement_clone(&val_conv);
14088 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
14091 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14092 LDKChannelInfo obj_conv;
14093 obj_conv.inner = (void*)(obj & (~1));
14094 obj_conv.is_owned = (obj & 1) || (obj == 0);
14095 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
14096 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14097 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14098 CVec_u8Z_free(arg_var);
14102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14103 LDKu8slice ser_ref;
14104 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14105 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14106 LDKChannelInfo ret_var = ChannelInfo_read(ser_ref);
14107 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14108 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14109 long ret_ref = (long)ret_var.inner;
14110 if (ret_var.is_owned) {
14113 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14118 LDKRoutingFees this_ptr_conv;
14119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14121 RoutingFees_free(this_ptr_conv);
14124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
14125 LDKRoutingFees orig_conv;
14126 orig_conv.inner = (void*)(orig & (~1));
14127 orig_conv.is_owned = (orig & 1) || (orig == 0);
14128 LDKRoutingFees ret_var = RoutingFees_clone(&orig_conv);
14129 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14130 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14131 long ret_ref = (long)ret_var.inner;
14132 if (ret_var.is_owned) {
14138 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
14139 LDKRoutingFees this_ptr_conv;
14140 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14141 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14142 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
14146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14147 LDKRoutingFees this_ptr_conv;
14148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14150 RoutingFees_set_base_msat(&this_ptr_conv, val);
14153 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
14154 LDKRoutingFees this_ptr_conv;
14155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14157 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
14161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14162 LDKRoutingFees this_ptr_conv;
14163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14165 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
14168 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
14169 LDKRoutingFees ret_var = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
14170 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14171 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14172 long ret_ref = (long)ret_var.inner;
14173 if (ret_var.is_owned) {
14179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14180 LDKu8slice ser_ref;
14181 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14182 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14183 LDKRoutingFees ret_var = RoutingFees_read(ser_ref);
14184 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14185 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14186 long ret_ref = (long)ret_var.inner;
14187 if (ret_var.is_owned) {
14190 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14194 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
14195 LDKRoutingFees obj_conv;
14196 obj_conv.inner = (void*)(obj & (~1));
14197 obj_conv.is_owned = (obj & 1) || (obj == 0);
14198 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
14199 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14200 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14201 CVec_u8Z_free(arg_var);
14205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14206 LDKNodeAnnouncementInfo this_ptr_conv;
14207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14208 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14209 NodeAnnouncementInfo_free(this_ptr_conv);
14212 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
14213 LDKNodeAnnouncementInfo this_ptr_conv;
14214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14216 LDKNodeFeatures ret_var = NodeAnnouncementInfo_get_features(&this_ptr_conv);
14217 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14218 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14219 long ret_ref = (long)ret_var.inner;
14220 if (ret_var.is_owned) {
14226 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14227 LDKNodeAnnouncementInfo this_ptr_conv;
14228 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14229 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14230 LDKNodeFeatures val_conv;
14231 val_conv.inner = (void*)(val & (~1));
14232 val_conv.is_owned = (val & 1) || (val == 0);
14233 // Warning: we may need a move here but can't clone!
14234 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
14237 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
14238 LDKNodeAnnouncementInfo this_ptr_conv;
14239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14241 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
14245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
14246 LDKNodeAnnouncementInfo this_ptr_conv;
14247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14249 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
14252 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
14253 LDKNodeAnnouncementInfo this_ptr_conv;
14254 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14255 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14256 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
14257 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
14261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14262 LDKNodeAnnouncementInfo this_ptr_conv;
14263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14265 LDKThreeBytes val_ref;
14266 CHECK((*_env)->GetArrayLength (_env, val) == 3);
14267 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
14268 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
14271 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
14272 LDKNodeAnnouncementInfo this_ptr_conv;
14273 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14274 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14275 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
14276 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
14280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
14281 LDKNodeAnnouncementInfo this_ptr_conv;
14282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14284 LDKThirtyTwoBytes val_ref;
14285 CHECK((*_env)->GetArrayLength (_env, val) == 32);
14286 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
14287 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
14290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14291 LDKNodeAnnouncementInfo this_ptr_conv;
14292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14294 LDKCVec_NetAddressZ val_constr;
14295 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14296 if (val_constr.datalen > 0)
14297 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14299 val_constr.data = NULL;
14300 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14301 for (size_t m = 0; m < val_constr.datalen; m++) {
14302 long arr_conv_12 = val_vals[m];
14303 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14304 FREE((void*)arr_conv_12);
14305 val_constr.data[m] = arr_conv_12_conv;
14307 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14308 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
14311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
14312 LDKNodeAnnouncementInfo this_ptr_conv;
14313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14315 LDKNodeAnnouncement ret_var = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
14316 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14317 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14318 long ret_ref = (long)ret_var.inner;
14319 if (ret_var.is_owned) {
14325 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14326 LDKNodeAnnouncementInfo this_ptr_conv;
14327 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14328 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14329 LDKNodeAnnouncement val_conv;
14330 val_conv.inner = (void*)(val & (~1));
14331 val_conv.is_owned = (val & 1) || (val == 0);
14332 if (val_conv.inner != NULL)
14333 val_conv = NodeAnnouncement_clone(&val_conv);
14334 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
14337 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) {
14338 LDKNodeFeatures features_arg_conv;
14339 features_arg_conv.inner = (void*)(features_arg & (~1));
14340 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
14341 // Warning: we may need a move here but can't clone!
14342 LDKThreeBytes rgb_arg_ref;
14343 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
14344 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
14345 LDKThirtyTwoBytes alias_arg_ref;
14346 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
14347 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
14348 LDKCVec_NetAddressZ addresses_arg_constr;
14349 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
14350 if (addresses_arg_constr.datalen > 0)
14351 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
14353 addresses_arg_constr.data = NULL;
14354 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
14355 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
14356 long arr_conv_12 = addresses_arg_vals[m];
14357 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
14358 FREE((void*)arr_conv_12);
14359 addresses_arg_constr.data[m] = arr_conv_12_conv;
14361 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
14362 LDKNodeAnnouncement announcement_message_arg_conv;
14363 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
14364 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
14365 if (announcement_message_arg_conv.inner != NULL)
14366 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
14367 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
14368 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14369 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14370 long ret_ref = (long)ret_var.inner;
14371 if (ret_var.is_owned) {
14377 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14378 LDKNodeAnnouncementInfo obj_conv;
14379 obj_conv.inner = (void*)(obj & (~1));
14380 obj_conv.is_owned = (obj & 1) || (obj == 0);
14381 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
14382 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14383 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14384 CVec_u8Z_free(arg_var);
14388 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14389 LDKu8slice ser_ref;
14390 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14391 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14392 LDKNodeAnnouncementInfo ret_var = NodeAnnouncementInfo_read(ser_ref);
14393 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14394 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14395 long ret_ref = (long)ret_var.inner;
14396 if (ret_var.is_owned) {
14399 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
14404 LDKNodeInfo this_ptr_conv;
14405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14406 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14407 NodeInfo_free(this_ptr_conv);
14410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
14411 LDKNodeInfo this_ptr_conv;
14412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14414 LDKCVec_u64Z val_constr;
14415 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
14416 if (val_constr.datalen > 0)
14417 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14419 val_constr.data = NULL;
14420 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
14421 for (size_t g = 0; g < val_constr.datalen; g++) {
14422 long arr_conv_6 = val_vals[g];
14423 val_constr.data[g] = arr_conv_6;
14425 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
14426 NodeInfo_set_channels(&this_ptr_conv, val_constr);
14429 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
14430 LDKNodeInfo this_ptr_conv;
14431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14433 LDKRoutingFees ret_var = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
14434 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14435 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14436 long ret_ref = (long)ret_var.inner;
14437 if (ret_var.is_owned) {
14443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14444 LDKNodeInfo this_ptr_conv;
14445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14447 LDKRoutingFees val_conv;
14448 val_conv.inner = (void*)(val & (~1));
14449 val_conv.is_owned = (val & 1) || (val == 0);
14450 if (val_conv.inner != NULL)
14451 val_conv = RoutingFees_clone(&val_conv);
14452 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
14455 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
14456 LDKNodeInfo this_ptr_conv;
14457 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14458 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14459 LDKNodeAnnouncementInfo ret_var = NodeInfo_get_announcement_info(&this_ptr_conv);
14460 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14461 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14462 long ret_ref = (long)ret_var.inner;
14463 if (ret_var.is_owned) {
14469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
14470 LDKNodeInfo this_ptr_conv;
14471 this_ptr_conv.inner = (void*)(this_ptr & (~1));
14472 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
14473 LDKNodeAnnouncementInfo val_conv;
14474 val_conv.inner = (void*)(val & (~1));
14475 val_conv.is_owned = (val & 1) || (val == 0);
14476 // Warning: we may need a move here but can't clone!
14477 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
14480 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) {
14481 LDKCVec_u64Z channels_arg_constr;
14482 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
14483 if (channels_arg_constr.datalen > 0)
14484 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
14486 channels_arg_constr.data = NULL;
14487 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
14488 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
14489 long arr_conv_6 = channels_arg_vals[g];
14490 channels_arg_constr.data[g] = arr_conv_6;
14492 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
14493 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
14494 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
14495 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
14496 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
14497 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
14498 LDKNodeAnnouncementInfo announcement_info_arg_conv;
14499 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
14500 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
14501 // Warning: we may need a move here but can't clone!
14502 LDKNodeInfo ret_var = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
14503 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14504 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14505 long ret_ref = (long)ret_var.inner;
14506 if (ret_var.is_owned) {
14512 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
14513 LDKNodeInfo obj_conv;
14514 obj_conv.inner = (void*)(obj & (~1));
14515 obj_conv.is_owned = (obj & 1) || (obj == 0);
14516 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
14517 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14518 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14519 CVec_u8Z_free(arg_var);
14523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14524 LDKu8slice ser_ref;
14525 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14526 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14527 LDKNodeInfo ret_var = NodeInfo_read(ser_ref);
14528 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14529 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14530 long ret_ref = (long)ret_var.inner;
14531 if (ret_var.is_owned) {
14534 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14538 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
14539 LDKNetworkGraph obj_conv;
14540 obj_conv.inner = (void*)(obj & (~1));
14541 obj_conv.is_owned = (obj & 1) || (obj == 0);
14542 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
14543 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
14544 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
14545 CVec_u8Z_free(arg_var);
14549 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
14550 LDKu8slice ser_ref;
14551 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
14552 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
14553 LDKNetworkGraph ret_var = NetworkGraph_read(ser_ref);
14554 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14555 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14556 long ret_ref = (long)ret_var.inner;
14557 if (ret_var.is_owned) {
14560 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
14564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
14565 LDKNetworkGraph ret_var = NetworkGraph_new();
14566 CHECK((((long)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
14567 CHECK((((long)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
14568 long ret_ref = (long)ret_var.inner;
14569 if (ret_var.is_owned) {
14575 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) {
14576 LDKNetworkGraph this_arg_conv;
14577 this_arg_conv.inner = (void*)(this_arg & (~1));
14578 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
14579 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);